SpriteAnimationSystem Class
Namespace: Stride.Rendering.SpritesAssembly: Stride.Engine.dll
A system in charge of animating the sprites
public class SpriteAnimationSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
Name | Description | |
---|---|---|
Constructors | ||
SpriteAnimationSystem(IServiceRegistry) | Creates a new instance of SpriteAnimationSystem and register it in the services. |
|
Properties | ||
DefaultFramesPerSecond | Gets or sets the default sprite animation FPS (Default value = 30 FPS). |
|
Methods | ||
Draw(GameTime) | ||
Initialize() | ||
Pause(SpriteComponent) | Pauses the animation of the provided sprite component. |
|
Play(SpriteComponent, Int32, Int32, AnimationRepeatMode, Single, Boolean) | Play the sprite animation starting at index |
|
Play(SpriteComponent, Int32[], AnimationRepeatMode, Single, Boolean) | Play the sprite animation defined by the provided sequence of indices. |
|
Queue(SpriteComponent, Int32, Int32, AnimationRepeatMode, Single) | Queue the sprite animation starting at index |
|
Queue(SpriteComponent, Int32[], AnimationRepeatMode, Single) | Queue the sprite animation defined by the provided sequence of indices at the end of the animation queue. |
|
Resume(SpriteComponent) | Resumes a previously paused animation. |
|
Stop(SpriteComponent) | Stops the animation of the provided sprite component. |
Constructors
SpriteAnimationSystem(IServiceRegistry)
Creates a new instance of SpriteAnimationSystem and register it in the services.
public SpriteAnimationSystem(IServiceRegistry registry)
Parameters
Type | Name | Description |
---|---|---|
IServiceRegistry | registry |
Properties
DefaultFramesPerSecond
Gets or sets the default sprite animation FPS (Default value = 30 FPS).
public float DefaultFramesPerSecond { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
Draw(GameTime)
public override void Draw(GameTime gameTime)
Parameters
Type | Name | Description |
---|---|---|
GameTime | gameTime |
Overrides
Initialize()
public override void Initialize()
Overrides
Pause(SpriteComponent)
Pauses the animation of the provided sprite component.
public void Pause(SpriteComponent spriteComponent)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | the sprite component to pause |
Play(SpriteComponent, Int32, Int32, AnimationRepeatMode, Single, Boolean)
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 = 0F, bool clearQueuedAnimations = true)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | The sprite component containing the animation |
System.Int32 | startIndex | The first index of the animation |
System.Int32 | endIndex | The last index of the animation |
AnimationRepeatMode | repeatMode | The value indicating how to loop the animation |
System.Single | framesPerSeconds | The animation speed in frames per second. 0 to use the sprite animation system default speed. |
System.Boolean | clearQueuedAnimations | Indicate if queued animation should be cleared |
Play(SpriteComponent, Int32[], AnimationRepeatMode, Single, Boolean)
Play the sprite animation defined by the provided sequence of indices.
public void Play(SpriteComponent spriteComponent, int[] indices, AnimationRepeatMode repeatMode, float framesPerSeconds = 0F, bool clearQueuedAnimations = true)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | The sprite component containing the animation |
System.Int32[] | indices | The sequence of indices defining the sprite animation |
AnimationRepeatMode | repeatMode | The value indicating how to loop the animation |
System.Single | framesPerSeconds | The animation speed in frames per second. 0 to use the sprite animation system default speed. |
System.Boolean | clearQueuedAnimations | Indicate if queued animation should be cleared |
Queue(SpriteComponent, Int32, Int32, AnimationRepeatMode, Single)
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 = 0F)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | The sprite component containing the animation |
System.Int32 | startIndex | The first index of the animation |
System.Int32 | endIndex | The last index of the animation |
AnimationRepeatMode | repeatMode | The value indicating how to loop the animation |
System.Single | framesPerSeconds | The animation speed in frames per second. 0 to use the sprite animation system default speed. |
Queue(SpriteComponent, Int32[], AnimationRepeatMode, Single)
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 = 0F)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | The sprite component containing the animation |
System.Int32[] | indices | The sequence of indices defining the sprite animation |
AnimationRepeatMode | repeatMode | The value indicating how to loop the animation |
System.Single | framesPerSeconds | 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
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | the sprite component to resume |
Stop(SpriteComponent)
Stops the animation of the provided sprite component.
public void Stop(SpriteComponent spriteComponent)
Parameters
Type | Name | Description |
---|---|---|
SpriteComponent | spriteComponent | the sprite component to stop |