![](https://raw.githubusercontent.com/elraccoone/unity-tweens/master/.github/WIKI/repository-open-graph-template.png)
An extremely light weight, extendable and customisable tweening engine made for script-based animations for user-interfaces and world-spaces objects optimised for all platforms.
≪ Installation · Documentation · License ≫
Hi! My name is Jeffrey Lanters, thanks for checking out my modules! I've been a Unity developer for years when in 2020 I decided to start sharing my modules by open-sourcing them. So feel free to look around. If you're using this module for production, please consider donating to support the project. When using any of the packages, please make sure to Star this repository and give credit to Jeffrey Lanters somewhere in your app or game. Also keep in mind it it prohibited to sublicense and/or sell copies of the Software in stores such as the Unity Asset Store! Thanks for your time.
≪
Made with
Installation
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.
"nl.elraccoone.tweens": "git+https://github.com/elraccoone/unity-tweens"
Documentation
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.
The documentation is seperated into two parts; the Tweening Methods and Chainable Options.
Examples
These are some of the endless possibilities using Tweens.
private void Start () {
myGameObject.TweenLocalRotationX (10, 1).SetFrom (-10).SetDelay (1).SetEaseQuadIn ();
myGameObject.TweenGraphicColor (Color.red, 10).SetPingPong ().SetLoop (10).SetEaseBackInOut ();
myGameObject.TweenValueFloat (0, 2, (value => { })).SetFrom (100).SetEaseSineOut ();
myGameObject.TweenCancelAll ();
}
Tweening Methods
version 1.0.0
TweenPosition Instantiates a Tween animating the Position.
<GameObject, Component>.TweenPosition (Vector3 to, float duration);
version 1.0.0
TweenPositionX Instantiates a Tween animating the X axis of the Position.
<GameObject, Component>.TweenPositionX (float to, float duration);
version 1.0.0
TweenPositionY Instantiates a Tween animating the Y axis of the Position.
<GameObject, Component>.TweenPositionY (float to, float duration);
version 1.0.0
TweenPositionZ Instantiates a Tween animating the Z axis of the Position.
<GameObject, Component>.TweenPositionZ (float to, float duration);
version 1.0.0
TweenLocalPosition Instantiates a Tween animating the LocalPosition.
<GameObject, Component>.TweenLocalPosition (Vector3 to, float duration);
version 1.0.0
TweenLocalPositionX Instantiates a Tween animating the X axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionX (float to, float duration);
version 1.0.0
TweenLocalPositionY Instantiates a Tween animating the Y axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionY (float to, float duration);
version 1.0.0
TweenLocalPositionZ Instantiates a Tween animating the Z axis of the LocalPosition.
<GameObject, Component>.TweenLocalPositionZ (float to, float duration);
version 1.0.2
TweenAnchoredPosition Instantiates a Tween animating the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPosition (Vector2 to, float duration);
version 1.0.2
TweenAnchoredPositionX Instantiates a Tween animating the X axis of the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPositionX (float to, float duration);
version 1.0.2
TweenAnchoredPositionY Instantiates a Tween animating the Y axis of the AnchoredPosition.
<GameObject, Component>.TweenAnchoredPositionY (float to, float duration);
version 1.0.0
TweenRotation Instantiates a Tween animating the Rotation.
<GameObject, Component>.TweenRotation (Vector3 to, float duration);
version 1.0.0
TweenRotationX Instantiates a Tween animating the X axis of the Rotation.
<GameObject, Component>.TweenRotationX (float to, float duration);
version 1.0.0
TweenRotationY Instantiates a Tween animating the Y axis of the Rotation.
<GameObject, Component>.TweenRotationY (float to, float duration);
version 1.0.0
TweenRotationZ Instantiates a Tween animating the Z axis of the Rotation.
<GameObject, Component>.TweenRotationZ (float to, float duration);
version 1.0.0
TweenLocalRotation Instantiates a Tween animating the LocalRotation.
<GameObject, Component>.TweenLocalRotation (Vector3 to, float duration);
version 1.0.0
TweenLocalRotationX Instantiates a Tween animating the X axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationX (float to, float duration);
version 1.0.0
TweenLocalRotationY Instantiates a Tween animating the Y axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationY (float to, float duration);
version 1.0.0
TweenLocalRotationZ Instantiates a Tween animating the Z axis of the LocalRotation.
<GameObject, Component>.TweenLocalRotationZ (float to, float duration);
version 1.0.0
TweenLocalScale Instantiates a Tween animating the LocalScale.
<GameObject, Component>.TweenLocalScale (Vector3 to, float duration);
version 1.0.0
TweenLocalScaleX Instantiates a Tween animating the X axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleX (float to, float duration);
version 1.0.0
TweenLocalScaleY Instantiates a Tween animating the Y axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleY (float to, float duration);
version 1.0.0
TweenLocalScaleZ Instantiates a Tween animating the Z axis of the LocalScale.
<GameObject, Component>.TweenLocalScaleZ (float to, float duration);
version 1.0.3
TweenImageFillAmount Instantiates a Tween animating the fillAmount of an image.
<GameObject, Component>.TweenImageFillAmount (float to, float duration);
version 1.0.4
TweenGraphicAlpha Instantiates a Tween animating the alpha of a graphic.
<GameObject, Component>.TweenGraphicAlpha (float to, float duration);
version 1.0.4
TweenGraphicColor Instantiates a Tween animating the color of a graphic.
<GameObject, Component>.TweenGraphicColor (Color to, float duration);
version 1.0.4
TweenSpriteRendererAlpha Instantiates a Tween animating the alpha of a SpriteRenderer.
<GameObject, Component>.TweenSpriteRendererAlpha (float to, float duration);
version 1.0.5
TweenSpriteRendererColor Instantiates a Tween animating the color of a SpriteRenderer.
<GameObject, Component>.TweenSpriteRendererColor (Color to, float duration);
version 1.0.9
TweenMaterialAlpha Instantiates a Tween animating the alpha of a Material.
<GameObject, Component>.TweenMaterialAlpha (float to, float duration);
version 1.0.9
TweenMaterialColor Instantiates a Tween animating the color of a Material.
<GameObject, Component>.TweenMaterialColor (Color to, float duration);
version 1.0.8
TweenTextMeshAlpha Instantiates a Tween animating the alpha of a TextMesh.
<GameObject, Component>.TweenTextMeshAlpha (float to, float duration);
version 1.0.10
TweenCanvasGroupAlpha Instantiates a Tween animating the alpha of a CanvasGroup.
<GameObject, Component>.TweenCanvasGroupAlpha (float to, float duration);
version 1.0.11
TweenAudioSourceVolume Instantiates a Tween easing the volume of an AudioSource.
<GameObject, Component>.TweenAudioSourceVolume (float to, float duration);
version 1.0.11
TweenAudioSourcePitch Instantiates a Tween easing the pitch of an AudioSource.
<GameObject, Component>.TweenAudioSourcePitch (float to, float duration);
version 1.0.3
TweenValueFloat Instantiates a Tween animating the a float value.
<GameObject, Component>.TweenValueFloat (float to, float duration, Action<float> onUpdate);
version 1.2.0
TweenValueColor Instantiates a Tween animating the a color value.
<GameObject, Component>.TweenValueColor (Color to, float duration, Action<Color> onUpdate);
version 1.0.0
TweenDelayedInvoke Instantiates a Tween which invokes a lambra method.
<GameObject, Component>.TweenDelayedInvoke(float duration, Action onComplete);
version 1.0.0
TweenCancelAll Cancels all the running tweens.
<GameObject, Component>.TweenCancelAll (bool includeChildren = false, bool includeInactive = false);
Chainable Options
version 1.0.0
Cancel Cancel the tween.
<Tween>.Cancel ();
version 1.0.0
SetFrom Sets the From value of a tween, when not set the current value will be used.
<Tween>.SetFrom (T valueFrom);
version 1.1.0
SetOnComplete Sets the event which will be invoked when the tween completes playing. This will not be invoked when the tween is canceled.
<Tween>.SetOnComplete (Action onComplete);
version 1.3.0
SetOnCancel Sets the event which will be invoked when the tween is canceled.
<Tween>.SetOnCancel (Action onCancel);
version 1.6.0
SetPingPong 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>.SetPingPong ();
version 1.2.0
SetLoopCount Sets the number of times the animation should loop.
<Tween>.SetLoopCount (int loopCount);
version 1.5.0
SetInfinite Sets this tween to infinite, the loopcount will be ignored.
<Tween>.SetInfinite ();
version 1.3.0
SetDelay 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>.SetDelay (float delay, bool goToFirstFrameImmediately = false);
version 1.1.0
SetTime Sets the time of the tween.
<Tween>.SetTime (int time);
version 1.3.0
SetRandomTime Sets the time of the tween to a random value.
<Tween>.SetRandomTime ();
version 1.4.0
SetPaused Sets wheter the playback and delay should be paused.
<Tween>.SetPaused (bool isPaused);
version 1.5.0
SetOvershooting Sets the overshooting of Eases that exceed their boundaries such as elastic and back.
<Tween>.SetOvershooting (float overshooting);
version 1.5.0
SetEase Sets the ease for this tween.
<Tween>.SetEase (Ease ease);
version 1.0.0
SetEaseLinear Sets the ease for this tween to Linear.
<Tween>.SetEaseLinear ();
version 1.0.0
SetEaseSineIn Sets the ease for this tween to SineIn.
<Tween>.SetEaseSineIn ();
version 1.0.0
SetEaseSineOut Sets the ease for this tween to SineOut.
<Tween>.SetEaseSineOut ();
version 1.0.0
SetEaseSineInOut Sets the ease for this tween to SineInOut.
<Tween>.SetEaseSineInOut ();
version 1.0.0
SetEaseQuadIn Sets the ease for this tween to QuadIn.
<Tween>.SetEaseQuadIn ();
version 1.0.0
SetEaseQuadOut Sets the ease for this tween to QuadOut.
<Tween>.SetEaseQuadOut ();
version 1.0.0
SetEaseQuadInOut Sets the ease for this tween to QuadInOut.
<Tween>.SetEaseQuadInOut ();
version 1.0.0
SetEaseCubicIn Sets the ease for this tween to CubicIn.
<Tween>.SetEaseCubicIn ();
version 1.0.0
SetEaseCubicOut Sets the ease for this tween to CubicOut.
<Tween>.SetEaseCubicOut ();
version 1.0.0
SetEaseCubicInOut Sets the ease for this tween to CubicInOut.
<Tween>.SetEaseCubicInOut ();
version 1.0.0
SetEaseQuartIn Sets the ease for this tween to QuartIn.
<Tween>.SetEaseQuartIn ();
version 1.0.0
SetEaseQuartOut Sets the ease for this tween to QuartOut.
<Tween>.SetEaseQuartOut ();
version 1.0.0
SetEaseQuartInOut Sets the ease for this tween to QuartInOut.
<Tween>.SetEaseQuartInOut ();
version 1.0.0
SetEaseQuintIn Sets the ease for this tween to QuintIn.
<Tween>.SetEaseQuintIn ();
version 1.0.0
SetEaseQuintOut Sets the ease for this tween to QuintOut.
<Tween>.SetEaseQuintOut ();
version 1.0.0
SetEaseQuintInOut Sets the ease for this tween to QuintInOut.
<Tween>.SetEaseQuintInOut ();
version 1.0.0
SetEaseExpoIn Sets the ease for this tween to ExpoIn.
<Tween>.SetEaseExpoIn ();
version 1.0.0
SetEaseExpoOut Sets the ease for this tween to ExpoOut.
<Tween>.SetEaseExpoOut ();
version 1.0.0
SetEaseExpoInOut Sets the ease for this tween to ExpoInOut.
<Tween>.SetEaseExpoInOut ();
version 1.0.0
SetEaseCircIn Sets the ease for this tween to CircIn.
<Tween>.SetEaseCircIn ();
version 1.0.0
SetEaseCircOut Sets the ease for this tween to CircOut.
<Tween>.SetEaseCircOut ();
version 1.0.0
SetEaseCircInOut Sets the ease for this tween to CircInOut.
<Tween>.SetEaseCircInOut ();
version 1.0.0
SetEaseBackIn Sets the ease for this tween to BackIn.
<Tween>.SetEaseBackIn ();
version 1.0.0
SetEaseBackOut Sets the ease for this tween to BackOut.
<Tween>.SetEaseBackOut ();
version 1.0.0
SetEaseBackInOut Sets the ease for this tween to BackInOut.
<Tween>.SetEaseBackInOut ();
version 1.0.0
SetEaseElasticIn Sets the ease for this tween to ElasticIn.
<Tween>.SetEaseElasticIn ();
version 1.0.0
SetEaseElasticOut Sets the ease for this tween to ElasticOut.
<Tween>.SetEaseElasticOut ();
version 1.0.0
SetEaseElasticInOut Sets the ease for this tween to ElasticInOut.
<Tween>.SetEaseElasticInOut ();
version 1.0.0
SetEaseBounceIn Sets the ease for this tween to BounceIn.
<Tween>.SetEaseBounceIn ();
version 1.0.0
SetEaseBounceOut Sets the ease for this tween to BounceOut.
<Tween>.SetEaseBounceOut ();
version 1.0.0
SetEaseBounceInOut Sets the ease for this tween to BounceInOut.
<Tween>.SetEaseBounceInOut ();