API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classSpritesheet
@codexo/exojs / rendering / stable
Slices a single Texture into named frames and optional named animation sequences. Each frame is stored as both a Rectangle (the pixel region) and a pre-configured Sprite ready for direct rendering. Animations are ordered lists of frame names that AnimatedSprite.fromSpritesheet consumes to create playback clips.
4
props
9
methods
0
events
Import
import { Spritesheet } from '@codexo/exojs'Slices a single Texture into named frames and optional named animation sequences.
Each frame is stored as both a Rectangle (the pixel region) and a pre-configured Sprite ready for direct rendering. Animations are ordered lists of frame names that AnimatedSprite.fromSpritesheet consumes to create playback clips.
Constructors1
new(texture: TextureA static GPU texture sourced from an image, canvas, or video element. Holds the pixel source, its sampling state (ScaleModes, WrapModes) and its upload state (…, data: SpritesheetDataJSON-compatible descriptor that drives Spritesheet.parse. Matches the Aseprite / TexturePacker output format (subset).): SpritesheetMethods9
addFrame(name: string, data: SpritesheetFrameA single frame entry in a SpritesheetData descriptor.): thisRegister a single frame by name, creating its Rectangle and pre-configured Sprite.
clear(): thisDestroy all registered frames, sprites, and animations, resetting the spritesheet to an empty state.
defineAnimation(name: string, frameNames: readonly string[]): thisRegister an animation sequence as an ordered list of frame names. All referenced frames must already exist.
destroy(): voidgetAnimationFrameNames(name: string): readonly string[]Return the ordered frame-name list for the named animation. Throws if the animation does not exist.
Return the Rectangle for the named frame. Throws if the frame does not exist.
Return the pre-configured Sprite for the named frame. Throws if the frame does not exist.
parse(data: SpritesheetDataJSON-compatible descriptor that drives Spritesheet.parse. Matches the Aseprite / TexturePacker output format (subset)., keepFrames: boolean): voidParse a SpritesheetData descriptor, populating frames, sprites, and animations. When keepFrames is false (default), all existing frames and sprites are destroyed before parsing.
removeFrame(name: string): thisDestroy and remove a single frame's Rectangle and Sprite by name. No-op if the frame does not exist.
Properties4
animations: Map<string, readonly string[]>Source