Skip to content

1681-engine / index / parseAseprite

Function: parseAseprite() ​

ts
function parseAseprite(json): AsepriteSheet;

Defined in: src/anim/parseAseprite.ts:28

Reads Aseprite's exported sprite-sheet JSON — either frame layout, "hash" (frames keyed by file name) or "array" — into frames, one Animator clip per tag, slices, layers and cel cues. Pure: no image is touched, so it runs under node and in a worker; addAsepriteTextures / loadAseprite cut the sheet image by the frames it returns.

ts
const sheet = parseAseprite(json);
const anim = new Animator(sheet.clips, 'idle'); // tag names are clip names; frames are sheet frame indices

Parameters ​

ParameterType
jsonunknown

Returns ​

AsepriteSheet

Released under the MIT License.