Class Animation
Base class for all animations.
Inherited Members
Namespace: Ritchie.Toolbox.Animation
Assembly: Ritchie.Toolbox.dll
Syntax
public abstract class Animation : IAnimation, IAnimationHandle
Constructors
Animation(CurveFunction, float)
Creates a new instance of the Animation class.
Declaration
protected Animation(CurveFunction curve, float duration)
Parameters
Type | Name | Description |
---|---|---|
CurveFunction | curve | The curve function to use for the animation. |
float | duration | The duration, in seconds, of the animation. |
Properties
IsActive
Gets a value indicating whhether the animation is active.
Declaration
public bool IsActive { get; }
Property Value
Type | Description |
---|---|
bool |
IsCancelled
Gets a value indicating whether an animation has been cancelled.
Declaration
public bool IsCancelled { get; }
Property Value
Type | Description |
---|---|
bool |
IsCompleted
Gets a value indicating whether an animation has completed.
Declaration
public bool IsCompleted { get; }
Property Value
Type | Description |
---|---|
bool |
NextAnimations
Gets a collection of animations that will be started after this one finishes.
Declaration
public IEnumerable<IAnimation> NextAnimations { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IAnimation> |
Methods
Cancel()
Cancel the animation.
Declaration
public void Cancel()
OnUpdate(float)
Method that's called each time the animation is updated.
Declaration
protected abstract void OnUpdate(float transitionPercentage)
Parameters
Type | Name | Description |
---|---|---|
float | transitionPercentage | A value between 0.0 and 1.0 representing the animation's progress. |
Start()
Declaration
public IAnimationHandle Start()
Returns
Type | Description |
---|---|
IAnimationHandle |
Then(IAnimation)
Adds the specified animation to the list of animations to start after this one has completed.
Declaration
public IAnimationHandle Then(IAnimation nextAnimation)
Parameters
Type | Name | Description |
---|---|---|
IAnimation | nextAnimation | Any animation. |
Returns
Type | Description |
---|---|
IAnimationHandle | This animation. |
Update(float)
Update the animation with a new frame.
Declaration
public void Update(float time)
Parameters
Type | Name | Description |
---|---|---|
float | time |
WhileActive(IAnimationUpdateAction)
Adds an action to be executed each time the animation updates.
Declaration
public IAnimationHandle WhileActive(IAnimationUpdateAction updateAction)
Parameters
Type | Name | Description |
---|---|---|
IAnimationUpdateAction | updateAction | Any type implementing IAnimationUpdateAction. |
Returns
Type | Description |
---|---|
IAnimationHandle | The animation. |