Class UIAnimation
Describes the set of effects of an animation, its parameters and the set of available functions to manage its lifecycle.
Properties
isPaused
true
if the animation paused, false
when playing or resumed.
isStarted
true
if the animation started, it becomes false
on animation end.
passedLoopsCount
Number of loops completed.
target
GameObject which is the target of the animation.
uuid
Unique identifier assigned to the animation on creation.
Constructors
UIAnimation(GameObject)
Instantiate a new UIAnimation, initialize it with default parameters and defines its target.
Parameters
target (GameObject) | The GameObject on which animation will be applied. |
Examples
Create new UIAnimation.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private void Start()
{
UIAnimation animation = new UIAnimation(target);
}
}
Fields
effectOnChildren
Field Value
Bool | If |
fade
Field Value
Bool | If |
fadeDelay
Field Value
Float | Time before the fade animation starts (in seconds). |
fadeDuration
Field Value
Float | Duration of a single fade animation loop (in seconds). |
fadeEasingFunction
Field Value
Tweenslator.EasingFunction | Used to specify the rate of change in transparency over time. See also Tweenslator.EasingFunction. |
fadeFrom
Field Value
Float | Alpha to use as starting value. |
fadeTo
Field Value
Float | Alpha to use as ending value. |
fadeValues
Field Value
ValuesOrigin | Values origin used for the fade effect. |
isLoop
Field Value
Bool | If |
label
Field Value
String | Name of the animation. |
lockInitialValues
Field Value
Bool | If |
loopsCount
Field Value
Int | Number of loops to play. Default value is -1 which is equivalent to infinite loops. |
loopStyle
Field Value
Tweenslator.LoopStyle | Defines the type of loop. |
move
Field Value
Bool | If |
moveDelay
Field Value
Float | Time before the move animation starts (in seconds). |
moveDuration
Field Value
Float | Duration of a single move animation loop (in seconds). |
moveEasingFunction
Field Value
Tweenslator.EasingFunction | Used to specify the rate of change in position over time. See also Tweenslator.EasingFunction. |
moveFromPosition
Field Value
EdgeOrCorner | Edge or corner starting position. |
moveFromVector
Field Value
Vector3 | Vector3 to use as starting anchoredPosition3D. |
moveToPosition
Field Value
EdgeOrCorner | Edge or corner ending position. |
moveToVector
Field Value
Vector3 | Vector3 to use as ending anchoredPosition3D. |
moveValues
Field Value
ValuesOrigin | Values origin used for the move effect. |
onAnimationEnd
Field Value
UnityEvent | UnityEvent raised on animation end. |
onAnimationLoop
Field Value
UnityEvent<Int> | UnityEvent raised on animation loop. |
onAnimationStart
Field Value
UnityEvent | UnityEvent raised on animation start. |
playOnGameStart
Field Value
Bool | If |
positionMode
Field Value
PositionMode | If value is 0 the move animation uses Vector3 position values. If value is 1 this will use Edge or corner |
rotate
Field Value
Bool | If |
rotateDelay
Field Value
Float | Time before the rotate animation starts (in seconds). |
rotateDuration
Field Value
Float | Duration of a single rotate animation loop (in seconds). |
rotateEasingFunction
Field Value
Tweenslator.EasingFunction | Used to specify the rate of change in rotation over time. See also Tweenslator.EasingFunction. |
rotateFrom
Field Value
Float | Angle to use as starting value. |
rotateTo
Field Value
Float | Angle to use as ending value. |
rotateValues
Field Value
ValuesOrigin | Values origin used for the rotate effect. |
rotationAxis
Field Value
Tweenslator.Axis | Axis to rotate around. |
scale
Field Value
Bool | If |
scaleDelay
Field Value
Float | Time before a single scale animation starts (in seconds). |
scaleDuration
Field Value
Float | Duration of the scale animation loop (in seconds). |
scaleEasingFunction
Field Value
Tweenslator.EasingFunction | Used to specify the rate of change in scale over time. See also Tweenslator.EasingFunction. |
scaleFrom
Field Value
Vector3 | Vector3 to use as starting localScale. |
scaleTo
Field Value
Vector3 | Vector3 to use as ending localScale. |
scaleValues
Field Value
ValuesOrigin | Values origin used for the scale effect. |
Methods
Cancel()
Cancels the animation.
Examples
Press space to cancel.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Cancel();
}
}
}
Complete(Bool)
Completes the animation.
Parameters
callbackOnComplete (Bool) | (Optional) If |
Examples
Press space to complete.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Complete();
}
}
}
Pause()
Pause the animation.
Examples
Press space to pause.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Pause();
}
}
}
Play()
Plays the animation.
Examples
Press space to play.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Play();
}
}
}
Resume()
Resumes the animation.
Examples
Press space to resume.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Resume();
}
}
}
Stop(Bool)
Stops the animation.
Parameters
callbackOnComplete (Bool) |
Examples
Press space to stop.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Stop();
}
}
}
Undo()
Undo the animation modifications.
Examples
Press space to undo.
using UnityEngine;
using Str8lines.Tweening.UI;
public class MyClass : MonoBehaviour
{
public GameObject target;
private UIAnimation animation;
private void Start()
{
animation = new UIAnimation(target);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
animation.Undo();
}
}
}