SpriteInstanceclass
A sprite resource with independent animation playback. Call Update once per update, then draw the current frame as many times as needed with Painter.Sprite.
Constructors1
Showing 1 constructors
public SpriteInstance(Sandbox.Sprite sprite)
Creates independent playback starting at the sprite's first animation.
| Parameter | Type | Description |
|---|---|---|
| sprite | Sprite | — |
No results match this filter.
Methods2
Showing 2 methods
public void Play(string animation, bool restart = False)
Selects an animation by name and resumes playback. Playing the selected animation preserves its position unless restart is true. An unknown name leaves playback unchanged.
| Parameter | Type | Description |
|---|---|---|
| animation | string | — |
| restart = False | bool | — |
void—public void Update(float deltaTime)
Advances playback by elapsed seconds, respecting the animation's frame rate and loop points. Drawing does not call this method. Frame broadcast actions are not executed by this instance.
| Parameter | Type | Description |
|---|---|---|
| deltaTime | float | — |
void—No results match this filter.
Properties8
Showing 8 properties
public Sandbox.Sprite.Animation Sandbox.SpriteInstance.Animation { get; set; }
The selected animation, or null when none is available.
public int Sandbox.SpriteInstance.CurrentFrameIndex { get; set; }
The current frame index. Setting it clears elapsed frame time and completion state. An out-of-range index has no frame to draw.
int—public Sandbox.Sprite.Frame Sandbox.SpriteInstance.Frame { get; set; }
The current frame, or null when no valid frame is selected.
public bool Sandbox.SpriteInstance.IsFinished { get; set; }
True after a non-looping animation has finished. Cleared by switching, restarting or seeking.
bool—public bool Sandbox.SpriteInstance.Paused { get; set; }
Pauses advancement without discarding elapsed frame time.
bool—public float Sandbox.SpriteInstance.PlaybackSpeed { get; set; }
Playback multiplier. Zero stops advancement; negative values play backwards.
float—public Sandbox.Sprite Sandbox.SpriteInstance.Sprite { get; set; }
The sprite to play. Changing it selects its first animation and resets playback. A null sprite has no frame to draw.
public Sandbox.Texture Sandbox.SpriteInstance.Texture { get; set; }
The current frame's texture, or null when no texture is available.
No results match this filter.