@entro314labs/iso-engine 0.0.0-stage → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -2
  3. package/THIRD_PARTY_NOTICES.md +39 -0
  4. package/dist/engine/anim.js +225 -0
  5. package/dist/engine/behaviors.js +105 -0
  6. package/dist/engine/diagram.js +80 -0
  7. package/dist/engine/draw.js +117 -0
  8. package/dist/engine/export.js +81 -0
  9. package/dist/engine/figure.js +35 -0
  10. package/dist/engine/global.js +4 -0
  11. package/dist/engine/index.d.ts +278 -0
  12. package/dist/engine/index.js +164 -0
  13. package/dist/engine/math.js +190 -0
  14. package/dist/engine/node.js +290 -0
  15. package/dist/engine/paths.js +76 -0
  16. package/dist/engine/prefabs/architecture.js +136 -0
  17. package/dist/engine/prefabs/basics.js +131 -0
  18. package/dist/engine/prefabs/devices.js +295 -0
  19. package/dist/engine/prefabs/icons.js +49 -0
  20. package/dist/engine/prefabs/index.js +12 -0
  21. package/dist/engine/prefabs/logistics.js +156 -0
  22. package/dist/engine/scene.js +466 -0
  23. package/dist/engine/shapes.js +781 -0
  24. package/dist/engine/sort.js +153 -0
  25. package/dist/engine/spec.js +81 -0
  26. package/dist/engine/style.js +87 -0
  27. package/dist/engine.css +1 -0
  28. package/dist/figure.css +93 -0
  29. package/dist/figure.d.ts +22 -0
  30. package/dist/figure.js +73 -0
  31. package/dist/filters.d.ts +9 -0
  32. package/dist/filters.js +22 -0
  33. package/dist/index.d.ts +9 -0
  34. package/dist/index.js +8 -0
  35. package/dist/iso.global.js +7990 -0
  36. package/dist/kernel.d.ts +102 -0
  37. package/dist/kernel.js +172 -0
  38. package/dist/loops.d.ts +49 -0
  39. package/dist/loops.js +64 -0
  40. package/dist/patterns.d.ts +44 -0
  41. package/dist/patterns.js +97 -0
  42. package/dist/theme.css +19 -0
  43. package/dist/types.d.ts +86 -0
  44. package/dist/types.js +1 -0
  45. package/package.json +50 -4
  46. package/skills/iso-engine/SKILL.md +143 -0
  47. package/skills/iso-engine/examples/engine.html +42 -0
  48. package/skills/iso-engine/examples/figure.html +51 -0
  49. package/skills/iso-engine/examples/loop.html +68 -0
  50. package/skills/iso-engine/examples/loop.js +36 -0
  51. package/skills/iso-engine/examples/matcher.js +134 -0
  52. package/skills/iso-engine/examples/spec.html +42 -0
  53. package/skills/iso-engine/references/animation.md +116 -0
  54. package/skills/iso-engine/references/api.md +207 -0
  55. package/skills/iso-engine/references/composition.md +66 -0
  56. package/skills/iso-engine/references/diagrams.md +68 -0
  57. package/skills/iso-engine/references/figures.md +359 -0
  58. package/skills/iso-engine/references/loops.md +126 -0
  59. package/skills/iso-engine/references/prefabs.md +103 -0
  60. package/skills/iso-engine/references/spec.md +66 -0
  61. package/skills/iso-engine/references/style.md +76 -0
  62. package/skills/iso-engine/references/troubleshooting.md +49 -0
  63. package/skills/iso-engine/scripts/build.mjs +35 -0
@@ -0,0 +1,359 @@
1
+ # Interactive figures (the kernel)
2
+
3
+ A figure is an isometric line drawing whose parts work: a switch toggles, keys depress, a screen shows what was typed,
4
+ picking a chip lights the buses it talks to. It is plain SVG drawn by the projection kernel from `@entro314labs/iso-engine`, mounted
5
+ by `mountFigure`, styled by `figure.css`. `examples/matcher.js` is a complete one; read it before starting.
6
+
7
+ ## The contract
8
+
9
+ ```ts
10
+ import { createKernel, frame, mountFigure, type Figure } from '@entro314labs/iso-engine';
11
+ import '@entro314labs/iso-engine/theme.css'; // colour tokens, light and dark (or define them yourself)
12
+ import '@entro314labs/iso-engine/figure.css'; // .face, .press, .part, .flow, .layer, .cut, .hud, the glow kit
13
+
14
+ const fig: Figure = {
15
+ id: 'lamp', // kebab-case; also the css scope
16
+ name: 'Desk lamp', // title caption
17
+ hint: 'Press the switch', // how to operate it, for a caption
18
+ aria: 'A desk lamp. Press the switch to turn it on.', // what it is and how to operate it
19
+ css: `[data-fig="lamp"] .stage .shade.on .face { fill:var(--glass-on); stroke:var(--accent); }`,
20
+ mount(ctx) {
21
+ // draw into ctx.stage (an empty, focusable <svg class="stage">), call ctx.readout() on every change
22
+ return { key(e) { return false; }, destroy() {}, demo() {} };
23
+ },
24
+ };
25
+
26
+ const m = mountFigure(host, fig, { readout: t => { readoutEl.textContent = t; }, demo: false });
27
+ addEventListener('keydown', e => { if (!e.metaKey && !e.ctrlKey && !e.altKey && m.handle.key?.(e)) e.preventDefault(); });
28
+ // later: m.destroy()
29
+ ```
30
+
31
+ - **The host needs a size**; the stage fills it (`height:100%`). The page owns the plate and the captions (name, hint,
32
+ readout); the figure only draws.
33
+ - `mountFigure` installs the glow filters and the figure's `css` once per document, marks the host `data-fig="<id>"`
34
+ and passes a context:
35
+
36
+ | Context | |
37
+ |---|---|
38
+ | `stage`, `host` | The empty svg, and the element holding it (engine figures build in `host`). |
39
+ | `readout(text)` | The live state caption. Call it on every interaction. |
40
+ | `after(ms, fn)`, `every(ms, fn)`, `loop(fn)` | Timers and animation frames, all cleared by `destroy()`. Use them instead of raw timers. |
41
+ | `flash(el)` | Press feedback: sink the part and light it briefly. |
42
+ | `replay(el)` | Restart a one-shot animation, e.g. a `.pulse` travelling along a wire. |
43
+ | `power(on)` | A warm accent haze behind the figure while it is on. |
44
+
45
+ - The handle: `key(e)` takes page-level keys (digits, letters) and returns true when it used one; arrows and Escape go
46
+ on `stage` listeners so they only act while the drawing has focus. `destroy()` cancels the figure's own tweens and
47
+ sequences. `demo()` is a 3-6 step sequence over 2-5 s (scheduled with `after`) that calls the same functions as real
48
+ input and leaves the figure lit; `{ demo: true }` runs it on arrival, so a landing page opens with the figure alive.
49
+ - **Scope every rule in `css` under `[data-fig="<id>"]`** and reach the drawing as `[data-fig="<id>"] svg.stage …`:
50
+ the class plus the tag lets a figure's rule win over the shared state rules such as `.stage .part.sel text`.
51
+ Several figures can share a page, so there is no stage id, and ids inside a figure would collide: use classes
52
+ (`<g class="hud">`, not `id="hud"`).
53
+ - Strict CSP: `mountFigure` adds `<style>` elements. Leave `css` off and put the rules in your own stylesheet.
54
+
55
+ ## The kernel
56
+
57
+ ```ts
58
+ const k = createKernel();
59
+ const { P, TOP, FRONT, SIDE, box } = k;
60
+ let svg = box(0, 0, 0, 240, 160, 12, 8); // x, y, z, w (along x), d (along y), h, plan radius
61
+ svg += `<g transform="${FRONT(0, 160, 12)}">${tx(10, 8, 'MODEL 1', 6)}</g>`; // flat detail on a face
62
+ stage.innerHTML = svg;
63
+ const base = frame(stage, k.pts); // fit the viewBox once; keep `base` for zoom
64
+ ```
65
+
66
+ Axes: +x runs down-right, +y down-left, +z up. The viewer sees the top, the `y = max` face (FRONT, lower-left) and the
67
+ `x = max` face (SIDE, lower-right). Put the object's front (screen, display) on a FRONT face and what people reach for
68
+ (keys, buttons, dials) at larger `y`, in front of it.
69
+
70
+ | Member | |
71
+ |---|---|
72
+ | `box(x,y,z,w,d,h,r?)` | Three visible faces; `r > 0` rounds in plan with one continuous wall, so corners line up. Records its corners in `pts`. |
73
+ | `disc(cx,cy,z,r,h)` | A short upright cylinder (platter, knob, can). |
74
+ | `TOP(x,y,z)`, `FRONT(x,y,z)`, `SIDE(x,y,z)` | Transforms that lay a group's local 2D units on a plane, origin at the face's top-left as seen. FRONT: pass the face's top-left corner `(x, y_max, z_top)`. SIDE: local x runs toward −y, so pass its front top corner `(x_max, y_max, z_top)`. |
75
+ | `plane(O, U, V)` | Any plane: origin `O`, in-plane axes `U`, `V`. |
76
+ | `P(x,y,z)`, `D(x,y,z)` | Project a point / a direction to screen. |
77
+ | `pts` | Every projected corner drawn so far. Reset with `k.pts.length = 0` before a redraw. |
78
+ | `setTilt(t)` | Camera tilt, 0 = isometric, 1 = plan (see Camera tilt). |
79
+
80
+ Flat detail, in face-local units inside a plane group: `ln(x1,y1,x2,y2)`, `rc(x,y,w,h,r?)`, `ci(x,y,r)`,
81
+ `tx(x,y,text,size,anchor?,cls?,max?)` (escapes its text), `rep(n, i => …)` for texture from repetition, `esc(s)` for
82
+ any text you interpolate yourself. Give `tx` a `max` (the room on its surface): it shrinks or truncates the label to
83
+ fit. Anything that sticks out without `box()` (railings, antennae, traces leaving a board) must push its extreme points
84
+ into `k.pts` (`k.pts.push(P(x, y, z))`), or `frame()` clips it.
85
+
86
+ ## Classes and the glow kit (`figure.css`)
87
+
88
+ | Class | Use |
89
+ |---|---|
90
+ | `.face`, `.face.top`, `.face.glass` | Solid faces (opaque fills: painter's-order occlusion depends on it). `box()` emits these. |
91
+ | `.detail` | Flat linework on faces. |
92
+ | `.press` (+ `.down`) | A pressable part; `flash(el)` adds `.down` and `.flash`. |
93
+ | `.press.latched` | Persistent on-state of a press: solid accent with a soft glow. |
94
+ | `.part` + `.sel` / `.linked` / `.dim` / `.hover` | The selection model (Layers & links). |
95
+ | `.deco` | Decoration; never steals clicks. |
96
+ | `.lcd`, `.lcd.dim` | Text on a display. |
97
+ | `.glass` + `.hot` | Display glass, lit: accent mixed into the glass, accent edge. |
98
+ | `.glow-halo` + `.hot`, with `filter="url(#fx-bloom)"` | Soft light behind lit glass, a beam or a bulb; drawn just before what it lights. |
99
+ | `.led` + `.hot` | An indicator (or a small bar) that is on. |
100
+ | `.wire` + `.hot`, `.wire-under` | A wire carrying signal; a background-coloured stroke under it where wires cross. |
101
+ | `.pulse` + `.go`, on a path with `pathLength="1000"` | A dash of light travelling a wire once per event (`replay(el)`). |
102
+ | `.trace`, `.flow` + `.on` / `.rev` | Connections (Layers & links). |
103
+ | `.layer`, `.cut` | Exploded layers and cutaways. |
104
+ | `.hud` with `.leader`, `.dot`, `text` | Callouts (`placeCallouts`). |
105
+
106
+ Strokes are `vector-effect:non-scaling-stroke`, which keeps hairlines hairlines under the plane matrices; keep it on
107
+ any stroke class you add. The filters (`#fx-glow`, `#fx-soft`, `#fx-bloom`) use `userSpaceOnUse` regions, because a
108
+ perfectly straight path has a zero-height box and vanishes under a box-relative filter. `--glass-on` and `--accent-dim`
109
+ derive from `--accent` where the figure sits, so setting `--accent` on any ancestor recolours one figure.
110
+
111
+ ## Procedure
112
+
113
+ 1. **Name the output.** What does pressing a part produce? Typed text, a result, a note, a toggled light, a path between
114
+ two rooms. Everything else serves that. A figure you can only watch is decoration: pick a different object.
115
+ 2. **Decompose the object** into 3-8 boxes (up to ~15 for a scene). Write their `(x, y, z, w, d, h)` as a small table
116
+ first. Pick the pressable parts and the one surface that displays state.
117
+ 3. **Emit back to front.** Paint order is the depth sort: smaller `x + y` first, lower `z` first. For grids loop rows by
118
+ increasing `y`, then columns by increasing `x`. Parts sitting on others go after everything beneath them. Past a few
119
+ dozen raised parts, use units (below).
120
+ 4. **Wrap each pressable part in its own `<g class="press" data-…>`** with its box and its label. The press group
121
+ carries **no `transform` attribute**: CSS `transform` on an SVG `<g>` replaces the attribute instead of composing,
122
+ so keep every `matrix()` on a nested group.
123
+ 5. **Frame once.** `frame(stage, k.pts)` after building. If anything moves (lift, zoom, tilt), frame the union of the
124
+ rest state and every end state; never re-frame during an animation or the figure breathes.
125
+ 6. **One `state`, one `render()`** that toggles classes and rewrites the display and readout. Pointer and keyboard call
126
+ the same functions. Timers and clocks update text or classes only, never rebuild the pressable shapes, or clicks
127
+ get lost between mousedown and mouseup.
128
+ 7. **Light it.** Decide what glows in each state; the lit state must read at thumbnail size.
129
+ 8. **Motion in CSS** for presses and toggles (`.press.down` sinks 4px over ~60 ms). The viewBox (zoom) and the camera
130
+ tilt are the only things tweened in JS. Under reduced motion jump to end states (`createTween` and `createSequence`
131
+ already do).
132
+ 9. **Readout**: terse, lowercase, dot-separated (`off` → `on · 9 chars · key t`), changed by every interaction.
133
+ 10. **Verify in a browser** (SKILL.md, "Verify").
134
+
135
+ ## Input patterns
136
+
137
+ ```ts
138
+ stage.addEventListener('click', e => {
139
+ const el = (e.target as Element).closest('.key');
140
+ if (el instanceof SVGElement) press(el.dataset.key!);
141
+ });
142
+ return { key: e => !e.repeat && press(e.key.length === 1 ? e.key.toLowerCase() : e.key) }; // press() returns true when used
143
+ ```
144
+
145
+ - Held parts (instrument keys): `pointerdown` / `pointermove` / `pointerup` on the svg with `setPointerCapture`, find
146
+ the part under the pointer with `document.elementFromPoint(…).closest('.key')` so dragging across parts works,
147
+ `touch-action:none`, ignore `e.repeat`, release everything on window `blur`.
148
+ - Text typed onto a screen: show the tail of the buffer, clip with a `<clipPath>` matching the glass, escape it.
149
+ - Sound: create the `AudioContext` inside the first press (browsers block it before a gesture), route through one gain
150
+ into an `AnalyserNode`, and draw its time-domain data as a `<polyline>` on the screen face each frame (`ctx.loop`),
151
+ starting from a rising zero crossing so the trace holds still.
152
+
153
+ ## Painter's order: the hard cases
154
+
155
+ - **Long thin boxes** (walls) break the order against the boxes they cross: split them at every crossing and order the
156
+ pieces by the `x + y` of their centres. Low walls hide about their own height of floor behind them, so put floor
157
+ labels near each room's back edge (small `x`, small `y`).
158
+ - **Protrusions** (balconies, ledges, connectors) of depth `d` hide `d` of wall height beneath them, shifted `d` toward
159
+ −x. Keep wall detail more than `d` below a protrusion.
160
+ - **Never draw a box whose footprint runs inside another opaque box** (a full floor slab inside a building): its top
161
+ paints over the walls above it. Draw only the strips that actually protrude.
162
+
163
+ ## Layers & links (multi-part scenes)
164
+
165
+ For a system of parts rather than one device. **At most three of these patterns per figure** (exploded layers and
166
+ cutaway count as one): a board with flowing connections, callouts and zoom reads well; add exploded layers and a tilt
167
+ and it becomes a demo reel. Every selection must still change the readout or a display.
168
+
169
+ ### Many small parts: units
170
+
171
+ ```ts
172
+ const k = createKernel(), u = createUnits(k);
173
+ u.begin('cpu'); // a pressable part (several units may share one part id)
174
+ u.bx(120, 80, 6, 40, 40, 4, 2);
175
+ u.onTop(120, 80, 10, tx(20, 22, 'CPU', 7, 'middle'));
176
+ u.begin(); // decoration (class "deco")
177
+ u.bx(60, 40, 6, 8, 8, 10);
178
+ stage.innerHTML = board + u.emit(); // depth-sorted, each unit wrapped in its group
179
+ ```
180
+
181
+ `depthSort` orders non-intersecting boxes (a lies behind b when it is entirely on the low side of b along some axis)
182
+ and falls back to authoring order for ties and cycles. Flat detail added with `onTop` / `onFront` / `onSide` rides
183
+ inside its unit. Non-box shapes join a unit with `raw(svg)` plus `extend(…)` for their extent. Parts that need their own
184
+ CSS-transform wrapper (a sliding fader cap) go into `emit([{ bb, html }])` already wrapped.
185
+
186
+ ### Scene as data, selection
187
+
188
+ Declare parts in a table (`{ id, box, layer, links, name, info }`); one `build()` draws them in table order (which is
189
+ paint order, or let units sort) and records each part's projected bounds `bbox(k.pts.slice(from))` (for zoom) and an
190
+ anchor `P(x + w / 2, y + d / 2, z + h)` (for callouts and connection ends).
191
+
192
+ ```ts
193
+ const active = (id: string | null) => id ? new Set([id, ...(ADJ[id] ?? [])]) : null;
194
+ // in render():
195
+ const act = active(state.sel);
196
+ for (const el of stage.querySelectorAll<SVGElement>('.part')) {
197
+ const id = el.dataset.id!;
198
+ el.classList.toggle('sel', id === state.sel);
199
+ el.classList.toggle('linked', !!act && act.has(id) && id !== state.sel);
200
+ el.classList.toggle('dim', !!act && !act.has(id));
201
+ }
202
+ ```
203
+
204
+ Click selects, clicking it again or Escape clears, arrow keys (on `stage`) step through the table, `pointerover` /
205
+ `pointerout` toggle `.hover` as a preview. **Dim with stroke colour, never with `opacity`** on faces: a translucent
206
+ face lets what is behind it show through. When connections run across a part's top, don't fill the selected part (the
207
+ fill hides them); outline it and mark the ends (a dot at the source, a ring at the sink).
208
+
209
+ ### Connections
210
+
211
+ A connection is a polyline in a plane's local units, drawn twice: a static `.trace` and a `.flow` overlay that animates
212
+ when `.on` (`.rev` for sink → source). Author points source → sink. Draw traces right after the surface they lie on
213
+ and before the parts on it, so parts cover the traces beneath them.
214
+
215
+ ```ts
216
+ const link = (on: string, points: string, id: string) =>
217
+ `<g transform="${on}"><polyline class="trace" points="${points}"/><polyline class="flow" data-link="${id}" points="${points}"/></g>`;
218
+ svg += link(TOP(0, 0, 8), '150,110 150,60 230,60', 'cpu-ram');
219
+ ```
220
+
221
+ ### Signal sequence
222
+
223
+ Light parts and connections one after another ("power reaches the board, then the CPU, then memory").
224
+
225
+ ```ts
226
+ const seq = createSequence(render); // a new run cancels the previous one; reduced motion skips the waits
227
+ seq.run([() => state.lit.add('cpu'), () => state.lit.add('cpu-ram'), () => state.lit.add('ram')], 180);
228
+ // destroy(): seq.cancel()
229
+ ```
230
+
231
+ `render()` reads `state.lit` to set `.on` on flows and `.linked` on parts. While a sequence runs, derive `.linked` from
232
+ `state.lit`, not from the selection, or everything lights at once; keep `.dim` from the selection. The end state equals
233
+ what reduced motion shows.
234
+
235
+ ### Exploded layers
236
+
237
+ Group parts by height into `<g class="layer" data-layer="n">` wrappers (never the `.press` group itself: the press and
238
+ the lift both set `transform`). Choosing a layer lifts every layer above it straight up the screen, which is pure −z,
239
+ so painter's order holds with no re-sort:
240
+
241
+ ```ts
242
+ for (const el of stage.querySelectorAll<SVGGElement>('.layer')) {
243
+ const above = state.layer !== null && Number(el.dataset.layer) > state.layer;
244
+ el.style.transform = above ? `translateY(${-LIFT}px)` : ''; // px inside an svg are scene units
245
+ el.classList.toggle('cut', above);
246
+ }
247
+ ```
248
+
249
+ To clear a plan completely, `LIFT ≥ min(w, d) + ~12` (a cutaway lets you lift less). For framing, push every point of
250
+ a liftable layer a second time with `y − LIFT` before `frame()`. Hide the plans of layers not picked, or they show
251
+ through a cutaway. A lifted part's bounds and anchor move up by `LIFT`; subtract it when you zoom to or call it out.
252
+
253
+ ### Layered UI
254
+
255
+ An app or system as a few big stacked slabs, one per real component, in the product's order (data at the bottom, what
256
+ the person sees on top), gap 14-20, 1-3 word labels engraved on the tops, orthogonal routed connections, a dashed
257
+ ghost footprint under the stack. Hover or focus lifts a slab a few units; a press pins it: its connections flow, the
258
+ others dim by stroke, and the readout says what the component does. On the engine: the `stack` prefab plus `diagram` /
259
+ `connector` (`api.md`, `diagrams.md`).
260
+
261
+ ### Cutaway
262
+
263
+ `.cut` ghosts a group's faces (`fill-opacity:0`, detail stroke). Scope it to a group and override any live fills inside
264
+ it. Use `fill-opacity:0`, not `fill:none`: a ghosted part keeps its hit area. Add `pointer-events:none` only where the
265
+ ghost overlaps parts that must stay clickable.
266
+
267
+ ### Zoom to a part
268
+
269
+ ```ts
270
+ const zoom = createZoom(stage, base, place); // base = frame(...) result; `place` re-places callouts each frame
271
+ zoom.to(zoom.fit(meta[id].b)); // the part's projected bounds, same aspect, never wider than base
272
+ zoom.reset(); // back; destroy(): zoom.cancel()
273
+ ```
274
+
275
+ Hairlines stay hairlines under zoom because strokes don't scale.
276
+
277
+ ### Callouts
278
+
279
+ Leader-line labels in screen space, in a `<g class="hud">` drawn last, re-placed from the current viewBox so they keep
280
+ their on-screen size:
281
+
282
+ ```ts
283
+ const hud = stage.querySelector<SVGGElement>('.hud')!;
284
+ const place = () => placeCallouts(stage, hud, zoom.vb, state.callouts); // [{ at: [x, y], lines: ['CPU SOCKET', '64-bit · 3 links'] }]
285
+ const stopResize = onResize(stage, place); // sizes are screen pixels
286
+ ```
287
+
288
+ Frame with a wider margin when a figure has callouts (`frame(stage, k.pts, 0.16)`): the labels live in the margin.
289
+ Anchor a little off the part's centre so the dot doesn't sit on its label. One or two callouts at a time, two short
290
+ lines each.
291
+
292
+ ### Camera tilt (iso → plan)
293
+
294
+ `k.setTilt(t)` blends the projection from isometric (0) to a true plan (1), rotated 45° so a building reads as a
295
+ diamond; FRONT and SIDE faces collapse to nothing at 1, which is what a plan shows. Tilting (no rotation around z)
296
+ keeps back-to-front order valid at every angle. Frame each end once, then ease the viewBox between them on the same
297
+ curve as the tilt:
298
+
299
+ ```ts
300
+ const tween = createTween();
301
+ const draw = () => { k.pts.length = 0; stage.innerHTML = scene(); render(); };
302
+ const vbAt = (t: number) => { k.setTilt(t); draw(); return frame(stage, k.pts); };
303
+ const planVB = vbAt(1), isoVB = vbAt(0); // frame both ends once, at setup; leaves the scene isometric
304
+ function tiltTo(target: number) {
305
+ const from = state.tilt, a = target ? isoVB : planVB, b = target ? planVB : isoVB;
306
+ tween.run(650, e => {
307
+ state.tilt = from + (target - from) * e;
308
+ k.setTilt(state.tilt); draw();
309
+ setViewBox(stage, { x: a.x + (b.x - a.x) * e, y: a.y + (b.y - a.y) * e, w: a.w + (b.w - a.w) * e, h: a.h + (b.h - a.h) * e });
310
+ });
311
+ }
312
+ ```
313
+
314
+ ## Engine figures
315
+
316
+ For many new figures the engine is the shorter road: prefabs, cylinders, tubes, text on planes, connectors,
317
+ diagrams, depth sorting that handles moving parts, focus rings and Enter/Space on interactive nodes. Keep the same
318
+ contract and build in `ctx.host`:
319
+
320
+ ```ts
321
+ import Iso from '@entro314labs/iso-engine/engine';
322
+
323
+ mount({ host, readout }) {
324
+ const s = Iso.scene(host, { theme: 'inherit', label: 'What it is and how to operate it.', padding: 22 });
325
+ const key = s.add('box', { id: 'send-key', at: [40, 60, 8], size: [14, 10, 3], r: 1.5, interactive: true, label: 'Send' });
326
+ key.on('click', () => { // mouse, Enter and Space
327
+ s.to(key, { z: -2 }, { duration: 0.06 }).then(() => s.to(key, { z: 0 }, { duration: 0.12 }));
328
+ key.set({ material: 'lit', glow: true });
329
+ readout('sent · undo 5 s');
330
+ });
331
+ s.assemble();
332
+ return { destroy: () => s.destroy() };
333
+ }
334
+ ```
335
+
336
+ Inside `[data-fig]`, `figure.css` maps the page `--accent` onto the engine's accent and glow. Don't mix the kernel and
337
+ the engine in one figure.
338
+
339
+ ## Ambient motion
340
+
341
+ Flowing connections, blinking LEDs, a turning ring: at most two ambient loops, each saying something (data moving, a
342
+ device alive), paused when the figure is off screen or the page is hidden (`IntersectionObserver`,
343
+ `visibilitychange`), stopped under reduced motion. Engine scenes pause their own clock off screen.
344
+
345
+ ## In a framework (React, Vue, Svelte)
346
+
347
+ Mount in an effect and destroy in its cleanup:
348
+
349
+ ```tsx
350
+ useEffect(() => {
351
+ const m = mountFigure(ref.current!, fig, { readout: setReadout });
352
+ const onKey = (e: KeyboardEvent) => { if (!e.metaKey && !e.ctrlKey && !e.altKey && m.handle.key?.(e)) e.preventDefault(); };
353
+ addEventListener('keydown', onKey);
354
+ return () => { removeEventListener('keydown', onKey); m.destroy(); };
355
+ }, []);
356
+ ```
357
+
358
+ Map `--accent` to the brand's one accent. Feed the parts table from the app's own data instead of example rows, and
359
+ wire the readout to the same numbers the app shows elsewhere.
@@ -0,0 +1,126 @@
1
+ # Autoplaying loops
2
+
3
+ A loop is a short animation that plays by itself and tells one story: an email sent and held in its undo window, a
4
+ database going to sleep and waking, an app's interface exploded into its parts. Same look and rigour as a figure; a
5
+ timeline moves the state instead of the viewer. Built on the engine (`api.md`, `animation.md`) with the helpers in
6
+ `@entro314labs/iso-engine/loops`.
7
+
8
+ ## Write the story first
9
+
10
+ 1. **Research the subject** (SKILL.md, "Before you draw"). Use its own nouns; take real values from its code; label
11
+ example data as example.
12
+ 2. **3-7 beats**, each a real state change, each with a caption of at most 64 characters, in a table: name, seconds,
13
+ what changes, caption.
14
+ 3. **A cycle**: the last beat leads into the first; no cut to an empty frame. A one-time opening (`assemble`) plays
15
+ once before the repeating timeline.
16
+ 4. **A poster time**: the single frame that explains most on its own. It shows before play, under reduced motion, as
17
+ the thumbnail and as the exported still.
18
+ 5. **A must-not list**: anything the copy claims that the code contradicts stays out.
19
+
20
+ If the request is open ("animate our product"), propose one or two concrete stories in the product's own words first.
21
+
22
+ ## The contract
23
+
24
+ `examples/loop.js` is a complete one and `examples/loop.html` hosts it. The core:
25
+
26
+ ```ts
27
+ import { beats, halo, loopScene, narrate, type Loop } from '@entro314labs/iso-engine/loops';
28
+
29
+ const ARIA = 'A card lifts off its dock, lights up, and lands again.';
30
+ const loop: Loop = {
31
+ id: 'card-lift', project: 'Example', kind: 'flow', name: 'Card lift',
32
+ aria: ARIA, // the whole story, for screen readers
33
+ mount(host, ctx) {
34
+ const { list, cycle } = beats([['lift', 1.8], ['lit', 1.8], ['land', 1.8]]);
35
+ const s = loopScene(host, ARIA, 2.4); // theme from the page, no autoplay, poster as rest pose
36
+ s.add('platform', { size: [110, 84] });
37
+ s.add('box', { id: 'dock', center: [0, 0, 0], size: [52, 38, 4], r: 4, chamfer: 1 });
38
+ halo(s, 'glow', [-21, -14, 4.2], [42, 28], 6); // bloom of light, hidden until a beat shows it
39
+ s.add('box', { id: 'card', center: [0, 0, 4], size: [34, 22, 2], r: 2, chamfer: 0.6 });
40
+ const tl = s.timeline({ repeat: -1 });
41
+ tl.to('card', { z: 30 }, { duration: 1 }, 0)
42
+ .set('card', { material: 'lit', glow: true }, 1.8).to('glow', { opacity: 1 }, { duration: 0.4 }, 1.8)
43
+ .set('card', { material: undefined, glow: false }, 3.6).to('glow', { opacity: 0 }, { duration: 0.4 }, 3.6)
44
+ .to('card', { z: 0 }, { duration: 1 }, 3.6)
45
+ .wait(cycle - 4.6);
46
+ narrate(tl, ctx, list, ['lift · the card leaves its dock', 'lit · it carries the signal', 'land · back on the dock']);
47
+ return { scene: s, posterTime: 2.4 };
48
+ },
49
+ };
50
+ ```
51
+
52
+ A loop may also carry `css`, scoped under `[data-loop="<id>"]` like a figure's.
53
+
54
+ | Helper | |
55
+ |---|---|
56
+ | `loopScene(host, aria, posterTime, opts?)` | `Iso.scene` with `theme: 'inherit'`, `autoplay: false`, `reducedMotion: 'static'`, `restTime: posterTime`; installs the glow filters. |
57
+ | `beats([[name, seconds], …])` | Lays beats end to end → `{ list, cycle }`. |
58
+ | `narrate(tl, ctx, list, says)` | Calls `ctx.beat(i, total, name)` and `ctx.say(text)` from the timeline, so captions follow seek, loop and pause exactly. |
59
+ | `ride(s, id, home, cycle, legs, ease?)` | Carries a node along paths at set moments of the cycle, resting between legs (`s.travel` loops without rests). |
60
+ | `halo(s, id, at, size, r?)` / `halo(id, at, size, r?)` | A bloom of accent light behind a lit object; add it just before the object. |
61
+ | `DELAY`, `smooth` | The story's start after the entrance (1.2 s, cycle time 0 for `ride`); the default in-out ease. |
62
+
63
+ ## Hosting a loop
64
+
65
+ The page decides when a loop plays. Mark the host `data-loop="<id>"` (scope for its css, and the accent mapping from
66
+ `figure.css`), mount it paused on its poster, and play it only while it is visible:
67
+
68
+ ```ts
69
+ host.dataset.loop = loop.id;
70
+ let inView = false, userPaused = false; // before mount: mounting already narrates the poster beat
71
+ const { scene, posterTime } = loop.mount(host, {
72
+ say: t => { caption.textContent = t; },
73
+ beat: (i, n, name) => { counter.textContent = `${String(i + 1).padStart(2, '0')} / ${String(n).padStart(2, '0')} · ${name}`; },
74
+ });
75
+ scene.pause(); scene.seek(posterTime);
76
+ const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
77
+ const sync = () => (inView && !userPaused && !reduced && !document.hidden ? scene.play() : scene.pause());
78
+ new IntersectionObserver(([e]) => { inView = !!e && e.intersectionRatio >= 0.25; sync(); }, { threshold: [0, 0.25] }).observe(host);
79
+ document.addEventListener('visibilitychange', sync);
80
+ host.addEventListener('click', () => { userPaused = !userPaused; sync(); }); // plus Space/Enter when focused
81
+ ```
82
+
83
+ - Play only while at least a quarter of it is on screen and the page is in front.
84
+ - Pause on click or tap, and on Space/Enter when focused (moving content longer than 5 s needs a pause control). A
85
+ paused loop holds its frame and says so in the caption.
86
+ - Reduced motion: the poster, static.
87
+ - The caption row is `aria-live="off"`; the host's `aria-label` tells the whole story.
88
+
89
+ ## Building the story
90
+
91
+ - `autoplay: false` scenes stay still until something calls `play()`; tests must call it too.
92
+ - **One lit moment per beat**: `material: 'lit'` + `glow: true` on a small object (a key, a card, a slab's label). A
93
+ large surface stays glass with a halo behind it, never a flat accent slab.
94
+ - Make the thing the product acts on the hero (the letter, not the mail app's chrome) and show the moment of action
95
+ physically (a reply travelling into a lit tray, an undo window as a draining track of segments).
96
+ - On a card a third of a page wide, on-object text under ~8 world units is unreadable: label only the 3-6 parts that
97
+ matter, in large type, and let the caption say the rest. The object spans most of the card.
98
+ - Moves with rests between them: tween progress along an `Iso.path` inside the timeline (`path.at(u)`), or `ride`.
99
+ - Don't `set()` resting objects every frame: it forces a redraw and stalls pages with several loops on screen.
100
+ - Cylinder top faces (`topFace`) are centre-origin, unlike box faces.
101
+ - At most one entrance and two ambient loops (`float`, `blink`, `pulse`) on top of the story.
102
+
103
+ ## Exploded layers (a technique)
104
+
105
+ For an interface or a system, show it as stacked slabs: the `stack` prefab (`layers: [{ label, icon, material }]`,
106
+ `gap` 14-20) or chamfered boxes, one per real component, in the product's order (data at the bottom, what the person
107
+ sees on top). Labels engraved on the slab tops (`plane: 'top'`) or callouts at the side, 1-3 words; a dashed ghost
108
+ footprint under the stack; orthogonal routes with rounded corners (`diagram` edges or `connector`s) with packets
109
+ showing who talks to whom. Beats lift or light one layer at a time, with a caption saying what it does, and end on the
110
+ whole stack with the packets flowing.
111
+
112
+ ## Timing
113
+
114
+ - A beat lasts long enough to see the change and read the caption: about 0.9 s + 55 ms per caption character, at least
115
+ 1.6 s. Transitions 0.3-0.8 s, eased; the rest of the beat holds.
116
+ - A loop runs 8-24 s. A longer story becomes two loops.
117
+ - An exported GIF or video is one full cycle.
118
+
119
+ ## Verify
120
+
121
+ 1. Seek the scene to each beat (`scene.pause(); scene.seek(t)`) and screenshot: every beat is a complete, readable
122
+ state; moving parts pass in front of and behind things correctly.
123
+ 2. Play a full cycle and read the caption sequence back.
124
+ 3. Reduced motion shows the poster; a click pauses; the console is clean.
125
+ 4. No text leaves its surface at any beat. Face text fits automatically; give free `text` nodes a `max`.
126
+ 5. Would someone who knows the subject recognise what it is doing without the caption?
@@ -0,0 +1,103 @@
1
+ # Prefab catalogue
2
+
3
+ Every prefab is placed with `at: [x, y, z]` = the centre of its footprint at its base, and `rot`
4
+ (degrees around z; 90° steps keep faces readable). `facing: 'right'` = `rot: -90` (fronts face +x).
5
+ All prefabs also take the common node options (`id`, `class`, `material`, `color`, `glow`, `layer` …).
6
+ Sizes are world units; the defaults are proportioned to sit together on one platform.
7
+
8
+ List them at runtime: `Object.keys(Iso.prefabs)`. Add your own with `Iso.define` (bottom of this page).
9
+
10
+ ## Ground and scenery
11
+
12
+ | Prefab | Options | Notes |
13
+ |---|---|---|
14
+ | `platform` | `size:[w,d]` (240×180), `h` 10, `r` 12, `chamfer` 3, `inset` 10 (inner hairline, 0 = none), `grid` (step), `screws`, `label` (text along the front-left edge), `labelRight`, `labelSize` | Top surface at z = 0. The base of every diorama. |
15
+ | `tree` | `kind:'tiered'\|'pine'\|'cone'\|'round'\|'bush'\|'lollipop'`, `r` 6, `h` 20, `scale`, `tiers` | `tiered` matches the reference look (stacked discs). |
16
+ | `forest` | `count`, `ring:[ri, ro]` or `size:[w,d]`, `spacing`, `seed`, `kinds:[…]`, `minScale`, `maxScale`, `avoid(x,y)`, `treeClass` | Flat group: each tree sorts on its own. Trees get class `tree`. |
17
+ | `plant` | `r` 5, `h` 8, `leaves` 4, `seed` | Pot + foliage. |
18
+ | `lamp` | `h` 46, `on` (default true) | Bulb has class `lamp-bulb`. |
19
+ | `bench` | `w` 30 | |
20
+ | `car` | `length` 22, `w` 11 | Faces +x; use `rot` or `travel(…, {orient:true})`. |
21
+ | `solar` | `w` 22, `d` 14 | Dark panel on a post; tile them in a grid. |
22
+ | `pin` | `h` 18, `r` 5, `lit`, `shadow` | Map marker. |
23
+ | `zone` | `size:[w,d]`, `r`, `label`, `dash` '4 4', `fill`, `z` | Dashed region on the floor. |
24
+ | `plaque` | `text`, `size` 6, `w`, `d`, `h` | Small plate lying flat with text. |
25
+ | `desk` | `size:[w,d]` (90×46), `h` 34 | Put objects on it at `z: h`. |
26
+
27
+ ## Devices
28
+
29
+ | Prefab | Options | Notes |
30
+ |---|---|---|
31
+ | `phone` | `w` 13, `h` 27, `t` 1.6, `screen:'ui'\|'dots'\|'lit'\|'mark'\|'off'`, `stand`, `lying` | Screen faces +y. |
32
+ | `card` | `w` 16, `d` 10, `t` 1.2, `lit` (true) | The default "lit moment": a glowing chip card. |
33
+ | `laptop` | `w` 40, `d` 28, `open` 105 (lid angle), `screen` | Screen faces +y. |
34
+ | `monitor` | `w` 48, `h` 30, `screen` | On a stand, faces +y. |
35
+ | `keyboard` | `w` 186, `d` 52, `h` 7 | Full keys (ids `<id>-key-<name>`) when `w ≥ 120`, a printed grid below. API: `press(name, down)`. |
36
+ | `deskComputer` | `onStatus(text, state)`, `logo` (SVG path data in a 9 × 9 box), `base` (true) | The reference Fig. 2 machine (≈276×228). API: `power(on?)`, `type(key)`, `press(key, down)`, `body`, `keyboard`, `screenNode`, `state`. CRT power-on animation built in. |
37
+ | `server` | `w` 28, `d` 34, `h` 64, `units` 6, `seed` | LEDs are panes with class `led` → `s.blink('.led', …)`. |
38
+ | `database` | `r` 16, `tiers` 3, `tierH` 8, `gap` 1.6 | Stacked discs. |
39
+ | `chip` | `size` 30, `pins` 6, `h` 3, `label`, `lit`, `die` (material) | |
40
+ | `router` | `w` 34, `d` 20, `h` 6 | Antennas; LEDs with class `led`. |
41
+
42
+ ## Architecture and diagrams
43
+
44
+ | Prefab | Options | Notes |
45
+ |---|---|---|
46
+ | `building` | `w` 40, `d` 32, `h` 60, `floors`, `windows:'grid'\|'bands'`, `lit` (fraction of lit windows), `seed`, `door`, `roof` (false = none), `antenna` | Window grids on both visible faces. |
47
+ | `tower` | `r` 14, `h` 50, `bands`, `ribs`, `cap` | Round building / silo. |
48
+ | `gate` | `w` 40, `h` 46, `t` 4, `axis:'x'\|'y'` | Two posts, a beam and a glass pane. `axis:'y'` spans along y (pane faces +x). |
49
+ | `conveyor` | `length` 120, `w` 18, `h` 8, `axis:'x'\|'y'`, `rollers`, `legs` (default when `h > 10`), `rails`, `belt`, `legSpacing` | Flat group: tall belts stand on legs with side rails, so boxes ride between the rails and sort correctly. API: `track(lift)` → a world path along the belt for `travel`. |
50
+ | `stack` | `layers:[{label, icon, material, color, glow}]` (bottom → top), `size:[w,d]`, `t` 6, `gap` 14, `labels:'callout'\|'face'`, `labelSide` | Layer boxes get class `layer` and ids `<id>-<i>`. |
51
+ | `block` | `size:[w,d,h]` (36×36×12), `icon` (name or SVG path), `iconSize`, `label` (front face), `labelSize`, `r`, `chamfer` | The diagram node. Icons: see below. |
52
+
53
+ ## Logistics
54
+
55
+ | Prefab | Options | Notes |
56
+ |---|---|---|
57
+ | `parcel` | `size:[w,d,h]` (16×13×11), `open` (flaps up, dark mouth), `label` (printed sticker on the front), `labelLit`, `material` ('paper'), `flapAngle` | API: `open(bool)`, `label(bool)` — switch state cheaply while it travels. |
58
+ | `pallet` | `size:[w,d]` (30×26), `load:[cols, rows, layers]`, `boxH`, `partial` (fraction missing on top), `seed` | Wooden pallet, optionally stacked with taped parcels. |
59
+ | `rack` | `size:[w,d]` (70×24), `h` 54, `levels` 3, `fill` 0.7, `seed` | Uprights, shelves and parcels (seeded). |
60
+ | `forklift` | `lift` (fork height), `load` | Faces +x. Drive it with `travel(…, { yoyo: true, ease: Iso.ease.inOutSine })` — it reverses without turning. |
61
+ | `truck` | `length` 90, `w` 40, `h` 44, `floor` 12, `open` (true), `text` | Box truck whose open rear faces +x: point a conveyor at it and fade boxes out at the door. |
62
+ | `scanner` | `axis` (belt direction), `w` 30 (clear width), `h` 38, `beamFrom` (belt height), `beamOpacity`, `glow` | Flat group: posts, housing and a lit beam (id `<id>-beam`, class `scan-beam`) that boxes pass through. |
63
+ | `tunnel` | `axis`, `length` 30, `w` 30, `h` 36, `roof` 7 | Flat group: a machine hood over a belt with a strip curtain at the exit and a status light (id `<id>-led`). |
64
+
65
+ `animation.md` ("Objects that change at stations") shows them working together: boxes change from open to taped to
66
+ labelled as they pass the stations, computed from their position along the path.
67
+
68
+ ## Builders
69
+
70
+ | Builder | |
71
+ |---|---|
72
+ | `tube` | Ring/hollow cylinder (see api.md). |
73
+ | `label` | Screen-facing callout with a leader line. |
74
+ | `diagram` | Nodes + edges + zones + packets (see diagrams.md). |
75
+
76
+ ## Icons
77
+
78
+ `Iso.ICONS` (24-unit grid, stroke): database, server, user, users, lock, cloud, bolt, globe, code,
79
+ terminal, cpu, mail, chart, gear, key, file, search, cart, shield, layers, queue, plug, spark, phone,
80
+ wifi, check, bell, play, box, card, pin, eye, clock, flow. Use by name in `block`/`stack`, or draw on
81
+ any face: `f.svg(Iso.icon('cloud'), { u: 6, v: 6, transform: 'scale(.6)' })`.
82
+
83
+ ## Defining your own
84
+
85
+ ```js
86
+ Iso.define('kiosk', (g, o) => {
87
+ const h = o.h ?? 40;
88
+ g.box({ center: [0, 0, 0], size: [16, 12, h], r: 2, chamfer: 1,
89
+ left: (f) => f.rect(2, 4, f.w - 4, 18, { r: 1.5, fill: 'f-screen', line: 'ln' }) });
90
+ g.cylinder({ at: [0, 0, h], r: 4, h: 3 });
91
+ return { flash() { this.scene.to(this, { z: 4 }, { duration: 0.15 }).then(() => this.scene.to(this, { z: 0 })); } };
92
+ }, { sort: 'auto' });
93
+
94
+ s.kiosk({ id: 'k1', at: [40, 20, 0], h: 44 });
95
+ s.get('k1').flash();
96
+ ```
97
+
98
+ - Build in local coordinates around the origin (footprint centre, z = 0 at the base).
99
+ - `sort: 'auto'` (default) depth-sorts the parts; `'none'` keeps the order you added them (back to front),
100
+ which is right for stacked parts (tree tiers) and for content drawn on faces.
101
+ - `flat: true` makes the parts sort individually in the parent (use for scatterings like `forest`).
102
+ - Methods you return are merged into the group; `this.scene` is available after the group is added.
103
+ An `onMount(scene)` method runs when the prefab joins a scene (register loops there).
@@ -0,0 +1,66 @@
1
+ # JSON scene spec
2
+
3
+ `Iso.render(spec, host)` builds a scene from plain data. Prefer it for figures without custom logic:
4
+ it is easy to generate, validate and diff, and it is exactly what the playground edits.
5
+
6
+ ```json
7
+ {
8
+ "theme": "dark",
9
+ "colors": { "accent": "#ff6a3d" },
10
+ "figure": { "index": "Fig. 5", "title": "Server room", "hint": "Hover a rack", "status": "healthy" },
11
+ "label": "Isometric server room with three racks",
12
+ "padding": 28,
13
+ "objects": [
14
+ { "type": "platform", "size": [300, 240], "label": "dc-1 · row b", "grid": 20 },
15
+ { "type": "server", "id": "rack-1", "at": [-90, -60, 0], "units": 7, "h": 70 },
16
+ { "type": "group", "id": "pair", "at": [60, 40, 0], "children": [
17
+ { "type": "box", "size": [20, 20, 10], "r": 3 },
18
+ { "type": "card", "at": [10, 10, 10] }
19
+ ] },
20
+ { "type": "connector", "from": [-90, -36], "to": [-50, 4], "route": "y", "flow": 12 },
21
+ { "type": "label", "at": [70, 20, 34], "text": "primary" }
22
+ ],
23
+ "animations": [
24
+ { "type": "assemble", "stagger": 0.08 },
25
+ { "type": "blink", "target": ".led", "period": 1.3, "stagger": 0.37 },
26
+ { "type": "travel", "target": ["packet-a"], "path": { "type": "line", "from": [-24, 20, 0], "to": [46, 20, 0] }, "duration": 2.4 },
27
+ { "type": "timeline", "repeat": -1, "steps": [
28
+ { "target": "rack-1", "to": { "z": 6 }, "duration": 0.4 },
29
+ { "target": "rack-1", "to": { "z": 0 }, "duration": 0.4, "wait": 1 }
30
+ ] }
31
+ ],
32
+ "interactions": [
33
+ { "target": ["rack-1"], "hover": "lift", "z": 5, "label": "Rack one" },
34
+ { "target": "pc", "click": "power" },
35
+ { "target": "lamp", "click": "toggle", "onMaterial": "lit", "status": { "on": "lamp on", "off": "lamp off" } }
36
+ ]
37
+ }
38
+ ```
39
+
40
+ ## Top level
41
+
42
+ Any scene option (`theme`, `colors`, `figure`, `label`, `padding`, `extend`, `aspect`, `zoom`, `angle`, …)
43
+ plus `objects`, `animations`, `interactions`. `host` may be given here or as the second argument.
44
+
45
+ ## objects
46
+
47
+ Each item: `{ "type": <primitive | prefab | builder | "group">, …options }`. Groups take `children`.
48
+ Options are exactly those of the JS API (`api.md`, `prefabs.md`). Functions (face drawers, `avoid`)
49
+ are not available in JSON — switch to JS for those.
50
+
51
+ ## animations
52
+
53
+ `type`: `assemble`, `float`, `pulse`, `blink`, `spin`, `travel`, `orbit`, `drawOn`, `typewriter`,
54
+ `timeline`. `target` uses the usual target syntax (id, `.class`, `prefix*`, array).
55
+ `path` (for `travel`): `{type: 'circle', center, r, start, ccw}` · `{type: 'line', from, to}` ·
56
+ `{type: 'rect', at, size, r}` · `{type: 'arc', center, r, from, to}` · `{type: 'hop', from, to, height}` ·
57
+ `{type: 'polyline', points, radius, closed}` · or an array of points.
58
+ `timeline`: `repeat`, `yoyo`, `delay`, `repeatDelay`, `steps: [{ target, to | from | from+to | set, duration, ease, at, wait, stagger }]`.
59
+
60
+ ## interactions
61
+
62
+ `{ target, hover: 'lift', z, label, click: 'power' | 'toggle' | { to: {…}, duration } , onMaterial, offMaterial, status: {on, off} }`.
63
+
64
+ ## Validating
65
+
66
+ Open the page in a browser and read the console: unknown types or animations print a warning.