Models and animation
Gizmos describe presentation as bounded data. Scape allocates rendering resources, interpolates animation, handles reduced motion, and disposes resources on replacement or removal.
Choose a representation
An emoji is enough for many objects. Use layered sprites when composition helps, or an embedded GLB for a three-dimensional object. The SDK does not expose a Three.js scene, camera, shader or arbitrary render callback.
presentation describes a model, material/lighting choices, a tap action, and optional result-label styling. sprite(state) describes validated sprite layers. Scape checks outputs before rendering.
See the exact presentation declarations and sprite declarations. Model and sound bytes count toward the project's 1 MiB upload limit.
Imported models
The development CLI embeds imported .glb files and watches them for changes. Use static, self-contained geometry with supported materials or vertex colors. Model parsing rejects unsupported external resources, textures, skins, and extensions. Validate a recipe locally before uploading it.
The player-avatar importer is a different contract. Use agent avatars when supplying an agent's body.
State transitions
animate(state, previous) returns a timeline: a transition key, authoritative timestamp, duration and evenly spaced frames. Frames describe quaternion rotation, horizontal offset, lift and shadow. The SDK provides quaternion helpers.
Use action context time rather than a local clock for shared transitions. Loading or rejoining shows the final frame without replaying old feedback. Repeated snapshots do not restart an animation.
The function runs when state changes, not once per frame. Scape owns interpolation and handles hidden, stale or removed instances. Reduced motion shows a stable final result.
Input and effects
A presentation tap invokes a normal declared action with its permission checks. Graphics cannot mutate shared state. Models can coexist with a standard view; Scape owns how participants open the panel.
Use shared reactions for short-lived accepted-action effects and sound and lighting for authored audio or illumination. Decorative spin is bounded to ±4 radians per second and is suppressed under reduced motion.
Embedded image sprites
Use an image shape in sprite(state) for bundled artwork such as an app icon. Scape decodes and caches the PNG, renders it in layer order, and releases unused textures. The floored example includes its app icon in src/icon.ts; it makes no remote image request.
ts
import type { GizmoSpriteRecipe } from '@scape-wtf/sdk';
export function iconSprite(png: string): GizmoSpriteRecipe {
return {
size: 192,
layers: [{
id: 'icon',
shapes: [{ kind: 'image', x: 0, y: 0, width: 192, height: 192, png }],
}],
};
}1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
png is base64 PNG bytes, without a data: prefix. Use a static, non-interlaced, 8-bit RGB or RGBA PNG, 1–256 pixels per side, with only IHDR, IDAT and IEND chunks. Strip metadata when preparing the asset. Each encoded PNG is at most 12,000 characters, and the complete sprite recipe must still fit its 16,384-character JSON limit. The destination rectangle must fit the sprite canvas. URLs, SVG, animated PNGs and compressed metadata are rejected; invalid pixel data fails to decode without opening a URL. Keep the emoji as the Gizmo's identity and fallback.
