Class: SpritesheetLoader

PIXI.SpritesheetLoader

PIXI.Loader middleware for loading texture atlases that have been created with TexturePacker or similar JSON-based spritesheet.

This middleware automatically generates Texture resources.

If you're using Webpack or other bundlers and plan on bundling the atlas' JSON, use the PIXI.Spritesheet class to directly parse the JSON.

The Loader's image Resource name is automatically appended with "_image". If a Resource with this name is already loaded, the Loader will skip parsing the Spritesheet. The code below will generate an internal Loader Resource called "myatlas_image".

Example


 loader.add('myatlas', 'path/to/myatlas.json');
 loader.load(() => {
   loader.resources.myatlas; // atlas JSON resource
   loader.resources.myatlas_image; // atlas Image resource
 });

Implements

Methods

PIXI.SpritesheetLoader.getResourcePath (resource, baseUrl) string static

Get the spritesheets root path

Name Type Description
resource PIXI.LoaderResource

Resource to check path

baseUrl string

Base root url

Returns:
Type Description
string

PIXI.SpritesheetLoader.use (resource, next) void static

Called after a resource is loaded.

Name Type Description
resource PIXI.LoaderResource
next Function
See: