A simple and flexible HTML5 and JavaScript powered game engine.
View Project on GitHub Download Pixel.js (v0.9b)
Represents an animated sprite that can be used as an Asset for an Entity.
Name | Description |
---|---|
defaultFrame | The index of the frame to display when the sprite is not animating. |
isAnimating | A read only value that indicates whether or not the sprite is currently animating. |
loaded | A boolean value indicating whether or not the asset has been loaded. (Inherited from Asset.) |
startAnimating | Start animating the sprite until stopAnimating is called. |
resetFrame | The index of the last frame in the animation. |
row | The row number of frames to animate between. |
speed | The time in milliseconds that must pass before the next frame of an animation is loaded. |
Name | Description |
---|---|
draw | Draws the asset to the Layer that the owning Entity exists on. (Overrides Asset.draw.) |
load | Loads the asset. (Overrides Asset.load.) |
prepare | Prepare the information required to load the asset. (Inherited from Asset.) |
startAnimating | Start animating the sprite until stopAnimating is called. |
stopAnimating | Stops the sprite animating. |
The AnimatedSprite class is a derivative of the Asset class and provides the functionality required to turn a sprite sheet into an animation.
By default, the sprite will begin animation as soon as it is loaded and will have an animation speed of 0.2.
Google Chrome, Mozilla FireFox, Internet Explorer 9+, Opera, Safari.
In addition to these tested browsers, the AnimatedSprite class is supported by any browser that supports the HTML5 canvas.