Skip to content

Class SpriteAnimator

Definition

Namespace: StardewUI.Animation
Assembly: StardewUI.dll

Animates the sprite of an Image, using equal duration for all frames in a list.

public class SpriteAnimator

Inheritance
Object ⇦ SpriteAnimator

Members

Constructors

Name Description
SpriteAnimator(Image) Initializes a new instance of SpriteAnimator that animates the sprite on a specified image.

Properties

Name Description
FrameDuration Duration of each frame.
Frames Frames to animate through.
Paused Whether or not to pause animation. If true, the animator will hold at the current position and not progress until set to false again.
StartDelay Delay before advancing from the first frame to the next frames.

Methods

Name Description
Reset() Resets the animation to the first frame, and waits any StartDelay required again.
Tick(TimeSpan) Advances the animation.

Details

Constructors

SpriteAnimator(Image)

Initializes a new instance of SpriteAnimator that animates the sprite on a specified image.

public SpriteAnimator(StardewUI.Widgets.Image image);
Parameters

image   Image
The image to animate.


Properties

FrameDuration

Duration of each frame.

public System.TimeSpan FrameDuration { get; set; }
Property Value

TimeSpan


Frames

Frames to animate through.

public System.Collections.Generic.IReadOnlyList<StardewUI.Graphics.Sprite> Frames { get; set; }
Property Value

IReadOnlyList<Sprite>


Paused

Whether or not to pause animation. If true, the animator will hold at the current position and not progress until set to false again.

public bool Paused { get; set; }
Property Value

Boolean


StartDelay

Delay before advancing from the first frame to the next frames.

public System.TimeSpan StartDelay { get; set; }
Property Value

TimeSpan

Remarks

Repeats on every loop, but only applies to the first frame of each loop.


Methods

Reset()

Resets the animation to the first frame, and waits any StartDelay required again.

public void Reset();

Tick(TimeSpan)

Advances the animation.

public void Tick(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
The time elapsed since the previous tick.