GraphicsAPI reference
Class Animator
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics
Plays named clips; switching to the clip already playing does not restart it.
public sealed class AnimatorInheritance
Constructors
Animator()
public Animator()Properties
Current
The clip playing, or null before the first clip is added.
public AnimationClip? Current { get; }Property Value
CurrentName
Name of the clip playing, or null before the first clip is added.
public string? CurrentName { get; }Property Value
Finished
Whether a non-looping clip has reached its end. Always false for looping clips.
public bool Finished { get; }Property Value
Frame
The frame to draw now.
public Sprite Frame { get; }Property Value
Exceptions
No clip was added.
Speed
Playback speed multiplier: 1 by default, 0 pauses, 2 plays twice as fast.
public float Speed { get; set; }Property Value
Exceptions
Set to a negative value or NaN (clips do not play backwards).
Time
Seconds played in the current clip, scaled by Speed; reset to 0 when another clip starts.
public float Time { get; }Property Value
Methods
Add(string, AnimationClip)
Registers clip under name (replacing a clip with that name). The first clip added starts playing.
public Animator Add(string name, AnimationClip clip)Parameters
name string
clip AnimationClip
Returns
This animator, for chaining.
Exceptions
clip is null.
Play(string, bool)
Switches to the clip name from its first frame. Playing the current clip again does nothing unless restart is true.
public void Play(string name, bool restart = false)Parameters
name string
restart bool
Exceptions
No clip has that name.
Update(float)
Advances the current clip by dt seconds times Speed.
public void Update(float dt)Parameters
dt float