Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

SpriteSheetSource

What a pxl file’s import gives, import hero from "./hero.px.js", for defineSpriteSheet({ ...hero, pixelsPerMetre }): the sheet’s image, pxl’s JSON, and a clip for each sprite and anim the file names, which type Sprite’s clip. The engine’s Vite plugin writes its types beside the file, hero.px.d.ts.

Type Parameter
Clip extends string
Property Type Description
clips Readonly<Record<Clip, SpriteDataClipOptions>> An anim’s clip takes its tag; a static sprite’s is its one frame.
data unknown The JSON the tool exported: Aseprite’s with --list-tags, and --list-layers for its cels’ user data as marks; or TexturePacker’s JSON array, hash or Pixi format.
image string | PixelTexture The image’s URL: an import of the PNG, such as import heroImage from "../sprites/hero.png". Or a painted definePixelTexture, which a view paints on first use from the game’s texture seed and a room never paints: Unity’s Sprite.Create over a Texture2D filled with SetPixels, Godot’s SpriteFrames over an ImageTexture of a painted Image.