An extremely light weight, extendable and customisable tweening engine made for strictly typed script-based animations for user-interfaces and world-space objects optimised for all platforms.
Installation · Documentation · License
Made with ♥ by Jeffrey Lanters
Install the latest stable release using the Unity Package Manager by adding the following line to your manifest.json
file located within your project's Packages directory, or by adding the Git URL to the Package Manager Window inside of Unity.
"nl.elraccoone.tweens": "git+https://github.com/jeffreylanters/unity-tweens"
The module is availble on the OpenUPM package registry, you can install the latest stable release using the OpenUPM Package manager's Command Line Tool using the following command.
openupm add nl.elraccoone.tweens
This module is benchmarked against LeanTween and ITween and beats both in Unity 2020.1 with running 1000 complex tweens simulataniously. The power and speed you expect get other tweening engines, with strictly typed, clean and ease-to-use chainable methods for all use cases.
- Getting Started - Code examples on how to create your first Tween
- Tweening Methods - Tweening methods available to animate various properties
- Chainable Options - Chainable options allowing you to alter the Tween's behaviour
- Other Methods - Various other options available on instanciated Tweens
These are some of the endless possibilities using Tweens. Tweens can be invoked on any GameObject and Component and fetches their own required components so you don't have to. Chainable Options can used endlessly in order to customize the behaviour to your needs.
using UnityEngine;
using ElRaccoone.Tweens;
public class SomeComponent : MonoBehaviour {
private void Start () {
this.gameObject.TweenPosition (new Vector3 (10, 1, 15), 5).SetFrom (Vector3.zero).SetOnComplete (SomeMethod);
this.gameObject.TweenAnchoredPositionX (100, 2).SetPingPong ().SetLoopCount (2);
this.gameObject.TweenLocalRotation (Vector3.one * 360, 10).SetDelay (10).SetEaseSineOut ();
this.gameObject.TweenImageFillAmount (0.75, 2).SetEaseQuartInOut ().SetRandomTime ();
this.gameObject.TweenMaterialColor (Color.red, 10).SetUseUnscaledTime (false).SetEaseCircInOut ();
this.gameObject.TweenLightIntensity (10, 1).SetInfinite ().SetRandomTime ().SetOnCancel (SomeOtherMethod);
this.gameObject.TweenCancelAll ();
}
private async void AsyncAnimationSequence () {
await this.gameObject.TweenCanvasGroupAlpha (0, 1).SetEaseElasticIn ().SetOvershooting (2).Await ();
await this.gameObject.TweenVolumeWeight (50, 2).SetTime (0.25f).SetEaseExpoOut ().Await ();
}
private IEnumerator RoutineAnimationSequence () {
yield return this.gameObject.TweenAudioSourcePriority (5, 10).SetEase (EaseType.BounceInOut).Yield ();
yield return this.gameObject.TweenValueFloat (100, 1, value => { }).SetFrom (100).SetEaseSineIn ().Yield ();
}
}
version 1.0.0
Instantiates a Tween animating the Position.
<GameObject, Component>.TweenPosition (Vector3 to, float duration) : Tween<Vector3>;
version 1.0.0
Instantiates a Tween animating the X axis of the Position.
<GameObject, Component>.TweenPositionX (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Y axis of the Position.
<GameObject, Component>.TweenPositionY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Z axis of the Position.
<GameObject, Component>.TweenPositionZ (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the LocalPosition.
<GameObject, Component>.TweenLocalPosition (Vector3 to, float duration) : Tween<Vector3>;
version 1.0.0
Instantiates a Tween animating the X axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionX (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Y axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Z axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionZ (float to, float duration) : Tween<float>;
version 1.0.2
Instantiates a Tween animating the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPosition (Vector2 to, float duration) : Tween<Vector2>;
version 1.0.2
Instantiates a Tween animating the X axis of the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPositionX (float to, float duration) : Tween<float>;
version 1.0.2
Instantiates a Tween animating the Y axis of the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPositionY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Rotation.
<GameObject, Component>.TweenRotation (Vector3 to, float duration) : Tween<Vector3>;
version 1.0.0
Instantiates a Tween animating the X axis of the Rotation.
<GameObject, Component>.TweenRotationX (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Y axis of the Rotation.
<GameObject, Component>.TweenRotationY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Z axis of the Rotation.
<GameObject, Component>.TweenRotationZ (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the LocalRotation.
<GameObject, Component>.TweenLocalRotation (Vector3 to, float duration) : Tween<Vector3>;
version 1.0.0
Instantiates a Tween animating the X axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationX (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Y axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Z axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationZ (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the LocalScale.
<GameObject, Component>.TweenLocalScale (Vector3 to, float duration) : Tween<Vector3>;
version 1.0.0
Instantiates a Tween animating the X axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleX (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Y axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleY (float to, float duration) : Tween<float>;
version 1.0.0
Instantiates a Tween animating the Z axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleZ (float to, float duration) : Tween<float>;
version 1.0.3
requires com.unity.ugui
Instantiates a Tween animating the fillAmount of an image.
<GameObject, Component>.TweenImageFillAmount (float to, float duration) : Tween<float>;
version 1.0.4
requires com.unity.ugui
Instantiates a Tween animating the alpha of a graphic.
<GameObject, Component>.TweenGraphicAlpha (float to, float duration) : Tween<float>;
version 1.0.4
requires com.unity.ugui
Instantiates a Tween animating the color of a graphic.
<GameObject, Component>.TweenGraphicColor (Color to, float duration) : Tween<Color>;
version 1.0.4
Instantiates a Tween animating the alpha of a SpriteRenderer.
<GameObject, Component>.TweenSpriteRendererAlpha (float to, float duration) : Tween<float>;
version 1.0.5
Instantiates a Tween animating the color of a SpriteRenderer.
<GameObject, Component>.TweenSpriteRendererColor (Color to, float duration) : Tween<Color>;
version 1.0.9
Instantiates a Tween animating the alpha of a Material.
<GameObject, Component>.TweenMaterialAlpha (float to, float duration) : Tween<float>;
version 1.0.9
Instantiates a Tween animating the color of a Material.
<GameObject, Component>.TweenMaterialColor (Color to, float duration) : Tween<Color>;
version 1.0.8
Instantiates a Tween animating the alpha of a TextMesh.
<GameObject, Component>.TweenTextMeshAlpha (float to, float duration) : Tween<float>;
version 1.7.0
Instantiates a Tween animating the color of a TextMesh.
<GameObject, Component>.TweenTextMeshColor (Color to, float duration) : Tween<Color>;
version 1.7.0
requires com.unity.textmeshpro
Instantiates a Tween animating the color of a TextMeshPro.
<GameObject, Component>.TweenTextMeshProColor (Color to, float duration) : Tween<Color>;
version 1.7.0
requires com.unity.textmeshpro
Instantiates a Tween animating the alpha of a TextMeshPro.
<GameObject, Component>.TweenTextMeshProAlpha (float to, float duration) : Tween<float>;
version 1.0.10
Instantiates a Tween animating the alpha of a CanvasGroup.
<GameObject, Component>.TweenCanvasGroupAlpha (float to, float duration) : Tween<float>;
version 1.0.11
Instantiates a Tween easing the pitch of an AudioSource.
<GameObject, Component>.TweenAudioSourcePitch (float to, float duration) : Tween<float>;
version 1.10.0
Instantiates a Tween easing the priority of an AudioSource.
<GameObject, Component>.TweenAudioSourcePriority (float to, float duration) : Tween<float>;
version 1.10.0
Instantiates a Tween easing the reverb zone mix of an AudioSource.
<GameObject, Component>.TweenAudioSourceReverbZoneMix (float to, float duration) : Tween<float>;
version 1.10.0
Instantiates a Tween easing the spatial blend of an AudioSource.
<GameObject, Component>.TweenAudioSourceSpatialBlend (float to, float duration) : Tween<float>;
version 1.10.0
Instantiates a Tween easing the stereo pan of an AudioSource.
<GameObject, Component>.TweenAudioSourceStereoPan (float to, float duration) : Tween<float>;
version 1.0.11
Instantiates a Tween easing the volume of an AudioSource.
<GameObject, Component>.TweenAudioSourceVolume (float to, float duration) : Tween<float>;
version 1.6.4
Instantiates a Tween easing the field of view of a Camera.
<GameObject, Component>.TweenCameraFieldOfView (float to, float duration) : Tween<float>;
version 1.6.4
Instantiates a Tween easing the orthographic size of a Camera.
<GameObject, Component>.TweenCameraOrthographicSize (float to, float duration) : Tween<float>;
version 1.6.6
Instantiates a Tween easing the color of a Light.
<GameObject, Component>.TweenLightColor (Color to, float duration) : Tween<Color>;
version 1.9.3
Instantiates a Tween easing the intensity of a Light.
<GameObject, Component>.TweenLightIntensity (float to, float duration) : Tween<float>;
version 1.11.0
Instantiates a Tween easing the range of a Light.
<GameObject, Component>.TweenLightRange (float to, float duration) : Tween<float>;
version 1.11.0
Instantiates a Tween easing the spot angle of a Light.
<GameObject, Component>.TweenLightSpotAngle (float to, float duration) : Tween<float>;
version 1.6.7
requires com.unity.render-pipelines.core
Instantiates a Tween animating the weight of a post-processing volume.
<GameObject, Component>.TweenVolumeWeight (float to, float duration) : Tween<float>;
version 1.0.3
Instantiates a Tween animating the a float value.
<GameObject, Component>.TweenValueFloat (float to, float duration, Action<float> onUpdate) : Tween<float>;
version 1.6.5
Instantiates a Tween animating the a Vector2 value.
<GameObject, Component>.TweenValueVector2 (Vector2 to, float duration, Action<Vector2> onUpdate) : Tween<Vector2>;
version 1.6.5
Instantiates a Tween animating the a Vector3 value.
<GameObject, Component>.TweenValueVector3 (Vector3 to, float duration, Action<Vector3> onUpdate) : Tween<Vector3>;
version 1.2.0
Instantiates a Tween animating the a color value.
<GameObject, Component>.TweenValueColor (Color to, float duration, Action<Color> onUpdate) : Tween<Color>;
version 1.0.0
Cancels all the running tweens.
<GameObject, Component>.TweenCancelAll (bool includeChildren = false, bool includeInactive = false) : Tween<T>;
version 1.0.0
Sets the From value of a tween, when not set the current value will be used.
<Tween<T>>.SetFrom (T valueFrom) : Tween<T>;
version 1.1.0
Sets the event which will be invoked when the tween completes playing. This will not be invoked when the tween is canceled.
<Tween<T>>.SetOnComplete (Action onComplete) : Tween<T>;
version 1.3.0
Sets the event which will be invoked when the tween is canceled.
<Tween<T>>.SetOnCancel (Action onCancel) : Tween<T>;
version 1.6.0
Enabled ping pong playback, this will bounce the animation back and forth. The tween has play forward and backwards to count as one cycle. Use either SetLoopCount or SetInifinite to set the number of times the animation should ping pong.
<Tween<T>>.SetPingPong () : Tween<T>;
version 1.2.0
Sets the number of times the animation should loop.
<Tween<T>>.SetLoopCount (int loopCount) : Tween<T>;
version 1.5.0
Sets this tween to infinite, the loopcount will be ignored.
<Tween<T>>.SetInfinite () : Tween<T>;
version 1.3.0
Sets the delay of this tween. The tween will not play anything until the requested delay time is reached. You can change this behaviour by enabeling 'goToFirstFrameImmediately' to set the animation to the first frame immediately.
<Tween<T>>.SetDelay (float delay, bool goToFirstFrameImmediately = false) : Tween<T>;
version 1.1.0
Sets the time of the tween.
<Tween<T>>.SetTime (float time) : Tween<T>;
version 1.3.0
Sets the time of the tween to a random value.
<Tween<T>>.SetRandomTime () : Tween<T>;
version 1.4.0
Sets whether the playback and delay should be paused.
<Tween<T>>.SetPaused (bool isPaused) : Tween<T>;
version 1.6.1
Sets whether the tween should use the unscaled delta time instead of the scaled delta time.
<Tween<T>>.SetUseUnscaledTime (bool useUnscaledTime) : Tween<T>;
version 1.5.0
Sets the overshooting of Eases that exceed their boundaries such as elastic and back.
<Tween<T>>.SetOvershooting (float overshooting) : Tween<T>;
version 1.5.0
Sets the ease for this tween.
<Tween<T>>.SetEase (EaseType ease) : Tween<T>;
version 1.0.0
Sets the ease for this tween to Linear.
<Tween<T>>.SetEaseLinear () : Tween<T>;
version 1.0.0
Sets the ease for this tween to SineIn.
<Tween<T>>.SetEaseSineIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to SineOut.
<Tween<T>>.SetEaseSineOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to SineInOut.
<Tween<T>>.SetEaseSineInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuadIn.
<Tween<T>>.SetEaseQuadIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuadOut.
<Tween<T>>.SetEaseQuadOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuadInOut.
<Tween<T>>.SetEaseQuadInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CubicIn.
<Tween<T>>.SetEaseCubicIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CubicOut.
<Tween<T>>.SetEaseCubicOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CubicInOut.
<Tween<T>>.SetEaseCubicInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuartIn.
<Tween<T>>.SetEaseQuartIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuartOut.
<Tween<T>>.SetEaseQuartOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuartInOut.
<Tween<T>>.SetEaseQuartInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuintIn.
<Tween<T>>.SetEaseQuintIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuintOut.
<Tween<T>>.SetEaseQuintOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to QuintInOut.
<Tween<T>>.SetEaseQuintInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ExpoIn.
<Tween<T>>.SetEaseExpoIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ExpoOut.
<Tween<T>>.SetEaseExpoOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ExpoInOut.
<Tween<T>>.SetEaseExpoInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CircIn.
<Tween<T>>.SetEaseCircIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CircOut.
<Tween<T>>.SetEaseCircOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to CircInOut.
<Tween<T>>.SetEaseCircInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BackIn.
<Tween<T>>.SetEaseBackIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BackOut.
<Tween<T>>.SetEaseBackOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BackInOut.
<Tween<T>>.SetEaseBackInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ElasticIn.
<Tween<T>>.SetEaseElasticIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ElasticOut.
<Tween<T>>.SetEaseElasticOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to ElasticInOut.
<Tween<T>>.SetEaseElasticInOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BounceIn.
<Tween<T>>.SetEaseBounceIn () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BounceOut.
<Tween<T>>.SetEaseBounceOut () : Tween<T>;
version 1.0.0
Sets the ease for this tween to BounceInOut.
<Tween<T>>.SetEaseBounceInOut () : Tween<T>;
version 1.0.0
Cancel the tween.
<Tween<T>>.Cancel () : void;
version 1.9.1
Returns a Task allowing the Tween to be awaited using an Async Await block until the Tween is either completed, destroyed, canceld or was unable to start. Make sure to cancel your Async method to prevent errors from being throwing in the Unity Editor when leaving Play mode while using Tasks to chain a sequence of Tweens.
<Tween<T>>.Await () : Task;
version 1.9.1
Returns a IEnumerator allowing the Tween to be yielded using a coroutine until the Tween is either completed, destroyed, canceld or was unable to start.
<Tween<T>>.Yield () : IEnumerator;
version 1.6.2
Gets the total duration of the tween including the loop count and ping pong settings, and the delay optionally.
<Tween<T>>.GetTotalDuration (bool includeDelay = false) : float;