Graphics.SpriteAnimation
Description: Defines an animation that can be drawn to the screen.
Implements: EndGate.IDisposable
Constructors
SpriteAnimation (imageSource, fps, frameSize, frameCount)
Creates a new instance of the SpriteAnimation object.
imageSource: Graphics.ImageSource
The Sprite sheet that contains the image frames used to display the animation.
fps: number
How fast to play the animation (frames per second). This value should not be less than the games update interval.
frameSize: EndGate.Size2d
How large each animation frame is within the imageSource sprite sheet.
frameCount: number
How many frames to play for the animation.
SpriteAnimation (imageSource, fps, frameSize, frameCount, startOffset)
Creates a new instance of the SpriteAnimation object.
imageSource: Graphics.ImageSource
The Sprite sheet that contains the image frames used to display the animation.
fps: number
How fast to play the animation (frames per second). This value should not be less than the games update interval.
frameSize: EndGate.Size2d
How large each animation frame is within the imageSource sprite sheet.
frameCount: number
How many frames to play for the animation.
startOffset: EndGate.Vector2d
The positional offset within the imageSource on where the set of animation frames begin.
Fields
OnComplete: EndGate.EventHandler
Gets an event that is triggered when the animation has completed, will not trigger if the animation is repeating. Functions can be bound or unbound to this event to be executed when the event triggers.
Fps: number
Gets or sets the current frames per second.
Methods
IsPlaying()
Determines if the animation is currently playing.
CanPlay()
Determines if the animation can play. This is essentially checking if the underlying image source is loaded.
Play()
Plays the animation.
Pause()
Pauses the animation.
Step()
Steps the animation 1 frame forward. If not repeating and the animation surpasses the maximum frame count, the animation will stop and the OnComplete event will trigger.
Stop()
Stops the animation and resets the current animation frame to 0.
Reset()
Resets the current animation frame to 0.
Update()
Updates the animations current frame. Needs to be updated in order to play the animation.
Dispose()
Unbinds all events. Does not dispose the underlying image source.
Examples
There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.