# Sandbox.SpriteInstance

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.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Modifiers: sealed

## Constructors

- [`SpriteInstance`](/api/Sandbox.SpriteInstance/.ctor): Creates independent playback starting at the sprite's first animation.

## Properties

- [`Animation`](/api/Sandbox.SpriteInstance/Animation): The selected animation, or null when none is available.
- [`CurrentFrameIndex`](/api/Sandbox.SpriteInstance/CurrentFrameIndex): The current frame index. Setting it clears elapsed frame time and completion state. An out-of-range index has no frame to draw.
- [`Frame`](/api/Sandbox.SpriteInstance/Frame): The current frame, or null when no valid frame is selected.
- [`IsFinished`](/api/Sandbox.SpriteInstance/IsFinished): True after a non-looping animation has finished. Cleared by switching, restarting or seeking.
- [`Paused`](/api/Sandbox.SpriteInstance/Paused): Pauses advancement without discarding elapsed frame time.
- [`PlaybackSpeed`](/api/Sandbox.SpriteInstance/PlaybackSpeed): Playback multiplier. Zero stops advancement; negative values play backwards.
- [`Sprite`](/api/Sandbox.SpriteInstance/Sprite): The sprite to play. Changing it selects its first animation and resets playback. A null sprite has no frame to draw.
- [`Texture`](/api/Sandbox.SpriteInstance/Texture): The current frame's texture, or null when no texture is available.

## Methods

- [`Play`](/api/Sandbox.SpriteInstance/Play): 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.
- [`Update`](/api/Sandbox.SpriteInstance/Update): 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.
