createSpriteAtlasfunctionnacatamalon
createSpriteAtlas(options: TSpriteAtlasOptions) => TSpriteAtlasDescribes a sheet as a grid of frames, so many pictures can live in one image.
This is what lets a whole game draw with one texture: sprites sharing an image are drawn together, and every change of image costs the renderer a break in the batch. A sheet is also how a character is animated, since its frames are the same picture at different moments.
Nothing is loaded here and nothing is measured: a frame is a fraction of the image, so this works the instant it is written, whether or not the image has arrived.
Parameters
optionsTSpriteAtlasOptionsThe image, and how many columns and rows of frames it holds.
Example
const walk = useLoadTexture({ src: '/assets/walk.png', key: 'walk' });
const sheet = createSpriteAtlas({ texture: walk, columns: 6 });
createSprite({ atlas: sheet, frame: 0, transform: { x: 80, y: 120 } });