GraphicsAPI reference
Class AnimationClip
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics
An immutable sequence of sprites played at a fixed rate, or with a duration per frame (Aseprite timing).
public sealed class AnimationClipInheritance
Constructors
AnimationClip(IEnumerable<Sprite>, IEnumerable<float>, bool)
Creates a clip whose frames each show for their own time, in seconds; frames and durations are copied.
public AnimationClip(IEnumerable<Sprite> frames, IEnumerable<float> frameDurations, bool loop = true)Parameters
frames IEnumerable<Sprite>
The frames in playing order.
frameDurations IEnumerable<float>
One positive duration per frame, in seconds.
loop bool
Whether the clip repeats.
Exceptions
No frames, or not one duration per frame.
A duration is not positive.
AnimationClip(IEnumerable<Sprite>, float, bool)
Creates a clip; the frames are copied.
public AnimationClip(IEnumerable<Sprite> frames, float framesPerSecond, bool loop = true)Parameters
frames IEnumerable<Sprite>
The frames, for example from Frames.
framesPerSecond float
Playback rate; must be positive.
loop bool
Whether the clip repeats.
Exceptions
frames is empty.
framesPerSecond is not positive.
Properties
Duration
Length of one pass through the frames, in seconds.
public float Duration { get; }Property Value
FrameDurations
How long each frame shows, in seconds (all equal for a clip with a fixed rate).
public IReadOnlyList<float> FrameDurations { get; }Property Value
Frames
The frames in playing order (at least one).
public IReadOnlyList<Sprite> Frames { get; }Property Value
FramesPerSecond
Playback rate in frames per second; for a clip with a duration per frame, its average rate.
public float FramesPerSecond { get; }Property Value
Loop
Whether the clip starts over after its last frame; otherwise it holds the last frame.
public bool Loop { get; }Property Value
Methods
FrameAt(float)
The frame shown time seconds after the clip started (0 or more).
public Sprite FrameAt(float time)Parameters
time float