jdselig / unity-tweens

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


npm npm npm

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



npm

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 by Jeffrey Lanters


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

TweenPosition version 1.0.0

Instantiates a Tween animating the Position.

<GameObject, Component>.TweenPosition (Vector3 to, float duration);

TweenPositionX version 1.0.0

Instantiates a Tween animating the X axis of the Position.

<GameObject, Component>.TweenPositionX (float to, float duration);

TweenPositionY version 1.0.0

Instantiates a Tween animating the Y axis of the Position.

<GameObject, Component>.TweenPositionY (float to, float duration);

TweenPositionZ version 1.0.0

Instantiates a Tween animating the Z axis of the Position.

<GameObject, Component>.TweenPositionZ (float to, float duration);

TweenLocalPosition version 1.0.0

Instantiates a Tween animating the LocalPosition.

<GameObject, Component>.TweenLocalPosition (Vector3 to, float duration);

TweenLocalPositionX version 1.0.0

Instantiates a Tween animating the X axis of the LocalPosition.

<GameObject, Component>.TweenLocalPositionX (float to, float duration);

TweenLocalPositionY version 1.0.0

Instantiates a Tween animating the Y axis of the LocalPosition.

<GameObject, Component>.TweenLocalPositionY (float to, float duration);

TweenLocalPositionZ version 1.0.0

Instantiates a Tween animating the Z axis of the LocalPosition.

<GameObject, Component>.TweenLocalPositionZ (float to, float duration);

TweenAnchoredPosition version 1.0.2

Instantiates a Tween animating the AnchoredPosition.

<GameObject, Component>.TweenAnchoredPosition (Vector2 to, float duration);

TweenAnchoredPositionX version 1.0.2

Instantiates a Tween animating the X axis of the AnchoredPosition.

<GameObject, Component>.TweenAnchoredPositionX (float to, float duration);

TweenAnchoredPositionY version 1.0.2

Instantiates a Tween animating the Y axis of the AnchoredPosition.

<GameObject, Component>.TweenAnchoredPositionY (float to, float duration);

TweenRotation version 1.0.0

Instantiates a Tween animating the Rotation.

<GameObject, Component>.TweenRotation (Vector3 to, float duration);

TweenRotationX version 1.0.0

Instantiates a Tween animating the X axis of the Rotation.

<GameObject, Component>.TweenRotationX (float to, float duration);

TweenRotationY version 1.0.0

Instantiates a Tween animating the Y axis of the Rotation.

<GameObject, Component>.TweenRotationY (float to, float duration);

TweenRotationZ version 1.0.0

Instantiates a Tween animating the Z axis of the Rotation.

<GameObject, Component>.TweenRotationZ (float to, float duration);

TweenLocalRotation version 1.0.0

Instantiates a Tween animating the LocalRotation.

<GameObject, Component>.TweenLocalRotation (Vector3 to, float duration);

TweenLocalRotationX version 1.0.0

Instantiates a Tween animating the X axis of the LocalRotation.

<GameObject, Component>.TweenLocalRotationX (float to, float duration);

TweenLocalRotationY version 1.0.0

Instantiates a Tween animating the Y axis of the LocalRotation.

<GameObject, Component>.TweenLocalRotationY (float to, float duration);

TweenLocalRotationZ version 1.0.0

Instantiates a Tween animating the Z axis of the LocalRotation.

<GameObject, Component>.TweenLocalRotationZ (float to, float duration);

TweenLocalScale version 1.0.0

Instantiates a Tween animating the LocalScale.

<GameObject, Component>.TweenLocalScale (Vector3 to, float duration);

TweenLocalScaleX version 1.0.0

Instantiates a Tween animating the X axis of the LocalScale.

<GameObject, Component>.TweenLocalScaleX (float to, float duration);

TweenLocalScaleY version 1.0.0

Instantiates a Tween animating the Y axis of the LocalScale.

<GameObject, Component>.TweenLocalScaleY (float to, float duration);

TweenLocalScaleZ version 1.0.0

Instantiates a Tween animating the Z axis of the LocalScale.

<GameObject, Component>.TweenLocalScaleZ (float to, float duration);

TweenImageFillAmount version 1.0.3

Instantiates a Tween animating the fillAmount of an image.

<GameObject, Component>.TweenImageFillAmount (float to, float duration);

TweenGraphicAlpha version 1.0.4

Instantiates a Tween animating the alpha of a graphic.

<GameObject, Component>.TweenGraphicAlpha (float to, float duration);

TweenGraphicColor version 1.0.4

Instantiates a Tween animating the color of a graphic.

<GameObject, Component>.TweenGraphicColor (Color to, float duration);

TweenSpriteRendererAlpha version 1.0.4

Instantiates a Tween animating the alpha of a SpriteRenderer.

<GameObject, Component>.TweenSpriteRendererAlpha (float to, float duration);

TweenSpriteRendererColor version 1.0.5

Instantiates a Tween animating the color of a SpriteRenderer.

<GameObject, Component>.TweenSpriteRendererColor (Color to, float duration);

TweenMaterialAlpha version 1.0.9

Instantiates a Tween animating the alpha of a Material.

<GameObject, Component>.TweenMaterialAlpha (float to, float duration);

TweenMaterialColor version 1.0.9

Instantiates a Tween animating the color of a Material.

<GameObject, Component>.TweenMaterialColor (Color to, float duration);

TweenTextMeshAlpha version 1.0.8

Instantiates a Tween animating the alpha of a TextMesh.

<GameObject, Component>.TweenTextMeshAlpha (float to, float duration);

TweenCanvasGroupAlpha version 1.0.10

Instantiates a Tween animating the alpha of a CanvasGroup.

<GameObject, Component>.TweenCanvasGroupAlpha (float to, float duration);

TweenAudioSourceVolume version 1.0.11

Instantiates a Tween easing the volume of an AudioSource.

<GameObject, Component>.TweenAudioSourceVolume (float to, float duration);

TweenAudioSourcePitch version 1.0.11

Instantiates a Tween easing the pitch of an AudioSource.

<GameObject, Component>.TweenAudioSourcePitch (float to, float duration);

TweenValueFloat version 1.0.3

Instantiates a Tween animating the a float value.

<GameObject, Component>.TweenValueFloat (float to, float duration, Action<float> onUpdate);

TweenValueColor version 1.2.0

Instantiates a Tween animating the a color value.

<GameObject, Component>.TweenValueColor (Color to, float duration, Action<Color> onUpdate);

TweenDelayedInvoke version 1.0.0

Instantiates a Tween which invokes a lambra method.

<GameObject, Component>.TweenDelayedInvoke(float duration, Action onComplete);

TweenCancelAll version 1.0.0

Cancels all the running tweens.

<GameObject, Component>.TweenCancelAll (bool includeChildren = false, bool includeInactive = false);

Chainable Options

Cancel version 1.0.0

Cancel the tween.

<Tween>.Cancel ();

SetFrom version 1.0.0

Sets the From value of a tween, when not set the current value will be used.

<Tween>.SetFrom (T valueFrom);

SetOnComplete 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>.SetOnComplete (Action onComplete);

SetOnCancel version 1.3.0

Sets the event which will be invoked when the tween is canceled.

<Tween>.SetOnCancel (Action onCancel);

SetPingPong 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>.SetPingPong ();

SetLoopCount version 1.2.0

Sets the number of times the animation should loop.

<Tween>.SetLoopCount (int loopCount);

SetInfinite version 1.5.0

Sets this tween to infinite, the loopcount will be ignored.

<Tween>.SetInfinite ();

SetDelay 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>.SetDelay (float delay, bool goToFirstFrameImmediately = false);

SetTime version 1.1.0

Sets the time of the tween.

<Tween>.SetTime (int time);

SetRandomTime version 1.3.0

Sets the time of the tween to a random value.

<Tween>.SetRandomTime ();

SetPaused version 1.4.0

Sets wheter the playback and delay should be paused.

<Tween>.SetPaused (bool isPaused);

SetOvershooting version 1.5.0

Sets the overshooting of Eases that exceed their boundaries such as elastic and back.

<Tween>.SetOvershooting (float overshooting);

SetEase version 1.5.0

Sets the ease for this tween.

<Tween>.SetEase (Ease ease);

SetEaseLinear version 1.0.0

Sets the ease for this tween to Linear.

<Tween>.SetEaseLinear ();

SetEaseSineIn version 1.0.0

Sets the ease for this tween to SineIn.

<Tween>.SetEaseSineIn ();

SetEaseSineOut version 1.0.0

Sets the ease for this tween to SineOut.

<Tween>.SetEaseSineOut ();

SetEaseSineInOut version 1.0.0

Sets the ease for this tween to SineInOut.

<Tween>.SetEaseSineInOut ();

SetEaseQuadIn version 1.0.0

Sets the ease for this tween to QuadIn.

<Tween>.SetEaseQuadIn ();

SetEaseQuadOut version 1.0.0

Sets the ease for this tween to QuadOut.

<Tween>.SetEaseQuadOut ();

SetEaseQuadInOut version 1.0.0

Sets the ease for this tween to QuadInOut.

<Tween>.SetEaseQuadInOut ();

SetEaseCubicIn version 1.0.0

Sets the ease for this tween to CubicIn.

<Tween>.SetEaseCubicIn ();

SetEaseCubicOut version 1.0.0

Sets the ease for this tween to CubicOut.

<Tween>.SetEaseCubicOut ();

SetEaseCubicInOut version 1.0.0

Sets the ease for this tween to CubicInOut.

<Tween>.SetEaseCubicInOut ();

SetEaseQuartIn version 1.0.0

Sets the ease for this tween to QuartIn.

<Tween>.SetEaseQuartIn ();

SetEaseQuartOut version 1.0.0

Sets the ease for this tween to QuartOut.

<Tween>.SetEaseQuartOut ();

SetEaseQuartInOut version 1.0.0

Sets the ease for this tween to QuartInOut.

<Tween>.SetEaseQuartInOut ();

SetEaseQuintIn version 1.0.0

Sets the ease for this tween to QuintIn.

<Tween>.SetEaseQuintIn ();

SetEaseQuintOut version 1.0.0

Sets the ease for this tween to QuintOut.

<Tween>.SetEaseQuintOut ();

SetEaseQuintInOut version 1.0.0

Sets the ease for this tween to QuintInOut.

<Tween>.SetEaseQuintInOut ();

SetEaseExpoIn version 1.0.0

Sets the ease for this tween to ExpoIn.

<Tween>.SetEaseExpoIn ();

SetEaseExpoOut version 1.0.0

Sets the ease for this tween to ExpoOut.

<Tween>.SetEaseExpoOut ();

SetEaseExpoInOut version 1.0.0

Sets the ease for this tween to ExpoInOut.

<Tween>.SetEaseExpoInOut ();

SetEaseCircIn version 1.0.0

Sets the ease for this tween to CircIn.

<Tween>.SetEaseCircIn ();

SetEaseCircOut version 1.0.0

Sets the ease for this tween to CircOut.

<Tween>.SetEaseCircOut ();

SetEaseCircInOut version 1.0.0

Sets the ease for this tween to CircInOut.

<Tween>.SetEaseCircInOut ();

SetEaseBackIn version 1.0.0

Sets the ease for this tween to BackIn.

<Tween>.SetEaseBackIn ();

SetEaseBackOut version 1.0.0

Sets the ease for this tween to BackOut.

<Tween>.SetEaseBackOut ();

SetEaseBackInOut version 1.0.0

Sets the ease for this tween to BackInOut.

<Tween>.SetEaseBackInOut ();

SetEaseElasticIn version 1.0.0

Sets the ease for this tween to ElasticIn.

<Tween>.SetEaseElasticIn ();

SetEaseElasticOut version 1.0.0

Sets the ease for this tween to ElasticOut.

<Tween>.SetEaseElasticOut ();

SetEaseElasticInOut version 1.0.0

Sets the ease for this tween to ElasticInOut.

<Tween>.SetEaseElasticInOut ();

SetEaseBounceIn version 1.0.0

Sets the ease for this tween to BounceIn.

<Tween>.SetEaseBounceIn ();

SetEaseBounceOut version 1.0.0

Sets the ease for this tween to BounceOut.

<Tween>.SetEaseBounceOut ();

SetEaseBounceInOut version 1.0.0

Sets the ease for this tween to BounceInOut.

<Tween>.SetEaseBounceInOut ();

About

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.

License:MIT License


Languages

Language:C# 100.0%