Class ModularAnimator
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
General-purpose animator that plays a list of tweens with optional loop policies and events.
public class ModularAnimator : MonoBehaviour, ITweenAnimator
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourModularAnimator
- Implements
Fields
OnForwardCompleted
Event that is invoked in the PingPong mode when all tweens have finished playing in the forward direction.
public UnityEvent OnForwardCompleted
Field Value
- UnityEvent
OnTweenCompleted
Event that is triggered when all tweens have completed their animation.
public UnityEvent OnTweenCompleted
Field Value
- UnityEvent
Properties
IsTweened
Returns true if all tweens in the Fallencake.UI.ModularAnimator._tweens list are currently tweening.
public bool IsTweened { get; }
Property Value
- bool
LoopCount
Number of times to repeat the animation sequence when Fallencake.UI.ModularAnimator._loopType is not None. For Simple a single cycle is one forward play. For PingPong a single cycle is a complete forward-and-backward play.
public int LoopCount { get; set; }
Property Value
- int
Tweens
The list of tweens animated by this animator.
public List<ITween> Tweens { get; set; }
Property Value
- List<ITween>
Methods
Init(List<ITween>, LoopType, bool)
Overload that assumes infinite loop count when applicable.
public void Init(List<ITween> tweens, LoopType loopType = LoopType.None, bool isPlayOnEnable = false)
Parameters
Init(List<ITween>, LoopType, int, bool)
Initializes the animator with the specified tweens, loop type, and play on enable flag.
public void Init(List<ITween> tweens, LoopType loopType = LoopType.None, int loopCount = -1, bool isPlayOnEnable = false)
Parameters
tweensList<ITween>The list of tweens to animate.
loopTypeLoopTypeThe type of loop to use for the tweens.
loopCountintisPlayOnEnableboolWhether to automatically play the tweens when the object is enabled.
OnDisable()
public void OnDisable()
OnEnable()
public void OnEnable()
Play()
Convenience overload without completion callback.
public void Play()
Play(Action)
Plays all tweens and handles loop bookkeeping.
public void Play(Action onComplete)
Parameters
onCompleteAction
Stop()
Stops and resets tweens by default.
public void Stop()
Stop(bool)
Stops all coroutines and resets tweens optionally.
public void Stop(bool isReset = true)
Parameters
isResetbool