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 |
|
void |
|
Public Methods
static getResourcePath(resource: PIXI.LoaderResource, baseUrl: string) → {string}
Get the spritesheets root path
Name | Type | Description |
---|---|---|
resource | PIXI.LoaderResource |
Resource to check path |
baseUrl | string |
Base root url |
Type | Description |
---|---|
string |
static use(resource: PIXI.LoaderResource, next: (...args: unknown[]) => void) → {void}
Called after a resource is loaded.
Name | Type | Description |
---|---|---|
resource | PIXI.LoaderResource | |
next | (...args: unknown[]) => void |
Type | Description |
---|---|
void |