Table of Contents

Class SpriteAnimationSystem

Namespace
Stride.Rendering.Sprites
Assembly
Stride.Engine.dll

A system in charge of animating the sprites

public class SpriteAnimationSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
Inheritance
SpriteAnimationSystem
Implements
Inherited Members
Extension Methods

Constructors

SpriteAnimationSystem(IServiceRegistry)

Creates a new instance of SpriteAnimationSystem and register it in the services.

public SpriteAnimationSystem(IServiceRegistry registry)

Parameters

registry IServiceRegistry

Properties

DefaultFramesPerSecond

Gets or sets the default sprite animation FPS (Default value = 30 FPS).

public float DefaultFramesPerSecond { get; set; }

Property Value

float

Methods

Draw(GameTime)

Draws this instance.

public override void Draw(GameTime gameTime)

Parameters

gameTime GameTime

The current timing.

Initialize()

This method is called when the component is added to the game.

public override void Initialize()

Remarks

This method can be used for tasks like querying for services the component needs and setting up non-graphics resources.

Pause(SpriteComponent)

Pauses the animation of the provided sprite component.

public void Pause(SpriteComponent spriteComponent)

Parameters

spriteComponent SpriteComponent

the sprite component to pause

Play(SpriteComponent, int, int, AnimationRepeatMode, float, bool)

Play the sprite animation starting at index startIndex and ending at endIndex.

public void Play(SpriteComponent spriteComponent, int startIndex, int endIndex, AnimationRepeatMode repeatMode, float framesPerSeconds = 0, bool clearQueuedAnimations = true)

Parameters

spriteComponent SpriteComponent

The sprite component containing the animation

startIndex int

The first index of the animation

endIndex int

The last index of the animation

repeatMode AnimationRepeatMode

The value indicating how to loop the animation

framesPerSeconds float

The animation speed in frames per second. 0 to use the sprite animation system default speed.

clearQueuedAnimations bool

Indicate if queued animation should be cleared

Play(SpriteComponent, int[], AnimationRepeatMode, float, bool)

Play the sprite animation defined by the provided sequence of indices.

public void Play(SpriteComponent spriteComponent, int[] indices, AnimationRepeatMode repeatMode, float framesPerSeconds = 0, bool clearQueuedAnimations = true)

Parameters

spriteComponent SpriteComponent

The sprite component containing the animation

indices int[]

The sequence of indices defining the sprite animation

repeatMode AnimationRepeatMode

The value indicating how to loop the animation

framesPerSeconds float

The animation speed in frames per second. 0 to use the sprite animation system default speed.

clearQueuedAnimations bool

Indicate if queued animation should be cleared

Queue(SpriteComponent, int, int, AnimationRepeatMode, float)

Queue the sprite animation starting at index startIndex and ending at endIndex at the end of the animation queue.

public void Queue(SpriteComponent spriteComponent, int startIndex, int endIndex, AnimationRepeatMode repeatMode, float framesPerSeconds = 0)

Parameters

spriteComponent SpriteComponent

The sprite component containing the animation

startIndex int

The first index of the animation

endIndex int

The last index of the animation

repeatMode AnimationRepeatMode

The value indicating how to loop the animation

framesPerSeconds float

The animation speed in frames per second. 0 to use the sprite animation system default speed.

Queue(SpriteComponent, int[], AnimationRepeatMode, float)

Queue the sprite animation defined by the provided sequence of indices at the end of the animation queue.

public void Queue(SpriteComponent spriteComponent, int[] indices, AnimationRepeatMode repeatMode, float framesPerSeconds = 0)

Parameters

spriteComponent SpriteComponent

The sprite component containing the animation

indices int[]

The sequence of indices defining the sprite animation

repeatMode AnimationRepeatMode

The value indicating how to loop the animation

framesPerSeconds float

The animation speed in frames per second. 0 to use the sprite animation system default speed.

Resume(SpriteComponent)

Resumes a previously paused animation.

public void Resume(SpriteComponent spriteComponent)

Parameters

spriteComponent SpriteComponent

the sprite component to resume

Stop(SpriteComponent)

Stops the animation of the provided sprite component.

public void Stop(SpriteComponent spriteComponent)

Parameters

spriteComponent SpriteComponent

the sprite component to stop