Layered sprites
Compose validated sprite layers without DOM or renderer access.
Generated from the reviewed SDK 0.1.0 contract snapshot. Unreviewed workspace changes are not included.
Public exports
Import from @scape/sdk.
GizmoSpriteAnimation, GizmoSpriteFill, GizmoSpriteFrame, GizmoSpriteRecipe, GizmoSpriteShape, gizmoSpriteAnimationError, gizmoSpriteError, resolveGizmoSprite, spriteAnimationFrame.
Type declarations
These declarations preserve source comments and related types. Import only the public exports listed above; module-relative paths below describe how the package is organized.
ts
import { type ObjectDefinition } from './api.js';
export type GizmoSpriteFill = string | {
from: string;
to: string;
y: [number, number];
};
export type GizmoSpriteShape = {
kind: 'rect';
x: number;
y: number;
width: number;
height: number;
radius: number;
fill: GizmoSpriteFill;
} | {
kind: 'text';
x: number;
y: number;
text: string;
size: number;
weight: 400 | 600;
color: string;
}
/** The host may supply a composition marker. The recipe only chooses its rectangle. */
| {
kind: 'marker';
x: number;
y: number;
width: number;
height: number;
};
/** Small layered canvas drawing, rendered by the host. No URLs, HTML, shaders or renderer handles. */
export interface GizmoSpriteRecipe {
size: number;
layers: {
id: string;
shapes: GizmoSpriteShape[];
}[];
}
export interface GizmoSpriteFrame {
at: number;
offset: [number, number];
/** Linear RGB material multiplier. */
tint: [number, number, number];
curve?: 'linear' | 'out-cubic' | 'out-quadratic';
}
/** Local cosmetic animation of one named layer; reduced motion retains tint only. */
export interface GizmoSpriteAnimation {
layer: string;
frames: GizmoSpriteFrame[];
}
export declare function gizmoSpriteError(value: unknown): string | null;
export declare function gizmoSpriteAnimationError(value: unknown): string | null;
export declare function spriteAnimationFrame(animation: GizmoSpriteAnimation, progress: number): GizmoSpriteFrame;
export declare function resolveGizmoSprite(definition: ObjectDefinition, state: unknown): GizmoSpriteRecipe | undefined;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and host behavior.
