API

Interface Sprite2DProps

Per-sprite init record passed to addSprite2DIndex / updateSprite2DIndex.

interface Sprite2DProps {
    clip?: unknown;
    color?: [number, number, number, number];
    flipX?: boolean;
    flipY?: boolean;
    frame?: number;
    positionPx: [number, number];
    rotation?: number;
    sizePx?: [number, number];
    visible?: boolean;
    z?: number;
}
Index
clip?: unknown

Reserved for clip animation. Accepted but unused today.

color?: [number, number, number, number]
flipX?: boolean

Absolute horizontal orientation, not a toggle: true mirrors the sprite, false restores it, and omitting the flag preserves whatever orientation the sprite already has (including across a frame change). Re-sending the same value every frame is a no-op.

flipY?: boolean

Absolute vertical orientation. See Sprite2DProps.flipX.

frame?: number
positionPx: [number, number]
rotation?: number
sizePx?: [number, number]
visible?: boolean
z?: number

Per-sprite NDC depth (0 = near, 1 = far). Only stored and consumed by depth-hosted layers (depth: "test" | "test-write"); pure-2D HUD layers use a 13-float layout and do not allocate a Z slot. When omitted on add for a depth-hosted layer, defaults to the owning layer's layerZ at the moment of insertion. When omitted on update, the sprite's existing Z is preserved. Mutate freely — the next binding update will re-upload only the dirty range.