PIXI.SpritesheetLoader

class 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".


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

Constructor


new PIXI.SpritesheetLoader() → {}

Summary


Methods from SpritesheetLoader

string
static getResourcePath(resource: PIXI.LoaderResource, baseUrl: string)
void
static use(resource: PIXI.LoaderResource, next: (...args: unknown[]) => void)

Public Methods


getResourcePath SpritesheetLoader.ts:126
static getResourcePath(resource: PIXI.LoaderResource, baseUrl: string) → {string}

Get the spritesheets root path

Parameters:
Name Type Description
resource PIXI.LoaderResource

Resource to check path

baseUrl string

Base root url

Returns:
Type Description
string
use SpritesheetLoader.ts:33
static use(resource: PIXI.LoaderResource, next: (...args: unknown[]) => void) → {void}

Called after a resource is loaded.

Parameters:
Name Type Description
resource PIXI.LoaderResource
next (...args: unknown[]) => void
Returns:
Type Description
void
See: PIXI.Loader.loaderMiddleware

Powered by webdoc!