A map containing the textures for each animation. Can be used to create an AnimatedSprite:
Readonly
cachePrefix string to add to global cache
Reference to the original JSON data.
For multi-packed spritesheets, this contains a reference to all the other spritesheets it depends on.
The resolution of the spritesheet.
A map containing all textures of the sprite sheet. Can be used to create a Sprite:
Reference to the source texture.
Static
Readonly
Advanced
BATCH_The maximum number of Textures to build per process.
Destroy Spritesheet and don't use after this.
Optional
destroyBase: boolean = falseWhether to destroy the base texture as well
Parser spritesheet from loaded data. This is done asynchronously to prevent creating too many Texture within a single process.
Utility class for maintaining reference to a collection of Textures on a single Spritesheet.
To access a sprite sheet from your code you may pass its JSON data file to Pixi's loader:
Alternately, you may circumvent the loader by instantiating the Spritesheet directly:
With the
sheet.textures
you can create Sprite objects, andsheet.animations
can be used to create an AnimatedSprite.Here's an example of a sprite sheet JSON data file:
Sprite sheets can be packed using tools like https://codeandweb.com/texturepacker|TexturePacker, https://renderhjs.net/shoebox/|Shoebox or https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js. Default anchor points (see Texture#defaultAnchor), default 9-slice borders (see Texture#defaultBorders) and grouping of animation sprites are currently only supported by TexturePacker.
Alternative ways for loading spritesheet image if you need more control:
or: