NukoTween is a Tween animation engine implemented in Udon. It is intended to be used with VRChat.
It is assumed that VRChat Creator Companion (VCC) is installed.
Also, you need to add the following packages:
- UdonSharp
- Access NukoraTween introduction page and press the Add to VCC button.
- VCC will start and a confirmation screen for adding the NukoTween repository will be displayed. Follow the on-screen instructions to add it.
- Find the project you want to use NukoTween in VCC and press the Manage Project button.
- Add NukoTween from the package list.
*Steps 1 and 2 can be omitted from the second time onwards.
*For environments other than VCC, please download the older version of unitypackage from [NukoTween v0.0.8 release page] (https://github.com/nukora/NukoTween/releases/tag/v0.0.8). However, this will no longer be updated.
- Place the NukoTweenEngine prefab in the hierarchy in the Packages/NukoTween/Runtime directory.
- Create the object you want to Tween on the hierarchy.
- Attach UdonBehavior to the created object and write a script like the one below.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class TweenCube : UdonSharpBehaviour
{
public NukoTween.NukoTweenEngine tween;
public override void Interact()
{
tween.LocalMoveTo(gameObject, new Vector3(1f, 0.5f, 0f), 1f, 0f, tween.EaseInOutCubic, false);
}
}
- Attach the NukoTweenEngine on the hierarchy to the tween field in the inspector.
- Press the Trigger Interact button after playing the scene and confirm that the animation is playing.
All functions are implemented as instance methods of the NukoTweenEngine
class.
Set the following values for the arguments.
target
target to operate onto
state after operationduration
Time taken for operation (seconds)delay
time (in seconds) to delay the start of the operationeaseId
[easing function] to use (#easing function)relative
Whether to change relative to the current state
LocalMoveTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target's LocalPosition to the specified position.
MoveTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target's Position to the specified position.
LocalScaleTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target's LocalScale to the specified magnitude.
LocalRotateTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target's LocalRotate to the specified angle.
The angle is specified in Euler angles.
LocalRotateQuaternionTo(GameObject target, Quaternion to, float duration, float delay, int easeId, bool relative)
Changes the target's LocalRotate to the specified angle.
Specify the angle as a quaternion.
RotateTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target Rotate to the specified angle.
The angle is specified in Euler angles.
RotateQuaternionTo(GameObject target, Quaternion to, float duration, float delay, int easeId, bool relative)
Changes the target Rotate to the specified angle.
Specify the angle as a quaternion.
AnchorPosTo(GameObject target, Vector3 to, float duration, float delay, int easeId, bool relative)
Changes the target's AnchoredPosition to the specified position.
GraphicColorTo(Graphic target, Color to, float duration, float delay, int easeId)
Changes the target color to the specified color.
GraphicFadeTo(Graphic target, float to, float duration, float delay, int easeId)
Changes the transparency of the target Color to the specified value.
FillAmountTo(Image target, float to, float duration, float delay, int easeId)
Changes the target's FillAmount to the specified value.
TextTo(Text target, string to, float duration, float delay, int easeId)
Manipulate the target Text and perform character advancing animation.
TMPTextTo(TextMeshProUGUI target, string to, float duration, float delay, int easeId)
Manipulate the target Text and perform character advancing animation.
AudioFadeTo(AudioSource target, float to, float duration, float delay, int easeId)
Changes the target Volume to the specified volume.
MaterialColorTo(Material target, string propertyName, Color to, float duration, float delay, int easeId)
Changes the material's Color type property to the specified color.
MaterialFadeTo(Material target, string propertyName, float to, float duration, float delay, int easeId)
Changes the transparency of the material's Color type property to the specified value.
MaterialVectorTo(Material target, string propertyName, Vector4 to, float duration, float delay, int easeId)
Changes the Vector type property of the material to the specified value.
MaterialFloatTo(Material target, string propertyName, float to, float duration, float delay, int easeId)
Changes the material's Float type property to the specified value.
MaterialTexOffsetTo(Material target, string propertyName, Vector2 to, float duration, float delay, int easeId)
Changes the Offset of the material's texture type property to the specified value.
MaterialTexTilingTo(Material target, string propertyName, Vector2 to, float duration, float delay, int easeId)
Changes the Tiling of the material's texture type property to the specified value.
DelayedSetActive(GameObject target, bool active, float delay)
Changes the GameObject's SetActive after the specified time.
DelayedCall(UdonSharpBehaviour target, string customEventName, float delay)
Executes SendCustomEvent after the specified time.
Complete(int tweenId)
Immediately puts a running tween into a completed state.
CompleteAll()
Brings all running tweens to a completed state.
Kill(int tweenId)
Aborts a running tween in its current state.
KillAll()
Aborts all running tweens in their current state.
Set the registered tween to loop.
Specify the number of loops for loops, and passing -1 will create an infinite loop.
LoopRestart(int tweenId, int loops)
When looping, the animation reruns after resetting the value to the previous starting point.
LoopReverse(int tweenId, int loops)
When looping, repeat the animation starting from the previous end point and returning to the previous start point.
LoopIncremental(int tweenId, int loops)
When looping, it runs the same animation as before, starting from the previous ending point.
You can use the following easing functions:
It is defined as a read-only instance variable of the NukoTweenEngine
class, so please use this when calling the method.
- EaseLinear
- Ease In Sine -EaseOutSine
- Ease In Out Sine
- Ease In Quad -EaseOutQuad
- EaseInOutQuad
- EaseInCubic -EaseOutCubic
- EaseInOutCubic -EaseInQuart -EaseOutQuart -EaseInOutQuart -EaseInQuint -EaseOutQuint -EaseInOutQuint
- Ease In Expo
- Ease Out Expo
- EaseInOutExpo -Ease In Circ -Ease Out Circ -Ease In Out Circ
- Ease In Back -Ease Out Back
- Ease In Out Back
- Ease In Elastic
- Ease Out Elastic -EaseInOutElastic
- Ease In Bounce -Ease Out Bounce
- EaseInOutBounce
Customize engine behavior.
It can be changed from the inspector of the object to which NukoTweenEngine
is attached.
Specifies the number of tweens that can run simultaneously. This includes waiting tweens.
This program is covered by the MIT license.
This software is released under the MIT License, see LICENSE.