indexFunctions
Function: getSpritesheet()
> getSpritesheet(spritesheetAlias?): Promise<Spritesheet<SpritesheetData>>
Defined in: src/canvas/functions/spritesheet-utility.ts:29
Get a spritesheet from its alias or URL. If it is not in the cache, it is loaded with Assets.load.
Parameters
spritesheetAlias?
string
The alias or URL of the spritesheet JSON.
Returns
Promise<Spritesheet<SpritesheetData>>
The PixiJS Spritesheet.
Throws
when the alias is missing, the asset can't be loaded, or the asset is not a Spritesheet.
Example
Assets.add({ alias: "fighter", src: "https://pixijs.com/assets/spritesheet/fighter.json" });
const sheet = await getSpritesheet("fighter");
const textures = Object.values(sheet.textures);