Skip to content

1681-engine / index / loadAseprite

Function: loadAseprite() ​

ts
function loadAseprite(
   textures, 
   key, 
   jsonUrl, 
   options?
): Promise<AsepriteSheet>;

Defined in: src/assets/loadAseprite.ts:52

Loads an Aseprite export — the JSON, then the sheet image it names (resolved beside the JSON) — registers its frames under key and returns the parsed sheet (clips, slices, layers, cues).

ts
const [hero] = await Promise.all([loadAseprite(stage.textures, 'hero', 'art/hero.json'), assets.load()]);
const sprite = stage.add.image(0, 0, 'hero', 0);
const anim = new Animator(hero.clips, 'idle');

Parameters ​

ParameterType
texturesAsepriteTextureSink
keystring
jsonUrlstring
optionsAsepriteLoadOptions

Returns ​

Promise<AsepriteSheet>

Released under the MIT License.