Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
motion names: say a move by its everyday name, slow motion and freeze frames, true lens zoom and dolly zoom, sound that leads the cut
Alex Greenshpun282d19f90176
diff --git a/plugins/anidoodle/skills/anidoodle/SKILL.md b/plugins/anidoodle/skills/anidoodle/SKILL.mdindex b465b34..f893180 100644--- a/plugins/anidoodle/skills/anidoodle/SKILL.md+++ b/plugins/anidoodle/skills/anidoodle/SKILL.md@@ -102,8 +102,8 @@ draws itself declares `kind: "drawing"` and is judged on a finer floor; a freeze`engine/` is the portable art core plus the tooling. `engine/src/canvas-core` knows nothingabout the DOM or any backend. `W`, `H`, `fps` and `durationFrames` come from the film's `meta`.-Camera moves (pans, zooms, parallax, shake): `engine/src/canvas-core/camera.ts`, `references/camera.md`.-Seams between scenes: `references/motion-grammar.md` (cuts that carry motion: `seams.ts`; `tools/deck.mjs deal` deals each film different moves). `render.mjs --blur auto` renders with motion blur (subframes per frame+Camera moves (pans, dollies, lens and dolly zooms, parallax, shake) and slow motion or freeze frames (`timeRemap.ts`): `engine/src/canvas-core/camera.ts`, `references/camera.md`.+Seams between scenes: `references/motion-grammar.md` (cuts that carry motion: `seams.ts`; `tools/deck.mjs deal` deals each film different moves; `deck.mjs find "<name>"` turns a move's everyday name into its card). `render.mjs --blur auto` renders with motion blur (subframes per framefrom its measured on-screen speed, averaged in linear light, `--shutter 180`); the default path is untouched.```bashdiff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/camera.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/camera.tsindex 0fad116..97d2f29 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/camera.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/camera.ts@@ -4,7 +4,12 @@// same state, so a caption pinned to the frame and the world it floats over can never disagree.//// CRAFT, and why the numbers work this way:-// - ZOOM IS INTERPOLATED IN log2. A zoom is a ratio: halving the apparent size twice should take+// - THE `zoom` KEY IS A DOLLY, THE `lens` KEY IS A ZOOM. `zoom` sets how close the camera stands+// (distance D = 1/zoom), so moving it changes parallax: near planes grow faster than far ones.+// `lens` is the focal length, a factor on every plane at once about the frame's centre: a true+// lens zoom magnifies without changing the depth relationships at all. Moving both against each+// other is the dolly zoom (dollyZoom below): the hero plane holds its size while depth stretches.+// - DOLLY AND LENS ARE INTERPOLATED IN log2. Each is a ratio: halving the apparent size twice should take// twice as long as halving it once. Easing the zoom value itself makes a long push-in sprint at// the near end and crawl at the far one; easing log2(zoom) spends time evenly per stop.// - EASING PER SEGMENT, ease-in-out by default. A camera move with no live operator should@@ -24,7 +29,9 @@// about the frame's centre, which is what actually sells handheld.import { fractal, Gfx, P } from "./core";-export type Cam = { look: P; zoom: number }; // look: world point at the frame's centre; zoom: screen px per world unit on the hero plane+// look: world point at the frame's centre; zoom: the dolly, screen px per world unit on the hero plane+// at lens 1; lens: the focal length as a factor (default 1), scaling every plane equally+export type Cam = { look: P; zoom: number; lens?: number };export type EaseName = "linear" | "in" | "out" | "inout";export const EASE: Record<EaseName, (u: number) => number> = {linear: (u) => u,@@ -32,7 +39,7 @@ export const EASE: Record<EaseName, (u: number) => number> = {out: (u) => 1 - Math.pow(1 - u, 3),inout: (u) => (u < 0.5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2), // easeInOutCubic: the camera default};-export type CamKey = { f: number; look?: P; zoom?: number; ease?: EaseName }; // ease governs the segment this key LEAVES+export type CamKey = { f: number; look?: P; zoom?: number; lens?: number; ease?: EaseName }; // ease governs the segment this key LEAVESexport type Shake = { from: number; to: number; amp: number; seed: number; freq?: number; rot?: number; attack?: number };// Monotone cubic (Fritsch-Carlson): a smooth path through every key that never overshoots into a@@ -61,8 +68,11 @@ const clampF = (v: number, a: number, b: number) => Math.max(a, Math.min(b, v));// ---- explicit-state helpers, for films that hold their own Cam per frame. The Camera class// below delegates to these; there is one math, whether the film keys the camera or computes it.// The dolly model: camera distance D = 1/zoom from the hero plane (z = 0); a plane at depth z-// scales by 1/(D + z) and moves with it. Positive z recedes; negative z crosses the lens.-export const planeScale = (c: Cam, z = 0): number => 1 / (1 / c.zoom + z);+// scales by lens/(D + z) and moves with it. Positive z recedes; negative z crosses the lens.+// The lens multiplies every plane by the same factor, so it never changes parallax; the dolly does.+export const planeScale = (c: Cam, z = 0): number => (c.lens ?? 1) / (1 / c.zoom + z);+// how many screen px one world unit on the hero plane covers: the dolly times the lens+export const heroScale = (c: Cam): number => planeScale(c, 0);export const projectCam = (centre: P, c: Cam, z: number, p: P, rot = 0): P => {const k = planeScale(c, z), co = Math.cos(rot), si = Math.sin(rot), dx = p[0] - c.look[0], dy = p[1] - c.look[1];return [centre[0] + k * (co * dx - si * dy), centre[1] + k * (si * dx + co * dy)];@@ -71,9 +81,20 @@ export const unprojectCam = (centre: P, c: Cam, z: number, s: P, rot = 0): P =>const k = planeScale(c, z), co = Math.cos(rot), si = Math.sin(rot), dx = (s[0] - centre[0]) / k, dy = (s[1] - centre[1]) / k;return [c.look[0] + co * dx + si * dy, c.look[1] - si * dx + co * dy];};-// ink authored at some view reads zoom times heavier at a close one; divide stroke widths by-// this. 0.35, not 1: a little weight gain is what makes a close-up feel close, not enlarged.-export const strokeWeight = (c: Cam, exp = 0.35): number => Math.pow(c.zoom, exp);+// ink authored at some view reads its screen scale times heavier at a close one (dolly or lens);+// divide stroke widths by this. 0.35, not 1: a little weight gain is what makes a close-up feel+// close, not enlarged.+export const strokeWeight = (c: Cam, exp = 0.35): number => Math.pow(heroScale(c), exp);++// THE DOLLY ZOOM. Wrap any camera path (keys via cam.at, or your own function): the dolly moves as+// authored and the lens is solved on every frame so the hero plane keeps one screen scale. Dolly in+// and the background falls away behind a subject who does not change size; dolly out and it looms.+// hold: the hero-plane scale to keep, or { at } to keep the scale the path has at that frame.+export const dollyZoom = (path: (f: number) => Cam, opts: { hold?: number; at?: number } = {}): ((f: number) => Cam) => {+ const hold = opts.hold ?? heroScale(path(opts.at ?? 0)); // the path's own lens counts here; after this the lens is solved+ if (!(hold > 0) || !Number.isFinite(hold)) throw new Error(`dollyZoom: the scale to hold must be a positive number (got ${hold})`);+ return (f) => { const c = path(f); if (!(c.zoom > 0)) throw new Error(`dollyZoom: zoom must be positive (got ${c.zoom} at frame ${f})`); return { look: c.look, zoom: c.zoom, lens: hold / c.zoom }; };+};export class Camera {private shakes: Shake[] = [];@@ -91,17 +112,18 @@ export class Camera {for (const k of this.keys) {if (!Number.isInteger(k.f) || k.f < 0) throw new Error(`camera key at non-integral or negative frame ${k.f}`);if (k.f <= last) throw new Error(`camera keys must increase: ${last} then ${k.f}`);- if (k.zoom !== undefined && k.zoom <= 0) throw new Error(`camera zoom must be positive, got ${k.zoom} at frame ${k.f}`);+ if (k.zoom !== undefined && !(k.zoom > 0)) throw new Error(`camera zoom must be positive, got ${k.zoom} at frame ${k.f}`);+ if (k.lens !== undefined && !(k.lens > 0 && Number.isFinite(k.lens))) throw new Error(`camera lens must be a positive number, got ${k.lens} at frame ${k.f}`);last = k.f;}}// one channel of the keys, eased per segment. Missing values hold the nearest given one, so a// key may set only look or only zoom.- private channel(f: number, get: (k: CamKey) => number | undefined, log2: boolean): number {+ private channel(f: number, get: (k: CamKey) => number | undefined, log2: boolean, mono = log2): number {const ks = this.keys.map((k, i) => ({ k, v: get(k), i })).filter((e) => e.v !== undefined) as { k: CamKey; v: number; i: number }[];if (!ks.length) throw new Error("camera keys never set this channel");- if (log2 && this.monoZoom && ks.length > 1) return (this.zoomPath ??= monoPath(ks.map((e) => [e.k.f, e.v] as const), { log2: true }))(f);+ if (mono && this.monoZoom && ks.length > 1) return (this.zoomPath ??= monoPath(ks.map((e) => [e.k.f, e.v] as const), { log2: true }))(f);if (f <= ks[0].k.f) return ks[0].v;if (f >= ks[ks.length - 1].k.f) return ks[ks.length - 1].v;let i = 0; while (f >= ks[i + 1].k.f) i++;@@ -110,10 +132,13 @@ export class Camera {return a.v + (b.v - a.v) * e;}- // the clean move at frame f, before shake. Pure.+ // the clean move at frame f, before shake. Pure. A camera whose keys never set lens returns no+ // lens (it is 1); one that sets it anywhere eases it in log2 like the dolly, per segment.at(f: number): Cam {if (this.path) return this.path(f);- return { look: [this.channel(f, (k) => k.look?.[0], false), this.channel(f, (k) => k.look?.[1], false)], zoom: this.channel(f, (k) => k.zoom, true) };+ const c: Cam = { look: [this.channel(f, (k) => k.look?.[0], false), this.channel(f, (k) => k.look?.[1], false)], zoom: this.channel(f, (k) => k.zoom, true) };+ if (this.keys.some((k) => k.lens !== undefined)) c.lens = this.channel(f, (k) => k.lens, true, false);+ return c;}// register an impact or a handheld stretch. amp in SCREEN px; rot in radians at full strength.@@ -141,11 +166,11 @@ export class Camera {// the move the audience sees: the clean path with its shake folded in. A screen-space nudge of// [dx, dy] is the camera's look point stepping BACK by that much, in world units.shaken(f: number): Cam & { rot: number } {- const c = this.at(f), [dx, dy, dr] = this.shakeAt(f), k = c.zoom;- return { look: [c.look[0] - dx / k, c.look[1] - dy / k], zoom: c.zoom, rot: dr };+ const c = this.at(f), [dx, dy, dr] = this.shakeAt(f), k = heroScale(c);+ return { ...c, look: [c.look[0] - dx / k, c.look[1] - dy / k], rot: dr };}- // plane scale at depth z for a camera state: the hero plane (z = 0) scales by zoom exactly.+ // plane scale at depth z for a camera state: the hero plane (z = 0) scales by zoom x lens exactly.scaleAt(c: Cam, z = 0): number { return planeScale(c, z); }// stroke-weight compensation for a close shot (see strokeWeight above)diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/timeRemap.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/timeRemap.tsnew file mode 100644index 0000000..1bfcf99--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/timeRemap.ts@@ -0,0 +1,102 @@+// TIME REMAP. Speed ramps, slow motion and freeze frames as one pure map from the film's frame to+// the scene's frame: draw the scene at remap.at(f) instead of f. Nothing else changes, so the+// determinism contract holds by construction (the scene is still a pure function of a number).+//+// const t = timeRemap([+// { f: 90, speed: 0.3, ramp: 8 }, // ease down into slow motion before the peak+// { f: 120, speed: 0, keepsMoving: "the name writes itself" }, // a freeze: the world stops, one thing does not+// { f: 156, speed: 1, ramp: 12 }, // ease back to real time+// ]);+// scene(g, t.at(f)); // the remapped world+// name(g, f); // what keeps moving through the freeze stays on the film's own frame+//+// CRAFT, and why it works this way:+// - SPEED IS WHAT YOU KEY, TIME IS ITS INTEGRAL. A key sets the speed from its frame on (scene+// frames per film frame); scene time is the area under that speed, worked out exactly. So time+// never jumps, never runs backwards, and every position in the scene stays continuous.+// - A RAMP EASES THE SPEED, NOT THE TIME. With a ramp the speed glides from the old value to the new+// one over that many frames on a smoothstep, so it is continuous too and starts and ends with no+// kick: a body in flight slows the way a camera slows it, not the way a cut does. ramp: 0 is a+// hard change of speed, for a deliberate snap.+// - A FREEZE MUST KEEP SOMETHING MOVING. A speed of 0 is refused unless the key says, in words, what+// keeps moving on the film's own frame (a name being written, the camera creeping in, dust still+// settling). A frozen frame with nothing moving is dead air, and the gate would fail the film.+// - SCORE AND SOUND STAY ON REAL TIME. The remap never touches audio: music is cued by film frame,+// and so are effects. To land a sound on a remapped event, find the film frame that shows it with+// filmFrameOf(sceneFrame). A slowed world under a score at its own tempo is the effect.+// Every function here is arithmetic over (frame, keys): no clock, no state, any order.++export type TimeKey = {+ f: number; // the film frame this speed starts from (whole, increasing)+ speed: number; // scene frames per film frame from here on: 1 real time, 0.25 slow motion, 0 a freeze, 2 fast+ ramp?: number; // frames over which the speed glides from the old value to this one (default 0, a hard change)+ curve?: "smooth" | "linear"; // the glide's shape: smoothstep (default; no kick at either end) or a straight line+ keepsMoving?: string; // required when speed is 0: what still moves, on the film's frame, through the freeze+};+export type Freeze = { from: number; to: number; keepsMoving: string }; // film frames [from, to); to is Infinity if never released+export type TimeRemap = {+ /** The scene frame shown on film frame f (fractional in slow motion: the scene must draw between its frames). */+ at: (f: number) => number;+ /** Scene frames per film frame at f. */+ speedAt: (f: number) => number;+ /** The first whole film frame that shows scene frame t: where a sound for a scene event is cued. */+ filmFrameOf: (t: number) => number;+ /** Every stretch where the scene stands still, with what keeps moving through it. */+ freezes: Freeze[];+};++// the glide's shape e(u) and its integral from 0 to u, so time under a ramp is exact+const CURVES = {+ smooth: { e: (u: number) => u * u * (3 - 2 * u), area: (u: number) => u * u * u - (u * u * u * u) / 2 },+ linear: { e: (u: number) => u, area: (u: number) => (u * u) / 2 },+} as const;++type Seg = { f: number; from: number; to: number; ramp: number; curve: (typeof CURVES)["smooth"]; t0: number };++export const timeRemap = (keys: readonly TimeKey[]): TimeRemap => {+ let last = -1, prevSpeed = 1;+ const segs: Seg[] = [], freezes: Freeze[] = [];+ for (const [i, k] of keys.entries()) {+ if (!Number.isInteger(k.f) || k.f < 0) throw new Error(`timeRemap: key ${i} is at frame ${k.f}; keys sit on whole film frames from 0`);+ if (k.f <= last) throw new Error(`timeRemap: keys must increase (${last} then ${k.f})`);+ if (!Number.isFinite(k.speed) || k.speed < 0) throw new Error(`timeRemap: speed at frame ${k.f} must be a number of 0 or more (got ${k.speed}); time never runs backwards`);+ const ramp = k.ramp ?? 0, curve = k.curve ?? "smooth", next = keys[i + 1]?.f;+ if (!Number.isFinite(ramp) || ramp < 0) throw new Error(`timeRemap: ramp at frame ${k.f} must be 0 or more frames (got ${ramp})`);+ if (!(curve in CURVES)) throw new Error(`timeRemap: curve at frame ${k.f} is "smooth" or "linear" (got ${curve})`);+ if (next !== undefined && k.f + ramp > next) throw new Error(`timeRemap: the ramp from frame ${k.f} runs ${ramp} frames, past the next key at ${next}`);+ if (k.speed === 0 && !(typeof k.keepsMoving === "string" && k.keepsMoving.trim())) throw new Error(`timeRemap: the freeze at frame ${k.f} must say what keeps moving (keepsMoving), or it is dead air`);+ // scene time at this key: the previous segment's area up to here+ const t = segs.length ? sceneAt(segs[segs.length - 1], k.f) : k.f;+ segs.push({ f: k.f, from: prevSpeed, to: k.speed, ramp, curve: CURVES[curve], t0: t });+ if (k.speed === 0) freezes.push({ from: k.f + ramp, to: next ?? Infinity, keepsMoving: k.keepsMoving!.trim() });+ prevSpeed = k.speed; last = k.f;+ }+ const segAt = (f: number): Seg | undefined => { let s: Seg | undefined; for (const x of segs) { if (x.f <= f) s = x; else break; } return s; };+ const at = (f: number): number => { const s = segAt(f); return s ? sceneAt(s, f) : f; };+ const speedAt = (f: number): number => {+ const s = segAt(f); if (!s) return 1;+ const x = f - s.f; return s.ramp > 0 && x < s.ramp ? s.from + (s.to - s.from) * s.curve.e(x / s.ramp) : s.to;+ };+ const filmFrameOf = (target: number): number => {+ if (!Number.isFinite(target)) throw new Error(`filmFrameOf: scene frame must be a number (got ${target})`);+ const reached = (f: number) => at(f) >= target - 1e-9;+ let lo = Math.min(-1, Math.floor(target) - 1); // before the first key the scene runs at real time, so at(lo) = lo < target+ const tail = segs[segs.length - 1], start = tail ? tail.f + tail.ramp : 0;+ let hi = Math.max(1, Math.ceil(start), Math.ceil(target));+ if (!reached(hi)) {+ if (tail && tail.to === 0) throw new Error(`filmFrameOf: scene frame ${target} is never shown; the film stays frozen at scene frame ${at(hi).toFixed(2)}`);+ const rate = tail ? tail.to : 1; hi += Math.ceil((target - at(hi)) / rate) + 1;+ while (!reached(hi)) hi += Math.ceil(1 / rate) + 1; // guards rounding only+ }+ while (hi - lo > 1) { const mid = Math.floor((lo + hi) / 2); if (reached(mid)) hi = mid; else lo = mid; }+ return hi;+ };+ return { at, speedAt, filmFrameOf, freezes };+};++// scene time inside one segment: the area under its speed from the key to film frame f+const sceneAt = (s: Seg, f: number): number => {+ const x = f - s.f;+ if (s.ramp > 0 && x < s.ramp) return s.t0 + s.ramp * (s.from * (x / s.ramp) + (s.to - s.from) * s.curve.area(x / s.ramp));+ return s.t0 + s.ramp * (s.from + (s.to - s.from) * s.curve.area(1)) + s.to * (x - s.ramp);+};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/camera.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/camera.test.tsindex 230bcd9..c56cbd3 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/camera.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/camera.test.ts@@ -1,6 +1,6 @@// CAMERA TESTS. The engine camera (src/canvas-core/camera.ts) is pure arithmetic, so it is held to// exact numbers here, with no browser: node tools/test.mjs-import { Camera, EASE, monoPath, planeScale, projectCam, strokeWeight, unprojectCam, type Cam } from "../src/canvas-core/camera";+import { Camera, dollyZoom, EASE, heroScale, monoPath, planeScale, projectCam, strokeWeight, unprojectCam, type Cam } from "../src/canvas-core/camera";import { Gfx, type P } from "../src/canvas-core/core";export const name = "camera";@@ -67,7 +67,36 @@ export const run = (ok: (cond: boolean, label: string) => void) => {g.push(10, 20, 2, 0.3); g.push(5, 0, 1, 0); const T1 = T; g.pop(); g.pop();ok(near(T1[4], 10 + 2 * Math.cos(0.3) * 5) && near(T1[5], 20 + 2 * Math.sin(0.3) * 5), "nested push: child translation is rotated and scaled by the parent");- // 8. bad input is refused, loudly+ // 8. lens zoom is not a dolly: the lens scales every plane by one factor, the dolly changes parallax+ const base: Cam = { look: [0, 0], zoom: 1.5 }, lensed: Cam = { ...base, lens: 2 }, dollied: Cam = { look: [0, 0], zoom: 3 };+ ok(near(heroScale(lensed), 3) && near(heroScale(dollied), 3) && near(heroScale(base), 1.5), "hero-plane scale is dolly x lens (a lens of 2 and a dolly to 3 frame the hero the same)");+ ok([0.5, 1, 3, -0.2].every((z) => near(planeScale(lensed, z) / planeScale(base, z), 2)), "a lens zoom grows every depth by the same factor: the depth relationships do not change");+ ok(planeScale(dollied, 3) / planeScale(dollied, 0) < planeScale(base, 3) / planeScale(base, 0), "a dolly in to the same hero size shrinks the far plane relative to the hero: parallax changes");+ ok(near(strokeWeight(lensed), Math.pow(3, 0.35)), "stroke weight follows the screen scale, lens included");+ const lc = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 1 }, { f: 60, lens: 1 }, { f: 120, lens: 4 }]);+ ok(near(lc.at(90).lens!, 2) && near(lc.at(90).zoom, 1) && near(lc.at(0).lens!, 1), "lens keys ease in log2 like the dolly (midpoint of 1 -> 4 is 2) and hold before their first key");+ ok(JSON.stringify(Object.keys(cam.at(45))) === JSON.stringify(["look", "zoom"]), "a camera that never sets a lens answers exactly as before (no lens field)");+ lc.shake({ from: 0, to: 30, amp: 10, seed: 3 });+ let lensErr = 0, lensTrip = 0, shakePx = 0;+ for (const f of [5, 70, 100]) for (const z of [0, 1.5, -0.25]) {+ lc.begin(g, f, z); const [a, b, c, d, e, ff] = T; lc.end(g);+ for (const q of [[0, 0], [300, -120]] as P[]) { const s = lc.toScreen(q, f, z), m = [a * q[0] + c * q[1] + e, b * q[0] + d * q[1] + ff]; lensErr = Math.max(lensErr, Math.hypot(s[0] - m[0], s[1] - m[1])); const w = lc.toWorld(s, f, z); lensTrip = Math.max(lensTrip, Math.hypot(w[0] - q[0], w[1] - q[1])); }+ }+ { const sh = lc.shaken(5), cl = lc.at(5), [dx, dy] = lc.shakeAt(5); shakePx = Math.hypot((cl.look[0] - sh.look[0]) * heroScale(sh) - dx, (cl.look[1] - sh.look[1]) * heroScale(sh) - dy); }+ ok(lensErr < 1e-6 && lensTrip < 1e-6, "with a lens, begin() and toScreen() still agree and toWorld inverts them");+ ok(shakePx < 1e-9 && lc.shaken(70).lens !== undefined, "shake stays in screen px under a lens, and the shaken camera keeps its lens");++ // 9. the dolly zoom: the hero plane holds its size while the depth stretches+ const dolly = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 1 }, { f: 60, zoom: 3 }]), vz = dollyZoom((f) => dolly.at(f));+ ok([0, 15, 30, 45, 60].every((f) => near(heroScale(vz(f)), 1, 1e-12)), "dollyZoom holds the hero plane's screen scale on every frame");+ ok(planeScale(vz(60), 2) < planeScale(vz(0), 2) * 0.6, `dollying in, the far plane falls away behind the subject (${planeScale(vz(0), 2).toFixed(3)} -> ${planeScale(vz(60), 2).toFixed(3)})`);+ const out = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 2 }, { f: 60, zoom: 0.8 }]), vo = dollyZoom((f) => out.at(f), { at: 0 });+ ok(near(heroScale(vo(60)), 2) && planeScale(vo(60), 2) > planeScale(vo(0), 2), "dollying out, the hero holds and the background looms");+ ok(near(heroScale(dollyZoom((f) => dolly.at(f), { hold: 2.5 })(30)), 2.5), "hold sets the size to keep");+ const asPath = new Camera([540, 540], [], { path: vz });+ ok(near(heroScale(asPath.shaken(40)), 1) && asPath.toScreen([0, 0], 40)[0] === 540, "a dolly zoom drives a Camera as a path, with shake and projections intact");++ // 10. bad input is refused, loudlyconst throws = (fn: () => unknown) => { try { fn(); return false; } catch { return true; } };ok(throws(() => new Camera([0, 0], [{ f: 5, zoom: 1 }, { f: 5, zoom: 2 }])), "rejects duplicate key frames");ok(throws(() => new Camera([0, 0], [{ f: 1.5, zoom: 1 }])), "rejects a fractional key frame");@@ -75,4 +104,6 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(throws(() => new Camera([0, 0], [])), "rejects a camera with neither keys nor path");ok(throws(() => cam.shake({ from: 10, to: 10, amp: 1, seed: 1 })), "rejects an empty shake window");ok(throws(() => monoPath([[0, 1], [0, 2]])), "monoPath rejects non-increasing keys");+ ok(throws(() => new Camera([0, 0], [{ f: 0, zoom: 1, lens: 0 }])) && throws(() => new Camera([0, 0], [{ f: 0, zoom: 1, lens: NaN }])) && throws(() => new Camera([0, 0], [{ f: 0, zoom: NaN }])), "rejects a lens <= 0, or a lens or zoom that is not a number");+ ok(throws(() => dollyZoom((f) => dolly.at(f), { hold: 0 })) && throws(() => dollyZoom(() => ({ look: [0, 0], zoom: 0 }))), "dollyZoom refuses a size of 0 to hold, or a dolly at zoom 0");};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/timeRemap.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/timeRemap.test.tsnew file mode 100644index 0000000..3c997ca--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/test/timeRemap.test.ts@@ -0,0 +1,60 @@+// TIME REMAP TESTS. src/canvas-core/timeRemap.ts is arithmetic, so its claims (time is continuous and+// never runs backwards, a ramp has no kick, a freeze says what keeps moving, a sound can be cued on a+// remapped event) are held to numbers here. node tools/test.mjs timeRemap+import { timeRemap, type TimeKey } from "../src/canvas-core/timeRemap";++export const name = "timeRemap";+export const run = (ok: (cond: boolean, label: string) => void) => {+ const near = (a: number, b: number, eps = 1e-9) => Math.abs(a - b) <= eps;+ const throws = (fn: () => unknown) => { try { fn(); return false; } catch { return true; } };++ // 1. no keys is real time; a key at speed 1 changes nothing+ const id = timeRemap([]);+ ok([-5, 0, 0.5, 37, 900].every((f) => id.at(f) === f && id.speedAt(f) === 1), "no keys: scene frame = film frame, speed 1");+ ok([0, 12, 300].every((f) => timeRemap([{ f: 10, speed: 1 }]).at(f) === f), "a key at speed 1 is real time");++ // 2. exact numbers: a hard change to slow motion, then a smooth ramp back+ const slow = timeRemap([{ f: 30, speed: 0.25 }, { f: 70, speed: 1, ramp: 10 }]);+ ok(near(slow.at(30), 30) && near(slow.at(70), 40) && near(slow.at(50), 35), "speed 0.25 from frame 30: 40 film frames show 10 scene frames");+ ok(near(slow.at(80), 40 + 10 * (0.25 + 1) / 2) && near(slow.at(100), 46.25 + 20), "a ramp covers the mean of its two speeds, then real time resumes");+ ok(near(slow.speedAt(75), 0.25 + 0.75 * 0.5) && near(slow.speedAt(70), 0.25) && near(slow.speedAt(80), 1), "the speed glides from 0.25 to 1 over the ramp, half way at its middle");++ // 3. a full ramp-freeze-release: continuous, never backwards, speed continuous, no kick at the ramp ends+ const keys: TimeKey[] = [{ f: 60, speed: 0.3, ramp: 8 }, { f: 90, speed: 0, ramp: 4, keepsMoving: "the name writes itself" }, { f: 126, speed: 1, ramp: 12 }];+ const t = timeRemap(keys);+ let back = false, jump = 0, sjump = 0;+ for (let f = -10; f <= 300; f += 0.125) { const a = t.at(f), b = t.at(f + 0.125); if (b < a - 1e-12) back = true; jump = Math.max(jump, b - a); sjump = Math.max(sjump, Math.abs(t.speedAt(f + 0.125) - t.speedAt(f))); }+ ok(!back, "scene time never runs backwards");+ ok(jump <= 0.125 + 1e-9, `scene time never jumps (largest step ${jump.toFixed(4)} for 0.125 film frames, at most real time here)`);+ ok(sjump < 0.1, `the speed never steps on a smooth ramp (largest change ${sjump.toFixed(4)} per eighth of a frame)`);+ const e = 1e-4, kick = (f: number) => Math.abs(t.speedAt(f + e) - t.speedAt(f)) / e;+ ok([60, 68, 90, 94, 126, 138].every((f) => kick(f) < 1e-2), "smoothstep ramps start and end with no kick (speed flat at both ends)");+ ok(t.freezes.length === 1 && t.freezes[0].from === 94 && t.freezes[0].to === 126 && t.freezes[0].keepsMoving === "the name writes itself", "the freeze is listed from where the speed reaches 0 to the next key, with what keeps moving");+ ok([94, 100, 110.5, 125.99].every((f) => near(t.at(f), t.at(94))), "inside the freeze the scene stands still");+ ok(t.at(127) > t.at(126), "it releases at the next key");++ // 4. a linear ramp covers the same area as a smooth one; fast motion runs ahead of real time+ const lin = timeRemap([{ f: 0, speed: 0.5, ramp: 10, curve: "linear" }]), smo = timeRemap([{ f: 0, speed: 0.5, ramp: 10 }]);+ ok(near(lin.at(10), smo.at(10)) && near(lin.at(10), 7.5) && near(lin.speedAt(2.5), 0.875), "linear and smooth ramps cover the same area by their end; linear glides in a straight line");+ ok(near(timeRemap([{ f: 20, speed: 2 }]).at(50), 80), "speed 2 shows two scene frames per film frame");++ // 5. cueing a sound on a remapped event: the first film frame that shows it+ for (const target of [10, 61.3, 75, t.at(94), t.at(94) + 0.5, 140, 400]) {+ const f = t.filmFrameOf(target);+ ok(Number.isInteger(f) && t.at(f) >= target - 1e-9 && t.at(f - 1) < target, `scene frame ${target.toFixed(2)} is first shown on film frame ${f}`);+ }+ ok(t.filmFrameOf(t.at(100)) <= 94, "an event at the frozen moment is cued where the freeze begins, not later");+ ok(throws(() => timeRemap([{ f: 10, speed: 0, keepsMoving: "camera creeps" }]).filmFrameOf(50)), "a scene frame past a freeze that never releases is never shown, and says so");+ ok(timeRemap([{ f: 0, speed: 0.01 }]).filmFrameOf(5) === 500, "a very slow remap still finds its frame");++ // 6. pure: the same keys give the same numbers in any order of asking+ const a = timeRemap(keys), b = timeRemap(keys), order1 = [200, 5, 100, 61].map((f) => a.at(f)), order2 = [61, 100, 5, 200].map((f) => b.at(f)).reverse();+ ok(JSON.stringify(order1) === JSON.stringify(order2), "the same keys answer the same, whatever order frames are asked in");++ // 7. bad input is refused, loudly+ ok(throws(() => timeRemap([{ f: 30, speed: 0 }])) && throws(() => timeRemap([{ f: 30, speed: 0, keepsMoving: " " }])), "a freeze that does not say what keeps moving is refused (dead air)");+ ok(throws(() => timeRemap([{ f: 30, speed: -1 }])) && throws(() => timeRemap([{ f: 30, speed: NaN }])), "a negative or non-number speed is refused: time never runs backwards");+ ok(throws(() => timeRemap([{ f: 30, speed: 1 }, { f: 30, speed: 2 }])) && throws(() => timeRemap([{ f: 3.5, speed: 1 }])) && throws(() => timeRemap([{ f: -1, speed: 1 }])), "keys on repeated, fractional or negative frames are refused");+ ok(throws(() => timeRemap([{ f: 30, speed: 0.5, ramp: 20 }, { f: 40, speed: 1 }])) && throws(() => timeRemap([{ f: 30, speed: 0.5, ramp: -2 }])), "a ramp that runs past the next key, or a negative ramp, is refused");+ ok(throws(() => timeRemap([{ f: 30, speed: 0.5, curve: "bounce" as "smooth" }])), "an unknown ramp curve is refused");+};diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjsindex c48481f..fcf3e89 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/deck.mjs@@ -7,6 +7,7 @@// node tools/deck.mjs deal --kind story --energy high --seconds 27 [--seed 7] [--avoid id,id] [--json]// node tools/deck.mjs deal --cat seam --n 3 --kind launch # three seams only// node tools/deck.mjs list [--cat camera] # every card, one line each+// node tools/deck.mjs find "whip pan" [--json] # an everyday name -> its card, engine call, or why we refuse it// node tools/deck.mjs test # the deck and the dealer hold their own rules// Weights: role (workhorse 3, accent 2, signature 1) x energy fit (same 1, "any" 0.7, other 0.25).// A deal has one opening, one close, at most one signature card, and no card twice.@@ -39,6 +40,35 @@ export const deal = ({ kind, energy, seconds = 20, seed = 1, n, cat, avoid = []return picked.sort((a, b) => CATS.indexOf(a.cat) - CATS.indexOf(b.cat));};+// FIND. People ask for a move by the name they know ("a whip pan", "do the Vertigo thing"). Each card's+// aka, the deck's calls and its refused names hold those names; find routes the words to what anidoodle+// builds, or to the reason it will not and what it makes instead, so nothing is improvised from a word.+const STOP = new Set(["a", "an", "the", "please", "do", "make", "me", "some", "use", "add", "like", "effect", "shot", "move", "thing"]);+export const norm = (x) => ` ${String(x).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim()} `;+const entries = () => [+ ...DECK.moves.map((m) => ({ kind: "card", id: m.id, names: [m.id, ...(m.aka ?? [])], item: m })),+ ...(DECK.calls ?? []).map((c) => ({ kind: "call", id: c.id, names: [c.id, ...c.aka], item: c })),+ ...(DECK.refused ?? []).map((r) => ({ kind: "refused", id: r.name, names: [r.name, ...r.aka], item: r })),+];+/** Every entry whose names match the words, best first: an exact name, a name inside the words, the words inside a name, then shared words. */+export const find = (query) => {+ const q = norm(query), words = q.trim().split(" ").filter((w) => w && !STOP.has(w)), out = [];+ if (!q.trim()) return out;+ for (const e of entries()) {+ let best = 0, via = "";+ for (const n of e.names) {+ const a = norm(n), aw = a.trim().split(" ");+ const score = a === q ? 100 : q.includes(a) ? 50 + aw.length : a.includes(q) ? 30 : words.length ? (10 * words.filter((w) => aw.includes(w)).length) / words.length : 0;+ if (score > best) { best = score; via = n; }+ }+ if (best >= 5) out.push({ kind: e.kind, id: e.id, score: best, via, item: e.item });+ }+ return out.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));+};+const showFound = (r) => r.kind === "card" ? `${card(r.item)}\n (matched "${r.via}")`+ : r.kind === "call" ? ` ${r.id} [engine call · ${r.item.where}]\n ${r.item.call}\n ${r.item.use}\n (matched "${r.via}")`+ : ` REFUSED: ${r.id} (matched "${r.via}")\n why: ${r.item.why}\n make instead: ${r.item.instead}`;+const card = (m) => ` ${m.id} [${m.cat} · ${m.role} · ${m.energy}]\n ${m.move}\n build: ${m.build}\n not when: ${m.not}`;const selfTest = () => {let fails = 0; const say = (ok, label) => { if (!ok) fails++; console.log(` ${ok ? "PASS" : "FAIL"} ${label}`); };@@ -50,9 +80,26 @@ const selfTest = () => {// every file a card cites exists: a card that points at nothing is a rumourconst have = new Set(); const walk = (d) => { for (const e of readdirSync(d, { withFileTypes: true })) { if (e.name === "node_modules" || e.name.startsWith(".")) continue; if (e.isDirectory()) walk(join(d, e.name)); else have.add(e.name); } };walk(join(ROOT, "references")); walk(join(ROOT, "engine", "src")); walk(join(ROOT, "engine", "tools"));- const cited = [...new Set(M.flatMap((m) => `${m.build} ${m.not} ${m.move}`.match(/[A-Za-z0-9-]+\.(?:ts|mjs|md)\b/g) ?? []))], missing = cited.filter((f) => !have.has(f));+ const cited = [...new Set([...M.map((m) => `${m.build} ${m.not} ${m.move}`), ...(DECK.calls ?? []).map((c) => `${c.where} ${c.call} ${c.use}`), ...(DECK.refused ?? []).map((r) => `${r.why} ${r.instead}`)].flatMap((t) => t.match(/[A-Za-z0-9-]+\.(?:ts|mjs|md)\b/g) ?? []))], missing = cited.filter((f) => !have.has(f));say(!missing.length, `all ${cited.length} files the cards cite exist${missing.length ? ` missing: ${missing.join(", ")}` : ""}`);say(!/\u2014/.test(JSON.stringify(DECK)), "no em dashes in the deck");+ // names: every card has everyday names, every name leads to one place, and the common ones resolve+ const C = DECK.calls ?? [], R = DECK.refused ?? [];+ say(M.every((m) => Array.isArray(m.aka) && m.aka.length >= 1 && m.aka.every((a) => typeof a === "string" && a.trim())), "every card lists at least one everyday name (aka)");+ say(C.length >= 3 && C.every((c) => c.id && c.where && c.call && c.use && c.aka?.length) && R.length >= 6 && R.every((r) => r.name && r.why?.length > 20 && r.instead && r.aka?.length), "every engine call says where and how, every refused name says why and what to make instead");+ { const seen = new Map(), dup = []; for (const e of entries()) for (const n of new Set(e.names.map(norm))) { if (seen.has(n) && seen.get(n) !== e.id) dup.push(`${n.trim()} (${seen.get(n)}, ${e.id})`); seen.set(n, e.id); }+ say(!dup.length, `no name leads to two places${dup.length ? ` ${dup.slice(0, 4).join("; ")}` : ""}`); }+ { const grammar = readFileSync(join(ROOT, "references", "motion-grammar.md"), "utf8"), table = grammar.slice(grammar.indexOf("## Names we refuse")), missing = R.filter((r) => !table.includes(`| ${r.name} |`));+ say(grammar.includes("## Names we refuse") && !missing.length, `motion-grammar.md's "Names we refuse" table holds every refused name${missing.length ? ` missing: ${missing.map((r) => r.name).join(", ")}` : ""}`); }+ { const named = R.flatMap((r) => r.instead.match(/\b(?:open|seam|cam|reveal|type|act|emph|close|time)-[a-z-]+[a-z]/g) ?? []), bad = named.filter((id) => !ids.includes(id));+ say(named.length >= 6 && !bad.length, `every card a refused name points to exists (${named.length})${bad.length ? ` missing: ${bad.join(", ")}` : ""}`); }+ const ROUTES = [["whip pan", "cam-whip-to-rest"], ["mask reveal", "reveal-from-behind"], ["Vertigo", "cam-vertigo-realisation"], ["a dolly zoom", "cam-vertigo-realisation"], ["the vertigo effect", "cam-vertigo-realisation"],+ ["speed ramp", "time-ramp-at-peak"], ["slow-mo", "time-ramp-at-peak"], ["freeze frame", "time-freeze-and-name"], ["J-cut", "seam-sound-leads"], ["l cut", "seam-sound-leads"], ["rack focus", "cam-rack-of-attention"],+ ["pop-in", "act-settle"], ["count-up", "reveal-count-during"], ["zoom in", "call-lens"], ["crash zoom", "call-lens"], ["dolly in", "cam-slow-push"], ["circle wipe", "call-iris"], ["smash cut", "call-flash-cut"],+ ["typewriter", "call-typewriter"], ["can you do a whip pan to the cat", "cam-whip-to-rest"], ["glitch", "glitch"], ["Lens Flare", "lens flare"], ["fade in", "fade-in"], ["crossfade", "cross dissolve"], ["confetti", "particle burst"], ["shine", "light sweep"]];+ const wrong = ROUTES.filter(([q, id]) => find(q)[0]?.id !== id).map(([q, id]) => `"${q}" -> ${find(q)[0]?.id ?? "nothing"} (want ${id})`);+ say(!wrong.length, `${ROUTES.length} everyday names resolve to the right card, call or refusal${wrong.length ? ` ${wrong.join("; ")}` : ""}`);+ say(find("zzqx plorb").length === 0 && find(" ").length === 0, "a name nobody uses finds nothing, and says so");const key = (d) => d.map((m) => m.id).join(",");say(key(deal({ kind: "story", energy: "high", seconds: 27, seed: 7 })) === key(deal({ kind: "story", energy: "high", seconds: 27, seed: 7 })), "the same seed deals the same hand");say(new Set(Array.from({ length: 40 }, (_, s) => key(deal({ kind: "story", energy: "high", seconds: 27, seed: s + 1 })))).size >= 30, "forty seeds deal at least thirty different hands");@@ -91,5 +138,12 @@ if (isMain(import.meta.url)) {const seed = num("--seed", 0, true) ?? (Date.now() % 100000), o = { kind, energy, seconds: num("--seconds", 1) ?? 20, seed, n: num("--n", c ? 1 : 3, true), cat: c, avoid: (val("--avoid") ?? "").split(",").filter(Boolean) }, d = deal(o);if (args.includes("--json")) console.log(JSON.stringify({ ...o, cards: d }, null, 1));else { console.log(`DECK seed ${seed}${kind ? ` · ${kind}` : ""}${energy ? ` · ${energy}` : ""}${c ? ` · ${c} only` : ` · ${o.seconds} s`} · ${d.length} cards\n`); console.log(d.map(card).join("\n\n")); console.log(`\nKeep, adapt or drop each card, and say why in the brief. To repeat this deal: --seed ${seed}. To deal the next film a different hand: --avoid ${d.map((m) => m.id).join(",")}`); }- } else die("usage: deck.mjs deal|list|test (see the header of this file)");+ } else if (cmd === "find") {+ const q = args.filter((a) => a !== "--json").join(" ").trim(); if (!q) die('find takes a name: deck.mjs find "whip pan"');+ const all = find(q), top = all[0], hits = all.filter((r) => r.score >= Math.max(5, (top?.score ?? 0) / 2)).slice(0, 5);+ if (args.includes("--json")) console.log(JSON.stringify({ query: q, found: hits.map(({ kind, id, via, item }) => ({ kind, id, via, ...item })) }, null, 1));+ else if (!hits.length) console.log(`FIND "${q}": no card, call or refused name goes by that. List the deck with deck.mjs list, or describe the move in plain words in the brief.`);+ else { console.log(`FIND "${q}" · ${hits.length} ${hits.length === 1 ? "match" : "matches"}, best first\n`); console.log(hits.map(showFound).join("\n\n")); console.log(`\nA card is a prompt, never an order: its numbers are the default unless the person named their own (workflows/start-here.md).`); }+ if (!hits.length) process.exit(1);+ } else die("usage: deck.mjs deal|list|find|test (see the header of this file)");}diff --git a/plugins/anidoodle/skills/anidoodle/references/camera.md b/plugins/anidoodle/skills/anidoodle/references/camera.mdindex c8620db..47aae14 100644--- a/plugins/anidoodle/skills/anidoodle/references/camera.md+++ b/plugins/anidoodle/skills/anidoodle/references/camera.md@@ -1,4 +1,4 @@-# The camera: one dolly, keyed on the frame grid+# The camera: one dolly and one lens, keyed on the frame grid`engine/src/canvas-core/camera.ts` is the camera. A film either draws in world coordinatesinside `begin()`/`end()` (the transform path: dirty boxes stay right because the camera rides@@ -21,32 +21,95 @@ const cam = new Camera([W / 2, H / 2], [cam.shake({ from: 96, to: 126, amp: 14, seed: 7, rot: 0.004 }); // an impact, ringing down```-- **Zoom is interpolated in log2.** A zoom is a ratio: halving the apparent size twice should- take twice as long as halving it once. Ease the zoom value itself and a long push-in sprints- at the near end and crawls at the far one; easing log2(zoom) spends time evenly per stop.+- **The `zoom` key is the dolly**: how close the camera stands (see Lens and dolly below). It is+ interpolated in log2, because it is a ratio: halving the apparent size twice should take twice+ as long as halving it once. Ease the value itself and a long push-in sprints at the near end+ and crawls at the far one; easing log2(zoom) spends time evenly per stop. A `lens` key eases+ the same way.- **Easing per segment, `inout` (easeInOutCubic) by default.** A camera move with no liveoperator should accelerate gently and arrive gently. `linear` reads as mechanical, `out`alone reads as interrupted, `in` alone as a fall.-- **A zoom path with several keys** breathes at every key under per-segment easing. Pass- `monoZoom: true` to run one monotone cubic through all the zoom keys in log2 instead: smooth,+- **A dolly path with several keys** breathes at every key under per-segment easing. Pass+ `monoZoom: true` to run one monotone cubic through all the `zoom` keys in log2 instead: smooth,never overshooting into a scale it was not given, never reversing.- **Authored paths**: for a camera that follows a creature or a curve, pass- `path: (f) => ({ look, zoom })` instead of keys. Same camera, same shake, same projections.+ `path: (f) => ({ look, zoom, lens? })` instead of keys. Same camera, same shake, same projections.## Depth planes (parallax)The camera sits at distance D = 1/zoom from the hero plane (z = 0). A plane at depth z scales-by `1/(D + z)` and moves with it: near planes swing wide, far ones barely stir, and every+by `lens/(D + z)` and moves with it: near planes swing wide, far ones barely stir, and everyelement at a depth agrees with every other, because there is only one camera. Positive zrecedes; a negative z crosses the lens (grass across the glass). Pass the plane's z to`begin(g, f, z)` or `toScreen(p, f, z)`. One dolly, one number, and the parallax is true forevery element at once: do not hand each plane its own drift.+## Lens and dolly++Two different moves make the subject bigger, and directors name them apart:++- **A dolly** moves the camera: the `zoom` key, distance D = 1/zoom. Near planes grow faster than+ far ones, so the depth changes as it goes. This is a push-in, a pull-back, a dolly in or out.+- **A lens zoom** changes the focal length with the camera standing still: the `lens` key+ (default 1). It multiplies every plane by the same factor about the frame's centre, so nothing+ shifts against anything else; the picture is magnified, flat. A crash zoom or punch-in is this.+ It reads as an operator's or a documentary's move, more noticed than a dolly. Use it when that+ is the voice; for travelling into a world, dolly.+- **A dolly zoom** does both against each other: the camera dollies while the lens is solved on+ every frame so the hero plane keeps its size, and the planes behind stretch away (dolly in) or+ loom (dolly out). The subject holds still in a world that has just changed shape: the moment of+ realisation (deck card `cam-vertigo-realisation`). It needs at least two planes behind the+ subject; with nothing behind it, it is only a zoom.++```ts+import { Camera, dollyZoom, heroScale } from "./camera";++const lensIn = new Camera(c, [{ f: 0, look, zoom: 1 }, { f: 40, lens: 1, ease: "out" }, { f: 52, lens: 2.2 }]); // a crash zoom+const dolly = new Camera(c, [{ f: 0, look, zoom: 1 }, { f: 60, zoom: 2.4 }]);+const vertigo = new Camera(c, [], { path: dollyZoom((f) => dolly.at(f)) }); // holds frame 0's hero scale+// dollyZoom(path, { hold: 1.5 }) holds a given scale; { at: 30 } holds the scale the path has at frame 30+```++`heroScale(cam)` is the hero plane's screen scale (dolly times lens), and `weight(cam)` follows+it, so a lens zoom thins the line just as a dolly does.++## Time: speed ramps, slow motion, freeze frames++`engine/src/canvas-core/timeRemap.ts` maps the film's frame to the scene's frame: draw the world at+`t.at(f)` instead of `f`. Speed is what you key and scene time is its exact integral, so time is+continuous, never runs backwards, and stays a pure function of the frame.++```ts+import { timeRemap } from "./timeRemap";++const t = timeRemap([+ { f: 84, speed: 0.3, ramp: 8 }, // ease into slow motion before the peak+ { f: 120, speed: 0, keepsMoving: "her name writes itself" }, // freeze: the world stops, the writing does not+ { f: 150, speed: 1, ramp: 14 }, // ease back to real time+]);+world(g, t.at(f)); // the remapped scene+name(g, f); // the writing, on the film's own frame+cues.push({ frame: t.filmFrameOf(LANDING), kind: "paper" }); // a sound on a remapped event+```++- **A ramp eases the speed**, on a smoothstep, so it starts and ends with no kick; `ramp: 0` is a+ deliberate hard change. A slowed scene is asked for frames between its frames, so it must+ draw at fractional time (motion is a function of time, never of a frame counter).+- **Score and sound stay on real time.** The score never slows; effects are cued by film frame.+ `filmFrameOf(sceneFrame)` gives the first film frame that shows a scene event, which is where+ its sound goes.+- **A freeze must keep something moving.** A `speed: 0` key without `keepsMoving` (in words)+ throws: a frozen frame with nothing moving is dead air, and the gate fails it. Drive the thing+ that moves (the name being written, the camera still creeping in) from the film's frame `f`.+ `t.freezes` lists each stop with what keeps moving.+- **Once a film for each.** One slow motion at the peak, one freeze on the telling pose (deck+ cards `time-ramp-at-peak`, `time-freeze-and-name`). The second halves the first.+## Shake`shake({ from, to, amp, seed, freq, rot, attack })` registers an impact or a handheld stretch:-- **amp in SCREEN pixels**, so the shake reads the same at any zoom; **rot** in radians at full+- **amp in SCREEN pixels**, so the shake reads the same at any dolly or lens; **rot** in radians at fullstrength, about the frame's centre. A small rotation is what actually sells handheld.- The envelope is an **attack ramp** (default 2 frames) into a **squared decay**: full strengthat the hit, gone a beat later. An impact rings down; it does not stop mid-air.@@ -59,9 +122,9 @@ every element at once: do not hand each plane its own drift.## Line weight at close range-Ink is authored at some view; at zoom S the same nib reads S times heavier. Divide stroke widths-by `weight(cam)` = S^0.35. Not S: a little weight gain is what makes a close-up feel close-rather than enlarged.+Ink is authored at some view; at a screen scale S (dolly times lens) the same nib reads S times+heavier. Divide stroke widths by `weight(cam)` = S^0.35. Not S: a little weight gain is what+makes a close-up feel close rather than enlarged.## The two drawing pathsdiff --git a/plugins/anidoodle/skills/anidoodle/references/motion-deck.json b/plugins/anidoodle/skills/anidoodle/references/motion-deck.jsonindex 0c5f196..67dce3d 100644--- a/plugins/anidoodle/skills/anidoodle/references/motion-deck.json+++ b/plugins/anidoodle/skills/anidoodle/references/motion-deck.json@@ -1,181 +1,231 @@{- "about": "The motion deck: moves this engine can already make, each with its numbers. Dealt by engine/tools/deck.mjs so two films do not reach for the same three. A dealt card is a prompt to consider, in the film's own subject and medium: keep it, adapt it, or drop it and say why. Times are seconds, distances are fractions of the frame's width, so every card holds at any size and frame rate.",+ "about": "The motion deck: moves this engine can already make, each with its numbers. Dealt by engine/tools/deck.mjs so two films do not reach for the same three. A dealt card is a prompt to consider, in the film's own subject and medium: keep it, adapt it, or drop it and say why. Times are seconds, distances are fractions of the frame's width, so every card holds at any size and frame rate. Each card's aka lists the everyday names people use for it; calls maps names to engine calls that are not cards; refused lists names anidoodle will not make, with the reason and what to make instead. deck.mjs find resolves a name against all three.","roles": { "workhorse": "carries a film quietly, safe to use twice", "accent": "noticed when it happens, once or twice", "signature": "can be the one move that is this film's own, used at the open, the middle and the close" },"moves": [- { "id": "open-mid-move", "cat": "open", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "open-mid-move", "cat": "open", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["start on the move", "moving open", "open on motion"],"move": "Frame 0 is already composed and already moving: the film opens partway into a camera move or an action, never on a still that then starts.","build": "A path camera whose move began before frame 0 (camera.ts, path: (f) => move(f + lead)), or a cycle opened at phase 0.3, so the first second has travel in it.","not": "A piece that draws itself: there the empty page is the opening." },- { "id": "open-iris-from-subject", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "launch", "explainer"],+ { "id": "open-iris-from-subject", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "launch", "explainer"], "aka": ["iris in", "iris open", "circle reveal"],"move": "The film opens through a round opening that grows from the thing it is about, 0.5 to 0.8 s, evenly in log space so it does not crawl then snap.","build": "iris(ctx, env, seam(f, 0, len), blank, scene, { center }) in transitions.ts; shape \"blot\" for an inked film.","not": "Centred on nothing. Or when the close also irises and a seam in the middle does: the third one is a preset." },- { "id": "open-detail-first", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "drawing"],+ { "id": "open-detail-first", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "drawing"], "aka": ["extreme close-up open", "macro open", "start on a detail"],"move": "Open so close on one detail (an eye, a hand, a nib) that the subject is not yet readable, then pull back over 1.5 to 3 s until it is.",- "build": "Camera keys from zoom 4 to 6 down to 1 with monoZoom: true; divide stroke widths by cam.weight(cam.at(f)) so the close-up reads close, not enlarged (camera.md).",+ "build": "A dolly back: Camera zoom keys from 4 to 6 down to 1 with monoZoom: true; divide stroke widths by cam.weight(cam.at(f)) so the close-up reads close, not enlarged (camera.md).","not": "A detail that was not drawn to be seen at that size. Check the first frame at --scale 2." },- { "id": "open-cold-action", "cat": "open", "role": "accent", "energy": "high", "kinds": ["story", "launch"],+ { "id": "open-cold-action", "cat": "open", "role": "accent", "energy": "high", "kinds": ["story", "launch"], "aka": ["cold open", "in medias res", "start in the action"],"move": "No establishing shot: the first frame is the middle of the action, and the wide shot comes second, as the answer to where we are.","build": "Order the shots action, then wide; the score enters on frame 0 with one sound that has a reason.","not": "A calm piece, or a subject the viewer cannot name from the close shot within a second." },- { "id": "seam-matched-cut", "cat": "seam", "role": "workhorse", "energy": "high", "kinds": ["any"],+ { "id": "seam-matched-cut", "cat": "seam", "role": "workhorse", "energy": "high", "kinds": ["any"], "aka": ["match on action", "hidden cut", "invisible cut", "motion match cut"],"move": "A hard cut hidden in travel. The outgoing shot accelerates over 0.2 to 0.4 s, its last frame is its fastest, the incoming shot opens at the same speed in the same direction and comes to rest over 0.8 to 1.4 s.","build": "matchedMove({ dir, exitDist, exitF, entryF }) in seams.ts, added to each scene's camera look; hold it with checkSeam. Render with --blur auto.","not": "Either shot has no room to travel, or the two travel different ways. Then both sides come to rest and it is a plain cut on a beat." },- { "id": "seam-flight-through", "cat": "seam", "role": "accent", "energy": "high", "kinds": ["story", "launch", "explainer"],+ { "id": "seam-flight-through", "cat": "seam", "role": "accent", "energy": "high", "kinds": ["story", "launch", "explainer"], "aka": ["zoom through", "zoom transition", "fly through", "push through"],"move": "The camera flies into the outgoing shot and comes out in the next: a push of about 1.2 over 0.2 s, the cut, then the incoming shot growing from about two thirds of its size to rest over 0.5 s.","build": "matchedZoom({ push, exitF, entryF }) in seams.ts multiplies each camera's zoom; the incoming scene must be painted wider than the frame, because it opens small.",- "not": "The thing flown into is not what the next shot is about. Then it is a zoom laid over a join." },- { "id": "seam-actor-carries", "cat": "seam", "role": "signature", "energy": "any", "kinds": ["any"],+ "not": "The thing flown into is not what the next shot is about. Then it is a push laid over a join." },+ { "id": "seam-actor-carries", "cat": "seam", "role": "signature", "energy": "any", "kinds": ["any"], "aka": ["persistent element", "carry-over", "object match", "hero object transition"],"move": "One object crosses the seam untouched while the world changes round it: same screen position, same size, same colour on the last frame of one scene and the first of the next.","build": "Drive it from one function of the absolute frame that both scenes call (relay in motif.ts); checkRelay holds the two sides to 2 px.","not": "The object has no reason to be in the second scene. A mascot that only watches is decoration." },- { "id": "seam-shape-becomes", "cat": "seam", "role": "signature", "energy": "medium", "kinds": ["any"],+ { "id": "seam-shape-becomes", "cat": "seam", "role": "signature", "energy": "medium", "kinds": ["any"], "aka": ["shape morph", "morph transition", "shape match", "shape tween"],"move": "A shape in the outgoing picture travels, stretches a little while moving, and becomes a shape of the next picture, landing on it exactly.","build": "handoff({ from, to, t0, t1 }) in morph.ts; coverShape when the target is the whole page; checkShapes at the landing.","not": "The two shapes share nothing the eye can follow (colour, edge, a rough outline). A morph between strangers is a wipe." },- { "id": "seam-pick-and-grow", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer", "story"],+ { "id": "seam-pick-and-grow", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer", "story"], "aka": ["expand to fullscreen", "card expand", "zoom into card", "selection zoom"],"move": "One item out of a set is chosen and grows until it is the next scene; the next scene's first frame is framed exactly like the item.","build": "A camera punch-in that does not come back (launchGallery.ts); frame the incoming scene's first frame from the card's box.","not": "The set was only built to be left." },- { "id": "seam-cover-from-inside", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "story", "explainer"],+ { "id": "seam-cover-from-inside", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "story", "explainer"], "aka": ["foreground wipe", "object wipe", "cover transition"],"move": "Something already in the scene grows until it covers the frame, and when it clears the next scene is there. The next scene is complete underneath on every frame.","build": "coverShape (morph.ts) on the scene's own shape, or the bloom in launchCut.ts; close it on the next picture's focal point.","not": "An arbitrary shape brought in to hide the join, or the third time in one film." },- { "id": "seam-brush", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["story", "drawing", "launch"],+ { "id": "seam-brush", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["story", "drawing", "launch"], "aka": ["wipe", "brush wipe", "paint wipe", "ink wipe"],"move": "A loaded brush is pulled across in the direction the story is already moving, wet ink running ahead of the new picture, 0.6 to 0.9 s.","build": "brushWipe(ctx, env, p, from, to, { angle, ink }) in transitions.ts.","not": "A clean, set register. Or more than twice." },- { "id": "seam-cut-on-beat", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "seam-cut-on-beat", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["cut on the beat", "match cut", "graphic match", "hard cut"],"move": "A plain hard cut with both sides at rest, on a strong beat, between two frames that match in one thing: a shape, a position, a direction of gaze.","build": "No call. Put the cut frame on the cue table's downbeat and check the pair as stills: one thing sits in the same place on both.","not": "Nothing matches, or the music has no beat there. Then use the gentle move." },- { "id": "seam-one-canvas", "cat": "seam", "role": "workhorse", "energy": "calm", "kinds": ["explainer", "launch", "story", "interactive"],+ { "id": "seam-one-canvas", "cat": "seam", "role": "workhorse", "energy": "calm", "kinds": ["explainer", "launch", "story", "interactive"], "aka": ["oner", "one take", "infinite canvas", "continuous shot"],"move": "The scenes sit side by side in one layout larger than the frame and the camera travels between them; the route says how they relate.","build": "One Camera for every plane (camera.ts); world-placed scenery so the view changes all the way (koiWorld.ts, webTour.ts).","not": "The places are unrelated, or the trip between two stops is long and empty." },- { "id": "seam-leave-as-arrived", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "seam-leave-as-arrived", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["exit animation", "animate out", "reverse entrance", "outro animation"],"move": "A thing leaves the way it came, mirrored in time and shorter: what arrived over 0.5 s on a settling curve leaves over 0.25 s on an accelerating one, along the same path.","build": "Run the entrance's own progress backwards through easeIn (seams.ts); if it was revealed from behind an edge it tucks back behind that edge where the edge is now.","not": "The exit is the point of the scene. Then it gets a move of its own." },+ { "id": "seam-sound-leads", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["J-cut", "L-cut", "sound bridge", "pre-lap", "audio lead", "split edit"],+ "move": "The sound crosses the cut ahead of the picture or behind it: the next scene is heard 0.3 to 0.8 s before it is seen (a J-cut), or the last scene is still heard 0.5 to 1.5 s into the next (an L-cut). The ear makes the join before the eye does.",+ "build": "Cue the incoming scene's first sound at CUT minus the lead in the SfxPlan (filmSfx cues are film frames), or let the outgoing scene's sound run past CUT with lengthS; the score can enter its next section a beat early (music/sound-design.md, Sound across a cut).",+ "not": "A hit or a contact: its sound belongs on its own frame, and one that trails its picture reads as lag." },- { "id": "cam-slow-push", "cat": "camera", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "cam-slow-push", "cat": "camera", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["slow push", "push in", "dolly in", "creep in", "Ken Burns"],"move": "A hold that is never still: the camera pushes in 3 to 6 percent over the whole shot, so a quiet shot still changes every second.","build": "Two Camera keys, zoom 1 to 1.04, ease \"linear\" for this one move only: an eased drift stops at both ends and the stop is the dead air.","not": "A shot with a lot of its own motion. Two moves at once fight." },- { "id": "cam-parallax-travel", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "explainer"],+ { "id": "cam-parallax-travel", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "explainer"], "aka": ["parallax", "truck shot", "lateral track", "multiplane", "parallax scroll"],"move": "The camera travels sideways and depth does the work: near things swing wide, far things barely stir, and something crosses the lens in front of the subject.","build": "One Camera, planes at z from -0.3 (across the glass) to 4 or more (camera.md, depth planes). Never a hand-set drift per layer.","not": "A flat style whose point is the flatness (a print, a diagram)." },- { "id": "cam-follow-with-lag", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "interactive"],+ { "id": "cam-follow-with-lag", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "interactive"], "aka": ["tracking shot", "follow cam", "follow shot", "chase cam"],"move": "The camera follows a moving subject a little late: the subject pulls ahead when it accelerates and the frame catches up when it slows, so speed is felt.","build": "A path camera: path: (f) => ({ look: subject(f - lag), zoom }) with lag of 0.1 to 0.2 s; lead room in front of the subject.","not": "The subject must stay pinned for a read (a face, a label)." },- { "id": "cam-impact-shake", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"],+ { "id": "cam-impact-shake", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"], "aka": ["camera shake", "screen shake", "impact shake", "shake on hit"],"move": "One impact rings through the frame: full strength on the hit, gone within a beat, with a little rotation.","build": "cam.shake({ from, to, amp, seed, rot }) in camera.ts; amp is screen px, 0.8 to 1.5 percent of the width.","not": "More than two a film, or on anything that is not a real contact." },- { "id": "cam-pull-back-reveal", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"],+ { "id": "cam-pull-back-reveal", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"], "aka": ["pull back", "pull out", "dolly out", "reveal shot", "crane up", "zoom out to reveal"],"move": "The camera pulls back and the thing we were looking at turns out to be a small part of something larger.",- "build": "Camera keys in log2 zoom, monoZoom: true, 1.5 to 3 s; the large thing is painted in the world from the start, never faded in at the end.",- "not": "The larger thing adds nothing to the story. Then it is only a zoom out." },- { "id": "cam-rack-of-attention", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"],+ "build": "A dolly out: Camera zoom keys (eased in log2), monoZoom: true, 1.5 to 3 s; the large thing is painted in the world from the start, never faded in at the end.",+ "not": "The larger thing adds nothing to the story. Then it is only a pull-back." },+ { "id": "cam-rack-of-attention", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"], "aka": ["rack focus", "focus pull", "pull focus", "shift focus"],"move": "Attention moves from one thing to another in the same frame without the camera moving: the first dims and softens its edges, the second gains contrast and line weight.","build": "Draw both from one emphasis value 0..1: stroke weight, saturation and value contrast (no ctx.filter, the contract forbids it).","not": "The two things are in different places in the story. That is a seam." },- { "id": "cam-whip-to-rest", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch"],+ { "id": "cam-whip-to-rest", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch"], "aka": ["whip pan", "swish pan", "flash pan", "whip"],"move": "A fast pan to a new subject inside one scene that decays to rest on it: the last third of the move is the slow part.","build": "Camera key with ease \"out\" over 0.4 to 0.7 s; keep the peak under speedCeiling(W, fps) (seams.ts) and render with --blur auto.","not": "Past the ceiling. Then cut on the beat instead." },+ { "id": "cam-vertigo-realisation", "cat": "camera", "role": "accent", "energy": "medium", "kinds": ["story", "explainer", "launch"], "aka": ["dolly zoom", "Vertigo", "vertigo effect", "zolly", "trombone shot", "Hitchcock zoom"],+ "move": "The moment of realisation: the subject keeps its size in the frame while the world behind it stretches away (or closes in), over 1 to 2.5 s, slow enough to be felt before it is noticed.",+ "build": "dollyZoom((f) => cam.at(f)) in camera.ts, used as a path camera, on a dolly of 1.6 to 3 times; the subject on the hero plane and at least two planes behind it at real depths (camera.md, Lens and dolly).",+ "not": "Fewer than two depth planes (with nothing behind the subject it is only a zoom), or a beat that is not a realisation. Once a film." },- { "id": "reveal-drawn-on", "cat": "reveal", "role": "signature", "energy": "any", "kinds": ["any"],+ { "id": "reveal-drawn-on", "cat": "reveal", "role": "signature", "energy": "any", "kinds": ["any"], "aka": ["line draw", "draw on", "stroke reveal", "self-drawing", "path animation", "timelapse", "speed paint"],"move": "The thing is drawn into the picture in the order a hand would make it, the tool visible, each stroke taking the time its length asks for.","build": "kind: \"drawing\" and the style plate's own draw order (workflows/drawing-process.md).","not": "A fade standing in for drawing. If it cannot be drawn on, it arrives some other honest way." },- { "id": "reveal-from-behind", "cat": "reveal", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "reveal-from-behind", "cat": "reveal", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["mask reveal", "masked rise", "reveal from below", "wipe reveal"],"move": "A thing comes out from behind something already in the picture (a hill, a card's edge, another figure), so the picture supplies the mask.","build": "Clip with the occluder's own outline (pathShape in morph.ts) and move the thing out from under it on a settling curve, 0.4 to 0.7 s.","not": "A mask in mid-air with nothing drawn where its edge is." },- { "id": "reveal-by-light", "cat": "reveal", "role": "accent", "energy": "calm", "kinds": ["story", "loop"],+ { "id": "reveal-by-light", "cat": "reveal", "role": "accent", "energy": "calm", "kinds": ["story", "loop"], "aka": ["light reveal", "lights on", "spotlight reveal"],"move": "The scene is there from the first frame but dark; light arrives (a door, a sun, a lamp) and the subject is found by it.","build": "Paint the lit and unlit values of every surface and mix them by distance from the light's edge as it moves.","not": "A style with no light in it (flat vector, a diagram)." },- { "id": "reveal-assemble", "cat": "reveal", "role": "accent", "energy": "medium", "kinds": ["explainer", "launch", "story"],+ { "id": "reveal-assemble", "cat": "reveal", "role": "accent", "energy": "medium", "kinds": ["explainer", "launch", "story"], "aka": ["build up", "assemble", "stack up", "pieces fly in"],"move": "Parts arrive from the back to the front, each held above the stack with a wide soft shadow that closes as it lands, 0.08 to 0.12 s apart.","build": "paperCraft.ts is the worked example; no more than about seven parts in flight at once.","not": "Parts that are not real parts of the subject." },- { "id": "reveal-count-during", "cat": "reveal", "role": "workhorse", "energy": "medium", "kinds": ["explainer", "launch", "infographic"],+ { "id": "reveal-count-during", "cat": "reveal", "role": "workhorse", "energy": "medium", "kinds": ["explainer", "launch", "infographic"], "aka": ["count-up", "count up", "number ticker", "counter", "rolling number"],"move": "A number changes while the thing it counts is changing, and stops on the frame the action stops. Never after.","build": "Drive the digits and the action from the same progress value (productUI.ts counts values this way).","not": "A figure that is not true of the data on screen." },- { "id": "type-written", "cat": "type", "role": "workhorse", "energy": "any", "kinds": ["launch", "explainer", "infographic"],+ { "id": "type-written", "cat": "type", "role": "workhorse", "energy": "any", "kinds": ["launch", "explainer", "infographic"], "aka": ["write on", "handwriting", "handwritten text", "signature animation"],"move": "A line is written by its tool, one stroke after another, at the speed of a hand, and holds long enough to be read twice.","build": "writeOn or sentence in kinetic.ts; on its own frame, or over a calm area where the frame would pass as a poster (workflows/launch-video.md, Type).","not": "Over a face, the focal detail or busy texture. In doubt the line gets its own frame." },- { "id": "type-one-line-at-a-time", "cat": "type", "role": "workhorse", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "type-one-line-at-a-time", "cat": "type", "role": "workhorse", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["line by line", "word by word", "kinetic typography", "kinetic type"],"move": "One line hands over to the next word by word, so there is never more than one full line on screen: the old line's words leave at twice the pace they came.","build": "sentence() in kinetic.ts for the arriving line; run the leaving line's word progress backwards at half the entry stagger; the new line's first word starts on a beat.","not": "Lines that must be compared. Those stay together." },- { "id": "type-names-the-thing", "cat": "type", "role": "accent", "energy": "calm", "kinds": ["explainer", "launch", "infographic"],+ { "id": "type-names-the-thing", "cat": "type", "role": "accent", "energy": "calm", "kinds": ["explainer", "launch", "infographic"], "aka": ["callout", "label", "annotation", "leader line"],"move": "A dot lands on one thing, a line is drawn out from it, a short label is written at its end; the dot follows the thing, the label holds still.","build": "drawCallout in callout.ts, pinned with cam.toScreen; one or two on screen.","not": "The picture is busy where the label would sit and a backing would cover something that matters." },- { "id": "type-label-becomes-heading", "cat": "type", "role": "signature", "energy": "medium", "kinds": ["explainer", "launch"],+ { "id": "type-label-becomes-heading", "cat": "type", "role": "signature", "energy": "medium", "kinds": ["explainer", "launch"], "aka": ["label to title", "text handoff", "title match"],"move": "A label on one scene travels across the seam and lands as the heading of the next, on that scene's first frame.","build": "A callout with handoff (callout.ts); the next scene draws it with drawLabel at the same pose; checkHandoff holds it to 2 px.","not": "The label's words are not what the next scene is about." },- { "id": "type-underline-then-point", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "type-underline-then-point", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["underline", "hand underline", "highlight word"],"move": "The one word that matters is underlined by hand after the line has landed, 0.25 s, on a beat. Underlined, never struck through.","build": "caption(..., \"underline\") in kinetic.ts, started when the line's progress reaches 1.","not": "More than one word a line, or more than twice a film." },+ { "id": "time-freeze-and-name", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["story", "explainer", "launch"], "aka": ["freeze frame", "freeze and name", "character intro freeze", "freeze title"],+ "move": "The world stops on a telling pose and a name or a word is written by hand beside it; the camera keeps creeping in while it is written, then time picks up exactly where it stopped.",+ "build": "A speed 0 key in timeRemap (timeRemap.ts) whose keepsMoving names the writing; writeOn in kinetic.ts and a slow push, both on the film's own frame; hold for as long as the word takes to write plus one beat to read it.",+ "not": "Nothing is written or moving during the stop (dead air, and timeRemap refuses it), or a calm film where a hard stop is a jolt." },- { "id": "act-anticipate", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop", "launch"],+ { "id": "act-anticipate", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop", "launch"], "aka": ["anticipation", "wind-up"],"move": "Before any large action the body goes the other way first: a crouch before a jump, a draw back before a throw, 0.15 to 0.3 s, a quarter of the action's size.","build": "A held pose keyed before the action and blended through (a rig's mix between poses); bones keep their length (anatomy.md).","not": "A machine, or a move meant to startle." },- { "id": "act-follow-through", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop"],+ { "id": "act-follow-through", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop"], "aka": ["follow-through", "overlapping action", "drag", "secondary motion"],"move": "Loose parts arrive late and go further: a tail, hair, a sleeve follow the body by 0.05 to 0.1 s a segment, each segment wider than the one before.","build": "Sample the driving angle at f - lag * i down the chain and scale its swing by 1 + 0.15 to 0.2 * i.","not": "A stiff material. Wood and metal do not whip." },- { "id": "act-settle", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "act-settle", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["overshoot", "settle", "pop-in", "spring settle", "back ease"],"move": "Nothing stops dead. A thing that lands goes a little past, comes back, and is at rest by 0.3 to 0.5 s; weight decides how far past.","build": "One overshoot of 4 to 8 percent then a decay on easeOut; heavier things overshoot less and take longer.","not": "Type meant to be read while it lands, and anything in a clean set register that should simply arrive." },- { "id": "act-head-stays", "cat": "acting", "role": "accent", "energy": "high", "kinds": ["story", "loop"],+ { "id": "act-head-stays", "cat": "acting", "role": "accent", "energy": "high", "kinds": ["story", "loop"], "aka": ["stable head", "head stabilisation", "level head"],"move": "In a run the body works hard and the head rides level: the eyes stay on one line while the spine folds and opens under them.","build": "Solve the neck last, to a head height that does not follow the body (hold the head to a few px through a stride).","not": "A bounce that is the joke (a toy, a rubber-hose character)." },- { "id": "act-blink-and-breathe", "cat": "acting", "role": "workhorse", "energy": "calm", "kinds": ["story", "loop", "launch"],+ { "id": "act-blink-and-breathe", "cat": "acting", "role": "workhorse", "energy": "calm", "kinds": ["story", "loop", "launch"], "aka": ["idle animation", "idle loop", "breathing", "blink"],"move": "A character at rest is alive: the chest rises over 3 to 4 s, a blink of 0.1 to 0.15 s every few seconds at uneven gaps, an ear or a tail answers a sound.","build": "Periodic over the loop length so the seam closes; blink times from rng(seed), never a fixed interval.","not": "A portrait whose stillness is the point." },- { "id": "emph-contact", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "loop", "launch"],+ { "id": "emph-contact", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "loop", "launch"], "aka": ["impact effect", "dust hit", "hit spark", "contact splash"],"move": "A contact is shown where it happens: dust, a splash or a compressed shadow on the frame of the hit, clearing over 0.4 to 0.8 s.","build": "Seeded particles born on the contact frame from the contact point; the sound effect cued to the same frame (music/sound-design.md).","not": "A touch with no force in it." },- { "id": "emph-world-answers", "cat": "emphasis", "role": "accent", "energy": "medium", "kinds": ["story", "loop"],+ { "id": "emph-world-answers", "cat": "emphasis", "role": "accent", "energy": "medium", "kinds": ["story", "loop"], "aka": ["secondary action", "reaction", "ripple effect", "wake"],"move": "The subject's action moves something else in the scene a moment later: grass bends in the wake, birds lift, water rings spread.","build": "Drive the secondary thing from the primary's position at f - delay, falling off with distance.","not": "A reaction that draws the eye off the subject at the moment that matters." },- { "id": "emph-hold-the-result", "cat": "emphasis", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "emph-hold-the-result", "cat": "emphasis", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["hold", "beat hold", "breather", "let it land"],"move": "After the biggest change in the film the result is held, alive but unbroken, for 1 to 2 s before anything else happens.","build": "A hold in the cue table after the payoff with only breathing motion in it (cam-slow-push, act-blink-and-breathe).","not": "A loop under 6 s, where the hold would be most of it." },+ { "id": "time-ramp-at-peak", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"], "aka": ["speed ramp", "slow motion", "slow-mo", "time ramp", "bullet time"],+ "move": "At the top of the action (the peak of a jump, the instant before contact) time slows and stays slow long enough to read the shape, then gathers back into real time. The score keeps its own tempo throughout.",+ "build": "timeRemap in timeRemap.ts: ease down over 0.2 to 0.35 s to a speed of 0.2 to 0.4, hold 0.5 to 1.2 s, ease back over 0.3 to 0.6 s; draw the scene at t.at(f) (it must draw between its frames) and cue the contact sound at t.filmFrameOf(contact) (camera.md, Time).",+ "not": "Nothing is in flight, or a second time in one film: the second slow motion halves the first." },- { "id": "close-returns-to-open", "cat": "close", "role": "signature", "energy": "any", "kinds": ["story", "loop", "launch"],+ { "id": "close-returns-to-open", "cat": "close", "role": "signature", "energy": "any", "kinds": ["story", "loop", "launch"], "aka": ["bookend", "full circle", "callback ending", "loop back"],"move": "The last frame is the first frame, earned: the film ends where it began and the viewer now knows what it means.","build": "Draw the closing shot from the opening shot's own function at the same frame; for a loop, verify-export.mjs --loop holds the last frame to frame 0.","not": "A film whose point is that things changed for good." },- { "id": "close-subtract", "cat": "close", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "close-subtract", "cat": "close", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["wind down", "quiet ending", "subtractive ending"],"move": "The ending takes things away: motion slows, parts leave, the music stops on a bar line, a breath of near silence, then one soft sound on the last picture.","build": "A section with fewer parts and no low drum, then one resolved note; music.mjs check prints the ARC line, which flags an ending that out-shouts the film.","not": "A sting of a few seconds, which is all ending." },- { "id": "close-mark-from-actor", "cat": "close", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "close-mark-from-actor", "cat": "close", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["logo reveal", "logo resolve", "end card", "logo sting"],"move": "The thing that travelled through the film lands as part of the mark, and the end card opens from it.","build": "handoff (morph.ts) from the actor's last shape to the mark's shape; the wordmark written after it lands (logo in kinetic.ts).","not": "A mark the actor does not resemble in any way." }+ ],+ "calls": [+ { "id": "call-iris", "where": "transitions.ts", "call": "iris(ctx, env, p, from, to, { center, shape })", "aka": ["iris", "iris out", "circle wipe", "circle transition", "mask transition"],+ "use": "A round opening from a point or closing to one; open it from what the next scene is about (motion-grammar.md, Three ready-made seams)." },+ { "id": "call-flash-cut", "where": "transitions.ts", "call": "flashCut(ctx, env, local, cut, from, to)", "aka": ["smash cut", "flash cut", "flash transition", "white flash"],+ "use": "A hard cut under a short burst of light, on a strong beat; declare the film's flashes to checkFlashes." },+ { "id": "call-lens", "where": "camera.ts", "call": "Camera keys with lens (a true lens zoom), or dollyZoom", "aka": ["zoom in", "zoom out", "lens zoom", "crash zoom", "punch in", "snap zoom"],+ "use": "A lens zoom magnifies every plane by one factor and changes no parallax; to move closer through the world, key the dolly (zoom) instead (camera.md, Lens and dolly)." },+ { "id": "call-handheld", "where": "camera.ts", "call": "cam.shake({ from, to, amp, seed, rot, freq }) over a long window", "aka": ["handheld", "handheld camera", "shaky cam", "camera wobble"],+ "use": "A long low shake with a little rotation and a low freq reads as a hand on the camera; keep amp small (camera.md, Shake)." },+ { "id": "call-motion-blur", "where": "render.mjs", "call": "node tools/render.mjs <film> --blur auto", "aka": ["motion blur", "motion trail", "shutter blur"],+ "use": "Subframes per frame from each frame's measured speed, averaged in linear light; the film's own code is untouched." },+ { "id": "call-typewriter", "where": "launchKit.ts", "call": "typedAt(text, f, times) and caretAt", "aka": ["typewriter", "typing effect", "type on", "typing text"],+ "use": "Characters appear on a typing cadence with a caret, one tick sound per character (music/sound-design.md)." }+ ],+ "refused": [+ { "name": "glitch", "aka": ["glitch", "datamosh", "RGB split", "chromatic aberration"],+ "why": "Colour split and torn pixels need ctx.filter or pixel tricks the contract forbids, and they read as a template effect.",+ "instead": "a cut on the beat (seam-cut-on-beat), or one shake on a real impact (cam-impact-shake)" },+ { "name": "light sweep", "aka": ["light sweep", "shine", "sheen", "glare sweep"],+ "why": "A shine sliding across chrome is a stock overlay; nothing in the picture casts it.",+ "instead": "reveal-by-light: the light belongs to the world and finds the subject" },+ { "name": "fade-in", "aka": ["fade in", "fade up", "fade in on scroll", "opacity fade"],+ "why": "Marks are made, not faded: a fade standing in for drawing is the first tell on the craft bar.",+ "instead": "reveal-drawn-on, reveal-from-behind or type-written" },+ { "name": "particle burst", "aka": ["particle burst", "particles", "confetti", "sparkle burst"],+ "why": "A burst on everything is decoration with no force behind it, so it is never a default.",+ "instead": "emph-contact: dust or a splash born on a real contact, from the contact point" },+ { "name": "cross dissolve", "aka": ["cross dissolve", "crossfade", "dissolve"],+ "why": "Two copies of one thing, each half there, read as a ghost.",+ "instead": "seam-shape-becomes or seam-actor-carries (move one object, change what it is mid-trip); between unrelated scenes, the gentle move" },+ { "name": "lens flare", "aka": ["lens flare", "light leak", "bokeh", "anamorphic flare"],+ "why": "Lens faults painted onto a drawing read as stock overlays, not as light.",+ "instead": "one named light in the scene (realism-and-craft.md), or reveal-by-light" }]}diff --git a/plugins/anidoodle/skills/anidoodle/references/motion-grammar.md b/plugins/anidoodle/skills/anidoodle/references/motion-grammar.mdindex 0703bcd..815009a 100644--- a/plugins/anidoodle/skills/anidoodle/references/motion-grammar.md+++ b/plugins/anidoodle/skills/anidoodle/references/motion-grammar.md@@ -178,6 +178,29 @@ A card is a prompt, never an order. Keep it, adapt it to this film's subject andit, and say which in the brief. The default at the top of this page still holds: a card whose"not when" applies is dropped, and the gentle move takes its place.+## Names people use++People ask for moves by the names they know: a whip pan, a mask reveal, a Vertigo shot, a J-cut.+`node tools/deck.mjs find "<name>"` routes the words to the card that builds it, to an engine call+that is not a card (an iris, a lens zoom, a typewriter), or to a refusal. Every card carries those+names in its `aka`. Run it before building anything named, so a word never turns into an+improvised effect; the card's numbers are the default unless the person gave their own+(`workflows/start-here.md`, When they name a move).++## Names we refuse++Some names ask for an effect that breaks the contract or the craft bar. Say so in one line and+offer the alternative; `deck.mjs find` prints the same reason.++| Name | Why not | Make instead |+|---|---|---|+| glitch | colour split and torn pixels need `ctx.filter` or pixel tricks the contract forbids | a cut on the beat, or one shake on a real impact |+| light sweep | a shine sliding over chrome that nothing in the picture casts | `reveal-by-light`: the light belongs to the world |+| fade-in | marks are made, not faded; the first tell on the craft bar | drawn on, revealed from behind, or written |+| particle burst | decoration with no force behind it, never a default | `emph-contact`: dust or splash born on a real contact |+| cross dissolve | two copies of one thing, each half there, read as a ghost | one object moving and changing mid-trip; the gentle move |+| lens flare | lens faults painted onto a drawing read as stock overlays | one named light in the scene, or `reveal-by-light` |+## Callouts and the label handoff`engine/src/canvas-core/callout.ts` names one thing in the picture: a dot lands on it, a leaderdiff --git a/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md b/plugins/anidoodle/skills/anidoodle/references/music/sound-design.mdindex b3cafc4..a8c9915 100644--- a/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md+++ b/plugins/anidoodle/skills/anidoodle/references/music/sound-design.md@@ -87,6 +87,20 @@ export const audio = filmSfx(filmAudio(score, 15), plan); // Film.audio: score- One master at the very end: a look-ahead true-peak ceiling at -1 dBTP (`ceilingDb`). The scorearrives already mastered, so nothing is renormalised.+## Sound across a cut (J-cut and L-cut)++The cheapest smooth seam works on the ear: the sound crosses the cut ahead of the picture or+behind it. In a **J-cut** the next scene is heard before it is seen, 0.3 to 0.8 s early (the+pond's bubbles under the last shot of the room, the nib scratching before the page appears). In an+**L-cut** the last scene is still heard 0.5 to 1.5 s into the next (a page still rustling, a pile+of bricks still settling). The ear makes the join first, so the picture cut lands as an answer. It+uses the same cue table: cue the incoming scene's sound at `CUT - lead` (`{ frame: CUT - 15, kind:+"bubble" }`), or let the outgoing one run past the cut with a longer `lengthS` or its own+tail. The score can do it too, entering its next section a beat before the cut+(a pre-lap), or letting the old chord ring over the first beat of the new scene. This never moves+a hit: a contact's sound stays on its own frame (Land on the frame, below). What crosses the cut+is a place's sound, never an event's. Deck card `seam-sound-leads`.+## Levels and the audibility ruleA cue nobody hears is a bug, not a subtle choice. A test that only checks a cue exists provesdiff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/start-here.md b/plugins/anidoodle/skills/anidoodle/references/workflows/start-here.mdindex a2894e4..fc951f4 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/start-here.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/start-here.md@@ -32,6 +32,19 @@ pick", pick, say what you picked and why in one line, and carry on.Stop asking the moment you can build. Two questions answered well beat six asked.+## When they name a move++When the person names a move ("a whip pan to the cat", "a slow-mo at the top of the jump"), look+the name up first: `node <skill>/engine/tools/deck.mjs find "<name>"` returns the card or engine+call that builds it, or the reason anidoodle refuses it and what it makes instead. Then record+the move in the brief in four parts: **name** (theirs, and the card id), **duration** (seconds),+**strength** (how far, how fast or how much: a distance as a share of the frame width, a speed,+an overshoot) and **what moves** (which element, camera or layer). Fill only what they said. For+every part they left open, the card's own numbers are the default, written down and marked as+defaults: "whip pan (cam-whip-to-rest) · 0.4 to 0.7 s, card default · peak under the speed+ceiling, card default · the camera, onto the cat, theirs". A vague ask becomes a spec someone can+check against the render.+## Defaults when they do not say| Open question | Default | Why |@@ -45,7 +58,8 @@ Stop asking the moment you can build. Two questions answered well beat six asked## Write it down before you drawOne short brief file in the project: kind, style (and why), shape(s), length, sound (style +-moods), characters, the one-sentence idea. Everything the person said goes in their words.+moods), characters, the one-sentence idea, and any named moves as name, duration, strength and+what moves (card defaults marked as such). Everything the person said goes in their words.Everything you decided is marked as yours so they can veto it in one line.## Before the first full renderdiff --git a/skills/anidoodle/SKILL.md b/skills/anidoodle/SKILL.mdindex b465b34..f893180 100644--- a/skills/anidoodle/SKILL.md+++ b/skills/anidoodle/SKILL.md@@ -102,8 +102,8 @@ draws itself declares `kind: "drawing"` and is judged on a finer floor; a freeze`engine/` is the portable art core plus the tooling. `engine/src/canvas-core` knows nothingabout the DOM or any backend. `W`, `H`, `fps` and `durationFrames` come from the film's `meta`.-Camera moves (pans, zooms, parallax, shake): `engine/src/canvas-core/camera.ts`, `references/camera.md`.-Seams between scenes: `references/motion-grammar.md` (cuts that carry motion: `seams.ts`; `tools/deck.mjs deal` deals each film different moves). `render.mjs --blur auto` renders with motion blur (subframes per frame+Camera moves (pans, dollies, lens and dolly zooms, parallax, shake) and slow motion or freeze frames (`timeRemap.ts`): `engine/src/canvas-core/camera.ts`, `references/camera.md`.+Seams between scenes: `references/motion-grammar.md` (cuts that carry motion: `seams.ts`; `tools/deck.mjs deal` deals each film different moves; `deck.mjs find "<name>"` turns a move's everyday name into its card). `render.mjs --blur auto` renders with motion blur (subframes per framefrom its measured on-screen speed, averaged in linear light, `--shutter 180`); the default path is untouched.```bashdiff --git a/skills/anidoodle/engine/src/canvas-core/camera.ts b/skills/anidoodle/engine/src/canvas-core/camera.tsindex 0fad116..97d2f29 100644--- a/skills/anidoodle/engine/src/canvas-core/camera.ts+++ b/skills/anidoodle/engine/src/canvas-core/camera.ts@@ -4,7 +4,12 @@// same state, so a caption pinned to the frame and the world it floats over can never disagree.//// CRAFT, and why the numbers work this way:-// - ZOOM IS INTERPOLATED IN log2. A zoom is a ratio: halving the apparent size twice should take+// - THE `zoom` KEY IS A DOLLY, THE `lens` KEY IS A ZOOM. `zoom` sets how close the camera stands+// (distance D = 1/zoom), so moving it changes parallax: near planes grow faster than far ones.+// `lens` is the focal length, a factor on every plane at once about the frame's centre: a true+// lens zoom magnifies without changing the depth relationships at all. Moving both against each+// other is the dolly zoom (dollyZoom below): the hero plane holds its size while depth stretches.+// - DOLLY AND LENS ARE INTERPOLATED IN log2. Each is a ratio: halving the apparent size twice should take// twice as long as halving it once. Easing the zoom value itself makes a long push-in sprint at// the near end and crawl at the far one; easing log2(zoom) spends time evenly per stop.// - EASING PER SEGMENT, ease-in-out by default. A camera move with no live operator should@@ -24,7 +29,9 @@// about the frame's centre, which is what actually sells handheld.import { fractal, Gfx, P } from "./core";-export type Cam = { look: P; zoom: number }; // look: world point at the frame's centre; zoom: screen px per world unit on the hero plane+// look: world point at the frame's centre; zoom: the dolly, screen px per world unit on the hero plane+// at lens 1; lens: the focal length as a factor (default 1), scaling every plane equally+export type Cam = { look: P; zoom: number; lens?: number };export type EaseName = "linear" | "in" | "out" | "inout";export const EASE: Record<EaseName, (u: number) => number> = {linear: (u) => u,@@ -32,7 +39,7 @@ export const EASE: Record<EaseName, (u: number) => number> = {out: (u) => 1 - Math.pow(1 - u, 3),inout: (u) => (u < 0.5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2), // easeInOutCubic: the camera default};-export type CamKey = { f: number; look?: P; zoom?: number; ease?: EaseName }; // ease governs the segment this key LEAVES+export type CamKey = { f: number; look?: P; zoom?: number; lens?: number; ease?: EaseName }; // ease governs the segment this key LEAVESexport type Shake = { from: number; to: number; amp: number; seed: number; freq?: number; rot?: number; attack?: number };// Monotone cubic (Fritsch-Carlson): a smooth path through every key that never overshoots into a@@ -61,8 +68,11 @@ const clampF = (v: number, a: number, b: number) => Math.max(a, Math.min(b, v));// ---- explicit-state helpers, for films that hold their own Cam per frame. The Camera class// below delegates to these; there is one math, whether the film keys the camera or computes it.// The dolly model: camera distance D = 1/zoom from the hero plane (z = 0); a plane at depth z-// scales by 1/(D + z) and moves with it. Positive z recedes; negative z crosses the lens.-export const planeScale = (c: Cam, z = 0): number => 1 / (1 / c.zoom + z);+// scales by lens/(D + z) and moves with it. Positive z recedes; negative z crosses the lens.+// The lens multiplies every plane by the same factor, so it never changes parallax; the dolly does.+export const planeScale = (c: Cam, z = 0): number => (c.lens ?? 1) / (1 / c.zoom + z);+// how many screen px one world unit on the hero plane covers: the dolly times the lens+export const heroScale = (c: Cam): number => planeScale(c, 0);export const projectCam = (centre: P, c: Cam, z: number, p: P, rot = 0): P => {const k = planeScale(c, z), co = Math.cos(rot), si = Math.sin(rot), dx = p[0] - c.look[0], dy = p[1] - c.look[1];return [centre[0] + k * (co * dx - si * dy), centre[1] + k * (si * dx + co * dy)];@@ -71,9 +81,20 @@ export const unprojectCam = (centre: P, c: Cam, z: number, s: P, rot = 0): P =>const k = planeScale(c, z), co = Math.cos(rot), si = Math.sin(rot), dx = (s[0] - centre[0]) / k, dy = (s[1] - centre[1]) / k;return [c.look[0] + co * dx + si * dy, c.look[1] - si * dx + co * dy];};-// ink authored at some view reads zoom times heavier at a close one; divide stroke widths by-// this. 0.35, not 1: a little weight gain is what makes a close-up feel close, not enlarged.-export const strokeWeight = (c: Cam, exp = 0.35): number => Math.pow(c.zoom, exp);+// ink authored at some view reads its screen scale times heavier at a close one (dolly or lens);+// divide stroke widths by this. 0.35, not 1: a little weight gain is what makes a close-up feel+// close, not enlarged.+export const strokeWeight = (c: Cam, exp = 0.35): number => Math.pow(heroScale(c), exp);++// THE DOLLY ZOOM. Wrap any camera path (keys via cam.at, or your own function): the dolly moves as+// authored and the lens is solved on every frame so the hero plane keeps one screen scale. Dolly in+// and the background falls away behind a subject who does not change size; dolly out and it looms.+// hold: the hero-plane scale to keep, or { at } to keep the scale the path has at that frame.+export const dollyZoom = (path: (f: number) => Cam, opts: { hold?: number; at?: number } = {}): ((f: number) => Cam) => {+ const hold = opts.hold ?? heroScale(path(opts.at ?? 0)); // the path's own lens counts here; after this the lens is solved+ if (!(hold > 0) || !Number.isFinite(hold)) throw new Error(`dollyZoom: the scale to hold must be a positive number (got ${hold})`);+ return (f) => { const c = path(f); if (!(c.zoom > 0)) throw new Error(`dollyZoom: zoom must be positive (got ${c.zoom} at frame ${f})`); return { look: c.look, zoom: c.zoom, lens: hold / c.zoom }; };+};export class Camera {private shakes: Shake[] = [];@@ -91,17 +112,18 @@ export class Camera {for (const k of this.keys) {if (!Number.isInteger(k.f) || k.f < 0) throw new Error(`camera key at non-integral or negative frame ${k.f}`);if (k.f <= last) throw new Error(`camera keys must increase: ${last} then ${k.f}`);- if (k.zoom !== undefined && k.zoom <= 0) throw new Error(`camera zoom must be positive, got ${k.zoom} at frame ${k.f}`);+ if (k.zoom !== undefined && !(k.zoom > 0)) throw new Error(`camera zoom must be positive, got ${k.zoom} at frame ${k.f}`);+ if (k.lens !== undefined && !(k.lens > 0 && Number.isFinite(k.lens))) throw new Error(`camera lens must be a positive number, got ${k.lens} at frame ${k.f}`);last = k.f;}}// one channel of the keys, eased per segment. Missing values hold the nearest given one, so a// key may set only look or only zoom.- private channel(f: number, get: (k: CamKey) => number | undefined, log2: boolean): number {+ private channel(f: number, get: (k: CamKey) => number | undefined, log2: boolean, mono = log2): number {const ks = this.keys.map((k, i) => ({ k, v: get(k), i })).filter((e) => e.v !== undefined) as { k: CamKey; v: number; i: number }[];if (!ks.length) throw new Error("camera keys never set this channel");- if (log2 && this.monoZoom && ks.length > 1) return (this.zoomPath ??= monoPath(ks.map((e) => [e.k.f, e.v] as const), { log2: true }))(f);+ if (mono && this.monoZoom && ks.length > 1) return (this.zoomPath ??= monoPath(ks.map((e) => [e.k.f, e.v] as const), { log2: true }))(f);if (f <= ks[0].k.f) return ks[0].v;if (f >= ks[ks.length - 1].k.f) return ks[ks.length - 1].v;let i = 0; while (f >= ks[i + 1].k.f) i++;@@ -110,10 +132,13 @@ export class Camera {return a.v + (b.v - a.v) * e;}- // the clean move at frame f, before shake. Pure.+ // the clean move at frame f, before shake. Pure. A camera whose keys never set lens returns no+ // lens (it is 1); one that sets it anywhere eases it in log2 like the dolly, per segment.at(f: number): Cam {if (this.path) return this.path(f);- return { look: [this.channel(f, (k) => k.look?.[0], false), this.channel(f, (k) => k.look?.[1], false)], zoom: this.channel(f, (k) => k.zoom, true) };+ const c: Cam = { look: [this.channel(f, (k) => k.look?.[0], false), this.channel(f, (k) => k.look?.[1], false)], zoom: this.channel(f, (k) => k.zoom, true) };+ if (this.keys.some((k) => k.lens !== undefined)) c.lens = this.channel(f, (k) => k.lens, true, false);+ return c;}// register an impact or a handheld stretch. amp in SCREEN px; rot in radians at full strength.@@ -141,11 +166,11 @@ export class Camera {// the move the audience sees: the clean path with its shake folded in. A screen-space nudge of// [dx, dy] is the camera's look point stepping BACK by that much, in world units.shaken(f: number): Cam & { rot: number } {- const c = this.at(f), [dx, dy, dr] = this.shakeAt(f), k = c.zoom;- return { look: [c.look[0] - dx / k, c.look[1] - dy / k], zoom: c.zoom, rot: dr };+ const c = this.at(f), [dx, dy, dr] = this.shakeAt(f), k = heroScale(c);+ return { ...c, look: [c.look[0] - dx / k, c.look[1] - dy / k], rot: dr };}- // plane scale at depth z for a camera state: the hero plane (z = 0) scales by zoom exactly.+ // plane scale at depth z for a camera state: the hero plane (z = 0) scales by zoom x lens exactly.scaleAt(c: Cam, z = 0): number { return planeScale(c, z); }// stroke-weight compensation for a close shot (see strokeWeight above)diff --git a/skills/anidoodle/engine/src/canvas-core/timeRemap.ts b/skills/anidoodle/engine/src/canvas-core/timeRemap.tsnew file mode 100644index 0000000..1bfcf99--- /dev/null+++ b/skills/anidoodle/engine/src/canvas-core/timeRemap.ts@@ -0,0 +1,102 @@+// TIME REMAP. Speed ramps, slow motion and freeze frames as one pure map from the film's frame to+// the scene's frame: draw the scene at remap.at(f) instead of f. Nothing else changes, so the+// determinism contract holds by construction (the scene is still a pure function of a number).+//+// const t = timeRemap([+// { f: 90, speed: 0.3, ramp: 8 }, // ease down into slow motion before the peak+// { f: 120, speed: 0, keepsMoving: "the name writes itself" }, // a freeze: the world stops, one thing does not+// { f: 156, speed: 1, ramp: 12 }, // ease back to real time+// ]);+// scene(g, t.at(f)); // the remapped world+// name(g, f); // what keeps moving through the freeze stays on the film's own frame+//+// CRAFT, and why it works this way:+// - SPEED IS WHAT YOU KEY, TIME IS ITS INTEGRAL. A key sets the speed from its frame on (scene+// frames per film frame); scene time is the area under that speed, worked out exactly. So time+// never jumps, never runs backwards, and every position in the scene stays continuous.+// - A RAMP EASES THE SPEED, NOT THE TIME. With a ramp the speed glides from the old value to the new+// one over that many frames on a smoothstep, so it is continuous too and starts and ends with no+// kick: a body in flight slows the way a camera slows it, not the way a cut does. ramp: 0 is a+// hard change of speed, for a deliberate snap.+// - A FREEZE MUST KEEP SOMETHING MOVING. A speed of 0 is refused unless the key says, in words, what+// keeps moving on the film's own frame (a name being written, the camera creeping in, dust still+// settling). A frozen frame with nothing moving is dead air, and the gate would fail the film.+// - SCORE AND SOUND STAY ON REAL TIME. The remap never touches audio: music is cued by film frame,+// and so are effects. To land a sound on a remapped event, find the film frame that shows it with+// filmFrameOf(sceneFrame). A slowed world under a score at its own tempo is the effect.+// Every function here is arithmetic over (frame, keys): no clock, no state, any order.++export type TimeKey = {+ f: number; // the film frame this speed starts from (whole, increasing)+ speed: number; // scene frames per film frame from here on: 1 real time, 0.25 slow motion, 0 a freeze, 2 fast+ ramp?: number; // frames over which the speed glides from the old value to this one (default 0, a hard change)+ curve?: "smooth" | "linear"; // the glide's shape: smoothstep (default; no kick at either end) or a straight line+ keepsMoving?: string; // required when speed is 0: what still moves, on the film's frame, through the freeze+};+export type Freeze = { from: number; to: number; keepsMoving: string }; // film frames [from, to); to is Infinity if never released+export type TimeRemap = {+ /** The scene frame shown on film frame f (fractional in slow motion: the scene must draw between its frames). */+ at: (f: number) => number;+ /** Scene frames per film frame at f. */+ speedAt: (f: number) => number;+ /** The first whole film frame that shows scene frame t: where a sound for a scene event is cued. */+ filmFrameOf: (t: number) => number;+ /** Every stretch where the scene stands still, with what keeps moving through it. */+ freezes: Freeze[];+};++// the glide's shape e(u) and its integral from 0 to u, so time under a ramp is exact+const CURVES = {+ smooth: { e: (u: number) => u * u * (3 - 2 * u), area: (u: number) => u * u * u - (u * u * u * u) / 2 },+ linear: { e: (u: number) => u, area: (u: number) => (u * u) / 2 },+} as const;++type Seg = { f: number; from: number; to: number; ramp: number; curve: (typeof CURVES)["smooth"]; t0: number };++export const timeRemap = (keys: readonly TimeKey[]): TimeRemap => {+ let last = -1, prevSpeed = 1;+ const segs: Seg[] = [], freezes: Freeze[] = [];+ for (const [i, k] of keys.entries()) {+ if (!Number.isInteger(k.f) || k.f < 0) throw new Error(`timeRemap: key ${i} is at frame ${k.f}; keys sit on whole film frames from 0`);+ if (k.f <= last) throw new Error(`timeRemap: keys must increase (${last} then ${k.f})`);+ if (!Number.isFinite(k.speed) || k.speed < 0) throw new Error(`timeRemap: speed at frame ${k.f} must be a number of 0 or more (got ${k.speed}); time never runs backwards`);+ const ramp = k.ramp ?? 0, curve = k.curve ?? "smooth", next = keys[i + 1]?.f;+ if (!Number.isFinite(ramp) || ramp < 0) throw new Error(`timeRemap: ramp at frame ${k.f} must be 0 or more frames (got ${ramp})`);+ if (!(curve in CURVES)) throw new Error(`timeRemap: curve at frame ${k.f} is "smooth" or "linear" (got ${curve})`);+ if (next !== undefined && k.f + ramp > next) throw new Error(`timeRemap: the ramp from frame ${k.f} runs ${ramp} frames, past the next key at ${next}`);+ if (k.speed === 0 && !(typeof k.keepsMoving === "string" && k.keepsMoving.trim())) throw new Error(`timeRemap: the freeze at frame ${k.f} must say what keeps moving (keepsMoving), or it is dead air`);+ // scene time at this key: the previous segment's area up to here+ const t = segs.length ? sceneAt(segs[segs.length - 1], k.f) : k.f;+ segs.push({ f: k.f, from: prevSpeed, to: k.speed, ramp, curve: CURVES[curve], t0: t });+ if (k.speed === 0) freezes.push({ from: k.f + ramp, to: next ?? Infinity, keepsMoving: k.keepsMoving!.trim() });+ prevSpeed = k.speed; last = k.f;+ }+ const segAt = (f: number): Seg | undefined => { let s: Seg | undefined; for (const x of segs) { if (x.f <= f) s = x; else break; } return s; };+ const at = (f: number): number => { const s = segAt(f); return s ? sceneAt(s, f) : f; };+ const speedAt = (f: number): number => {+ const s = segAt(f); if (!s) return 1;+ const x = f - s.f; return s.ramp > 0 && x < s.ramp ? s.from + (s.to - s.from) * s.curve.e(x / s.ramp) : s.to;+ };+ const filmFrameOf = (target: number): number => {+ if (!Number.isFinite(target)) throw new Error(`filmFrameOf: scene frame must be a number (got ${target})`);+ const reached = (f: number) => at(f) >= target - 1e-9;+ let lo = Math.min(-1, Math.floor(target) - 1); // before the first key the scene runs at real time, so at(lo) = lo < target+ const tail = segs[segs.length - 1], start = tail ? tail.f + tail.ramp : 0;+ let hi = Math.max(1, Math.ceil(start), Math.ceil(target));+ if (!reached(hi)) {+ if (tail && tail.to === 0) throw new Error(`filmFrameOf: scene frame ${target} is never shown; the film stays frozen at scene frame ${at(hi).toFixed(2)}`);+ const rate = tail ? tail.to : 1; hi += Math.ceil((target - at(hi)) / rate) + 1;+ while (!reached(hi)) hi += Math.ceil(1 / rate) + 1; // guards rounding only+ }+ while (hi - lo > 1) { const mid = Math.floor((lo + hi) / 2); if (reached(mid)) hi = mid; else lo = mid; }+ return hi;+ };+ return { at, speedAt, filmFrameOf, freezes };+};++// scene time inside one segment: the area under its speed from the key to film frame f+const sceneAt = (s: Seg, f: number): number => {+ const x = f - s.f;+ if (s.ramp > 0 && x < s.ramp) return s.t0 + s.ramp * (s.from * (x / s.ramp) + (s.to - s.from) * s.curve.area(x / s.ramp));+ return s.t0 + s.ramp * (s.from + (s.to - s.from) * s.curve.area(1)) + s.to * (x - s.ramp);+};diff --git a/skills/anidoodle/engine/test/camera.test.ts b/skills/anidoodle/engine/test/camera.test.tsindex 230bcd9..c56cbd3 100644--- a/skills/anidoodle/engine/test/camera.test.ts+++ b/skills/anidoodle/engine/test/camera.test.ts@@ -1,6 +1,6 @@// CAMERA TESTS. The engine camera (src/canvas-core/camera.ts) is pure arithmetic, so it is held to// exact numbers here, with no browser: node tools/test.mjs-import { Camera, EASE, monoPath, planeScale, projectCam, strokeWeight, unprojectCam, type Cam } from "../src/canvas-core/camera";+import { Camera, dollyZoom, EASE, heroScale, monoPath, planeScale, projectCam, strokeWeight, unprojectCam, type Cam } from "../src/canvas-core/camera";import { Gfx, type P } from "../src/canvas-core/core";export const name = "camera";@@ -67,7 +67,36 @@ export const run = (ok: (cond: boolean, label: string) => void) => {g.push(10, 20, 2, 0.3); g.push(5, 0, 1, 0); const T1 = T; g.pop(); g.pop();ok(near(T1[4], 10 + 2 * Math.cos(0.3) * 5) && near(T1[5], 20 + 2 * Math.sin(0.3) * 5), "nested push: child translation is rotated and scaled by the parent");- // 8. bad input is refused, loudly+ // 8. lens zoom is not a dolly: the lens scales every plane by one factor, the dolly changes parallax+ const base: Cam = { look: [0, 0], zoom: 1.5 }, lensed: Cam = { ...base, lens: 2 }, dollied: Cam = { look: [0, 0], zoom: 3 };+ ok(near(heroScale(lensed), 3) && near(heroScale(dollied), 3) && near(heroScale(base), 1.5), "hero-plane scale is dolly x lens (a lens of 2 and a dolly to 3 frame the hero the same)");+ ok([0.5, 1, 3, -0.2].every((z) => near(planeScale(lensed, z) / planeScale(base, z), 2)), "a lens zoom grows every depth by the same factor: the depth relationships do not change");+ ok(planeScale(dollied, 3) / planeScale(dollied, 0) < planeScale(base, 3) / planeScale(base, 0), "a dolly in to the same hero size shrinks the far plane relative to the hero: parallax changes");+ ok(near(strokeWeight(lensed), Math.pow(3, 0.35)), "stroke weight follows the screen scale, lens included");+ const lc = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 1 }, { f: 60, lens: 1 }, { f: 120, lens: 4 }]);+ ok(near(lc.at(90).lens!, 2) && near(lc.at(90).zoom, 1) && near(lc.at(0).lens!, 1), "lens keys ease in log2 like the dolly (midpoint of 1 -> 4 is 2) and hold before their first key");+ ok(JSON.stringify(Object.keys(cam.at(45))) === JSON.stringify(["look", "zoom"]), "a camera that never sets a lens answers exactly as before (no lens field)");+ lc.shake({ from: 0, to: 30, amp: 10, seed: 3 });+ let lensErr = 0, lensTrip = 0, shakePx = 0;+ for (const f of [5, 70, 100]) for (const z of [0, 1.5, -0.25]) {+ lc.begin(g, f, z); const [a, b, c, d, e, ff] = T; lc.end(g);+ for (const q of [[0, 0], [300, -120]] as P[]) { const s = lc.toScreen(q, f, z), m = [a * q[0] + c * q[1] + e, b * q[0] + d * q[1] + ff]; lensErr = Math.max(lensErr, Math.hypot(s[0] - m[0], s[1] - m[1])); const w = lc.toWorld(s, f, z); lensTrip = Math.max(lensTrip, Math.hypot(w[0] - q[0], w[1] - q[1])); }+ }+ { const sh = lc.shaken(5), cl = lc.at(5), [dx, dy] = lc.shakeAt(5); shakePx = Math.hypot((cl.look[0] - sh.look[0]) * heroScale(sh) - dx, (cl.look[1] - sh.look[1]) * heroScale(sh) - dy); }+ ok(lensErr < 1e-6 && lensTrip < 1e-6, "with a lens, begin() and toScreen() still agree and toWorld inverts them");+ ok(shakePx < 1e-9 && lc.shaken(70).lens !== undefined, "shake stays in screen px under a lens, and the shaken camera keeps its lens");++ // 9. the dolly zoom: the hero plane holds its size while the depth stretches+ const dolly = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 1 }, { f: 60, zoom: 3 }]), vz = dollyZoom((f) => dolly.at(f));+ ok([0, 15, 30, 45, 60].every((f) => near(heroScale(vz(f)), 1, 1e-12)), "dollyZoom holds the hero plane's screen scale on every frame");+ ok(planeScale(vz(60), 2) < planeScale(vz(0), 2) * 0.6, `dollying in, the far plane falls away behind the subject (${planeScale(vz(0), 2).toFixed(3)} -> ${planeScale(vz(60), 2).toFixed(3)})`);+ const out = new Camera([540, 540], [{ f: 0, look: [0, 0], zoom: 2 }, { f: 60, zoom: 0.8 }]), vo = dollyZoom((f) => out.at(f), { at: 0 });+ ok(near(heroScale(vo(60)), 2) && planeScale(vo(60), 2) > planeScale(vo(0), 2), "dollying out, the hero holds and the background looms");+ ok(near(heroScale(dollyZoom((f) => dolly.at(f), { hold: 2.5 })(30)), 2.5), "hold sets the size to keep");+ const asPath = new Camera([540, 540], [], { path: vz });+ ok(near(heroScale(asPath.shaken(40)), 1) && asPath.toScreen([0, 0], 40)[0] === 540, "a dolly zoom drives a Camera as a path, with shake and projections intact");++ // 10. bad input is refused, loudlyconst throws = (fn: () => unknown) => { try { fn(); return false; } catch { return true; } };ok(throws(() => new Camera([0, 0], [{ f: 5, zoom: 1 }, { f: 5, zoom: 2 }])), "rejects duplicate key frames");ok(throws(() => new Camera([0, 0], [{ f: 1.5, zoom: 1 }])), "rejects a fractional key frame");@@ -75,4 +104,6 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(throws(() => new Camera([0, 0], [])), "rejects a camera with neither keys nor path");ok(throws(() => cam.shake({ from: 10, to: 10, amp: 1, seed: 1 })), "rejects an empty shake window");ok(throws(() => monoPath([[0, 1], [0, 2]])), "monoPath rejects non-increasing keys");+ ok(throws(() => new Camera([0, 0], [{ f: 0, zoom: 1, lens: 0 }])) && throws(() => new Camera([0, 0], [{ f: 0, zoom: 1, lens: NaN }])) && throws(() => new Camera([0, 0], [{ f: 0, zoom: NaN }])), "rejects a lens <= 0, or a lens or zoom that is not a number");+ ok(throws(() => dollyZoom((f) => dolly.at(f), { hold: 0 })) && throws(() => dollyZoom(() => ({ look: [0, 0], zoom: 0 }))), "dollyZoom refuses a size of 0 to hold, or a dolly at zoom 0");};diff --git a/skills/anidoodle/engine/test/timeRemap.test.ts b/skills/anidoodle/engine/test/timeRemap.test.tsnew file mode 100644index 0000000..3c997ca--- /dev/null+++ b/skills/anidoodle/engine/test/timeRemap.test.ts@@ -0,0 +1,60 @@+// TIME REMAP TESTS. src/canvas-core/timeRemap.ts is arithmetic, so its claims (time is continuous and+// never runs backwards, a ramp has no kick, a freeze says what keeps moving, a sound can be cued on a+// remapped event) are held to numbers here. node tools/test.mjs timeRemap+import { timeRemap, type TimeKey } from "../src/canvas-core/timeRemap";++export const name = "timeRemap";+export const run = (ok: (cond: boolean, label: string) => void) => {+ const near = (a: number, b: number, eps = 1e-9) => Math.abs(a - b) <= eps;+ const throws = (fn: () => unknown) => { try { fn(); return false; } catch { return true; } };++ // 1. no keys is real time; a key at speed 1 changes nothing+ const id = timeRemap([]);+ ok([-5, 0, 0.5, 37, 900].every((f) => id.at(f) === f && id.speedAt(f) === 1), "no keys: scene frame = film frame, speed 1");+ ok([0, 12, 300].every((f) => timeRemap([{ f: 10, speed: 1 }]).at(f) === f), "a key at speed 1 is real time");++ // 2. exact numbers: a hard change to slow motion, then a smooth ramp back+ const slow = timeRemap([{ f: 30, speed: 0.25 }, { f: 70, speed: 1, ramp: 10 }]);+ ok(near(slow.at(30), 30) && near(slow.at(70), 40) && near(slow.at(50), 35), "speed 0.25 from frame 30: 40 film frames show 10 scene frames");+ ok(near(slow.at(80), 40 + 10 * (0.25 + 1) / 2) && near(slow.at(100), 46.25 + 20), "a ramp covers the mean of its two speeds, then real time resumes");+ ok(near(slow.speedAt(75), 0.25 + 0.75 * 0.5) && near(slow.speedAt(70), 0.25) && near(slow.speedAt(80), 1), "the speed glides from 0.25 to 1 over the ramp, half way at its middle");++ // 3. a full ramp-freeze-release: continuous, never backwards, speed continuous, no kick at the ramp ends+ const keys: TimeKey[] = [{ f: 60, speed: 0.3, ramp: 8 }, { f: 90, speed: 0, ramp: 4, keepsMoving: "the name writes itself" }, { f: 126, speed: 1, ramp: 12 }];+ const t = timeRemap(keys);+ let back = false, jump = 0, sjump = 0;+ for (let f = -10; f <= 300; f += 0.125) { const a = t.at(f), b = t.at(f + 0.125); if (b < a - 1e-12) back = true; jump = Math.max(jump, b - a); sjump = Math.max(sjump, Math.abs(t.speedAt(f + 0.125) - t.speedAt(f))); }+ ok(!back, "scene time never runs backwards");+ ok(jump <= 0.125 + 1e-9, `scene time never jumps (largest step ${jump.toFixed(4)} for 0.125 film frames, at most real time here)`);+ ok(sjump < 0.1, `the speed never steps on a smooth ramp (largest change ${sjump.toFixed(4)} per eighth of a frame)`);+ const e = 1e-4, kick = (f: number) => Math.abs(t.speedAt(f + e) - t.speedAt(f)) / e;+ ok([60, 68, 90, 94, 126, 138].every((f) => kick(f) < 1e-2), "smoothstep ramps start and end with no kick (speed flat at both ends)");+ ok(t.freezes.length === 1 && t.freezes[0].from === 94 && t.freezes[0].to === 126 && t.freezes[0].keepsMoving === "the name writes itself", "the freeze is listed from where the speed reaches 0 to the next key, with what keeps moving");+ ok([94, 100, 110.5, 125.99].every((f) => near(t.at(f), t.at(94))), "inside the freeze the scene stands still");+ ok(t.at(127) > t.at(126), "it releases at the next key");++ // 4. a linear ramp covers the same area as a smooth one; fast motion runs ahead of real time+ const lin = timeRemap([{ f: 0, speed: 0.5, ramp: 10, curve: "linear" }]), smo = timeRemap([{ f: 0, speed: 0.5, ramp: 10 }]);+ ok(near(lin.at(10), smo.at(10)) && near(lin.at(10), 7.5) && near(lin.speedAt(2.5), 0.875), "linear and smooth ramps cover the same area by their end; linear glides in a straight line");+ ok(near(timeRemap([{ f: 20, speed: 2 }]).at(50), 80), "speed 2 shows two scene frames per film frame");++ // 5. cueing a sound on a remapped event: the first film frame that shows it+ for (const target of [10, 61.3, 75, t.at(94), t.at(94) + 0.5, 140, 400]) {+ const f = t.filmFrameOf(target);+ ok(Number.isInteger(f) && t.at(f) >= target - 1e-9 && t.at(f - 1) < target, `scene frame ${target.toFixed(2)} is first shown on film frame ${f}`);+ }+ ok(t.filmFrameOf(t.at(100)) <= 94, "an event at the frozen moment is cued where the freeze begins, not later");+ ok(throws(() => timeRemap([{ f: 10, speed: 0, keepsMoving: "camera creeps" }]).filmFrameOf(50)), "a scene frame past a freeze that never releases is never shown, and says so");+ ok(timeRemap([{ f: 0, speed: 0.01 }]).filmFrameOf(5) === 500, "a very slow remap still finds its frame");++ // 6. pure: the same keys give the same numbers in any order of asking+ const a = timeRemap(keys), b = timeRemap(keys), order1 = [200, 5, 100, 61].map((f) => a.at(f)), order2 = [61, 100, 5, 200].map((f) => b.at(f)).reverse();+ ok(JSON.stringify(order1) === JSON.stringify(order2), "the same keys answer the same, whatever order frames are asked in");++ // 7. bad input is refused, loudly+ ok(throws(() => timeRemap([{ f: 30, speed: 0 }])) && throws(() => timeRemap([{ f: 30, speed: 0, keepsMoving: " " }])), "a freeze that does not say what keeps moving is refused (dead air)");+ ok(throws(() => timeRemap([{ f: 30, speed: -1 }])) && throws(() => timeRemap([{ f: 30, speed: NaN }])), "a negative or non-number speed is refused: time never runs backwards");+ ok(throws(() => timeRemap([{ f: 30, speed: 1 }, { f: 30, speed: 2 }])) && throws(() => timeRemap([{ f: 3.5, speed: 1 }])) && throws(() => timeRemap([{ f: -1, speed: 1 }])), "keys on repeated, fractional or negative frames are refused");+ ok(throws(() => timeRemap([{ f: 30, speed: 0.5, ramp: 20 }, { f: 40, speed: 1 }])) && throws(() => timeRemap([{ f: 30, speed: 0.5, ramp: -2 }])), "a ramp that runs past the next key, or a negative ramp, is refused");+ ok(throws(() => timeRemap([{ f: 30, speed: 0.5, curve: "bounce" as "smooth" }])), "an unknown ramp curve is refused");+};diff --git a/skills/anidoodle/engine/tools/deck.mjs b/skills/anidoodle/engine/tools/deck.mjsindex c48481f..fcf3e89 100644--- a/skills/anidoodle/engine/tools/deck.mjs+++ b/skills/anidoodle/engine/tools/deck.mjs@@ -7,6 +7,7 @@// node tools/deck.mjs deal --kind story --energy high --seconds 27 [--seed 7] [--avoid id,id] [--json]// node tools/deck.mjs deal --cat seam --n 3 --kind launch # three seams only// node tools/deck.mjs list [--cat camera] # every card, one line each+// node tools/deck.mjs find "whip pan" [--json] # an everyday name -> its card, engine call, or why we refuse it// node tools/deck.mjs test # the deck and the dealer hold their own rules// Weights: role (workhorse 3, accent 2, signature 1) x energy fit (same 1, "any" 0.7, other 0.25).// A deal has one opening, one close, at most one signature card, and no card twice.@@ -39,6 +40,35 @@ export const deal = ({ kind, energy, seconds = 20, seed = 1, n, cat, avoid = []return picked.sort((a, b) => CATS.indexOf(a.cat) - CATS.indexOf(b.cat));};+// FIND. People ask for a move by the name they know ("a whip pan", "do the Vertigo thing"). Each card's+// aka, the deck's calls and its refused names hold those names; find routes the words to what anidoodle+// builds, or to the reason it will not and what it makes instead, so nothing is improvised from a word.+const STOP = new Set(["a", "an", "the", "please", "do", "make", "me", "some", "use", "add", "like", "effect", "shot", "move", "thing"]);+export const norm = (x) => ` ${String(x).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim()} `;+const entries = () => [+ ...DECK.moves.map((m) => ({ kind: "card", id: m.id, names: [m.id, ...(m.aka ?? [])], item: m })),+ ...(DECK.calls ?? []).map((c) => ({ kind: "call", id: c.id, names: [c.id, ...c.aka], item: c })),+ ...(DECK.refused ?? []).map((r) => ({ kind: "refused", id: r.name, names: [r.name, ...r.aka], item: r })),+];+/** Every entry whose names match the words, best first: an exact name, a name inside the words, the words inside a name, then shared words. */+export const find = (query) => {+ const q = norm(query), words = q.trim().split(" ").filter((w) => w && !STOP.has(w)), out = [];+ if (!q.trim()) return out;+ for (const e of entries()) {+ let best = 0, via = "";+ for (const n of e.names) {+ const a = norm(n), aw = a.trim().split(" ");+ const score = a === q ? 100 : q.includes(a) ? 50 + aw.length : a.includes(q) ? 30 : words.length ? (10 * words.filter((w) => aw.includes(w)).length) / words.length : 0;+ if (score > best) { best = score; via = n; }+ }+ if (best >= 5) out.push({ kind: e.kind, id: e.id, score: best, via, item: e.item });+ }+ return out.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));+};+const showFound = (r) => r.kind === "card" ? `${card(r.item)}\n (matched "${r.via}")`+ : r.kind === "call" ? ` ${r.id} [engine call · ${r.item.where}]\n ${r.item.call}\n ${r.item.use}\n (matched "${r.via}")`+ : ` REFUSED: ${r.id} (matched "${r.via}")\n why: ${r.item.why}\n make instead: ${r.item.instead}`;+const card = (m) => ` ${m.id} [${m.cat} · ${m.role} · ${m.energy}]\n ${m.move}\n build: ${m.build}\n not when: ${m.not}`;const selfTest = () => {let fails = 0; const say = (ok, label) => { if (!ok) fails++; console.log(` ${ok ? "PASS" : "FAIL"} ${label}`); };@@ -50,9 +80,26 @@ const selfTest = () => {// every file a card cites exists: a card that points at nothing is a rumourconst have = new Set(); const walk = (d) => { for (const e of readdirSync(d, { withFileTypes: true })) { if (e.name === "node_modules" || e.name.startsWith(".")) continue; if (e.isDirectory()) walk(join(d, e.name)); else have.add(e.name); } };walk(join(ROOT, "references")); walk(join(ROOT, "engine", "src")); walk(join(ROOT, "engine", "tools"));- const cited = [...new Set(M.flatMap((m) => `${m.build} ${m.not} ${m.move}`.match(/[A-Za-z0-9-]+\.(?:ts|mjs|md)\b/g) ?? []))], missing = cited.filter((f) => !have.has(f));+ const cited = [...new Set([...M.map((m) => `${m.build} ${m.not} ${m.move}`), ...(DECK.calls ?? []).map((c) => `${c.where} ${c.call} ${c.use}`), ...(DECK.refused ?? []).map((r) => `${r.why} ${r.instead}`)].flatMap((t) => t.match(/[A-Za-z0-9-]+\.(?:ts|mjs|md)\b/g) ?? []))], missing = cited.filter((f) => !have.has(f));say(!missing.length, `all ${cited.length} files the cards cite exist${missing.length ? ` missing: ${missing.join(", ")}` : ""}`);say(!/\u2014/.test(JSON.stringify(DECK)), "no em dashes in the deck");+ // names: every card has everyday names, every name leads to one place, and the common ones resolve+ const C = DECK.calls ?? [], R = DECK.refused ?? [];+ say(M.every((m) => Array.isArray(m.aka) && m.aka.length >= 1 && m.aka.every((a) => typeof a === "string" && a.trim())), "every card lists at least one everyday name (aka)");+ say(C.length >= 3 && C.every((c) => c.id && c.where && c.call && c.use && c.aka?.length) && R.length >= 6 && R.every((r) => r.name && r.why?.length > 20 && r.instead && r.aka?.length), "every engine call says where and how, every refused name says why and what to make instead");+ { const seen = new Map(), dup = []; for (const e of entries()) for (const n of new Set(e.names.map(norm))) { if (seen.has(n) && seen.get(n) !== e.id) dup.push(`${n.trim()} (${seen.get(n)}, ${e.id})`); seen.set(n, e.id); }+ say(!dup.length, `no name leads to two places${dup.length ? ` ${dup.slice(0, 4).join("; ")}` : ""}`); }+ { const grammar = readFileSync(join(ROOT, "references", "motion-grammar.md"), "utf8"), table = grammar.slice(grammar.indexOf("## Names we refuse")), missing = R.filter((r) => !table.includes(`| ${r.name} |`));+ say(grammar.includes("## Names we refuse") && !missing.length, `motion-grammar.md's "Names we refuse" table holds every refused name${missing.length ? ` missing: ${missing.map((r) => r.name).join(", ")}` : ""}`); }+ { const named = R.flatMap((r) => r.instead.match(/\b(?:open|seam|cam|reveal|type|act|emph|close|time)-[a-z-]+[a-z]/g) ?? []), bad = named.filter((id) => !ids.includes(id));+ say(named.length >= 6 && !bad.length, `every card a refused name points to exists (${named.length})${bad.length ? ` missing: ${bad.join(", ")}` : ""}`); }+ const ROUTES = [["whip pan", "cam-whip-to-rest"], ["mask reveal", "reveal-from-behind"], ["Vertigo", "cam-vertigo-realisation"], ["a dolly zoom", "cam-vertigo-realisation"], ["the vertigo effect", "cam-vertigo-realisation"],+ ["speed ramp", "time-ramp-at-peak"], ["slow-mo", "time-ramp-at-peak"], ["freeze frame", "time-freeze-and-name"], ["J-cut", "seam-sound-leads"], ["l cut", "seam-sound-leads"], ["rack focus", "cam-rack-of-attention"],+ ["pop-in", "act-settle"], ["count-up", "reveal-count-during"], ["zoom in", "call-lens"], ["crash zoom", "call-lens"], ["dolly in", "cam-slow-push"], ["circle wipe", "call-iris"], ["smash cut", "call-flash-cut"],+ ["typewriter", "call-typewriter"], ["can you do a whip pan to the cat", "cam-whip-to-rest"], ["glitch", "glitch"], ["Lens Flare", "lens flare"], ["fade in", "fade-in"], ["crossfade", "cross dissolve"], ["confetti", "particle burst"], ["shine", "light sweep"]];+ const wrong = ROUTES.filter(([q, id]) => find(q)[0]?.id !== id).map(([q, id]) => `"${q}" -> ${find(q)[0]?.id ?? "nothing"} (want ${id})`);+ say(!wrong.length, `${ROUTES.length} everyday names resolve to the right card, call or refusal${wrong.length ? ` ${wrong.join("; ")}` : ""}`);+ say(find("zzqx plorb").length === 0 && find(" ").length === 0, "a name nobody uses finds nothing, and says so");const key = (d) => d.map((m) => m.id).join(",");say(key(deal({ kind: "story", energy: "high", seconds: 27, seed: 7 })) === key(deal({ kind: "story", energy: "high", seconds: 27, seed: 7 })), "the same seed deals the same hand");say(new Set(Array.from({ length: 40 }, (_, s) => key(deal({ kind: "story", energy: "high", seconds: 27, seed: s + 1 })))).size >= 30, "forty seeds deal at least thirty different hands");@@ -91,5 +138,12 @@ if (isMain(import.meta.url)) {const seed = num("--seed", 0, true) ?? (Date.now() % 100000), o = { kind, energy, seconds: num("--seconds", 1) ?? 20, seed, n: num("--n", c ? 1 : 3, true), cat: c, avoid: (val("--avoid") ?? "").split(",").filter(Boolean) }, d = deal(o);if (args.includes("--json")) console.log(JSON.stringify({ ...o, cards: d }, null, 1));else { console.log(`DECK seed ${seed}${kind ? ` · ${kind}` : ""}${energy ? ` · ${energy}` : ""}${c ? ` · ${c} only` : ` · ${o.seconds} s`} · ${d.length} cards\n`); console.log(d.map(card).join("\n\n")); console.log(`\nKeep, adapt or drop each card, and say why in the brief. To repeat this deal: --seed ${seed}. To deal the next film a different hand: --avoid ${d.map((m) => m.id).join(",")}`); }- } else die("usage: deck.mjs deal|list|test (see the header of this file)");+ } else if (cmd === "find") {+ const q = args.filter((a) => a !== "--json").join(" ").trim(); if (!q) die('find takes a name: deck.mjs find "whip pan"');+ const all = find(q), top = all[0], hits = all.filter((r) => r.score >= Math.max(5, (top?.score ?? 0) / 2)).slice(0, 5);+ if (args.includes("--json")) console.log(JSON.stringify({ query: q, found: hits.map(({ kind, id, via, item }) => ({ kind, id, via, ...item })) }, null, 1));+ else if (!hits.length) console.log(`FIND "${q}": no card, call or refused name goes by that. List the deck with deck.mjs list, or describe the move in plain words in the brief.`);+ else { console.log(`FIND "${q}" · ${hits.length} ${hits.length === 1 ? "match" : "matches"}, best first\n`); console.log(hits.map(showFound).join("\n\n")); console.log(`\nA card is a prompt, never an order: its numbers are the default unless the person named their own (workflows/start-here.md).`); }+ if (!hits.length) process.exit(1);+ } else die("usage: deck.mjs deal|list|find|test (see the header of this file)");}diff --git a/skills/anidoodle/references/camera.md b/skills/anidoodle/references/camera.mdindex c8620db..47aae14 100644--- a/skills/anidoodle/references/camera.md+++ b/skills/anidoodle/references/camera.md@@ -1,4 +1,4 @@-# The camera: one dolly, keyed on the frame grid+# The camera: one dolly and one lens, keyed on the frame grid`engine/src/canvas-core/camera.ts` is the camera. A film either draws in world coordinatesinside `begin()`/`end()` (the transform path: dirty boxes stay right because the camera rides@@ -21,32 +21,95 @@ const cam = new Camera([W / 2, H / 2], [cam.shake({ from: 96, to: 126, amp: 14, seed: 7, rot: 0.004 }); // an impact, ringing down```-- **Zoom is interpolated in log2.** A zoom is a ratio: halving the apparent size twice should- take twice as long as halving it once. Ease the zoom value itself and a long push-in sprints- at the near end and crawls at the far one; easing log2(zoom) spends time evenly per stop.+- **The `zoom` key is the dolly**: how close the camera stands (see Lens and dolly below). It is+ interpolated in log2, because it is a ratio: halving the apparent size twice should take twice+ as long as halving it once. Ease the value itself and a long push-in sprints at the near end+ and crawls at the far one; easing log2(zoom) spends time evenly per stop. A `lens` key eases+ the same way.- **Easing per segment, `inout` (easeInOutCubic) by default.** A camera move with no liveoperator should accelerate gently and arrive gently. `linear` reads as mechanical, `out`alone reads as interrupted, `in` alone as a fall.-- **A zoom path with several keys** breathes at every key under per-segment easing. Pass- `monoZoom: true` to run one monotone cubic through all the zoom keys in log2 instead: smooth,+- **A dolly path with several keys** breathes at every key under per-segment easing. Pass+ `monoZoom: true` to run one monotone cubic through all the `zoom` keys in log2 instead: smooth,never overshooting into a scale it was not given, never reversing.- **Authored paths**: for a camera that follows a creature or a curve, pass- `path: (f) => ({ look, zoom })` instead of keys. Same camera, same shake, same projections.+ `path: (f) => ({ look, zoom, lens? })` instead of keys. Same camera, same shake, same projections.## Depth planes (parallax)The camera sits at distance D = 1/zoom from the hero plane (z = 0). A plane at depth z scales-by `1/(D + z)` and moves with it: near planes swing wide, far ones barely stir, and every+by `lens/(D + z)` and moves with it: near planes swing wide, far ones barely stir, and everyelement at a depth agrees with every other, because there is only one camera. Positive zrecedes; a negative z crosses the lens (grass across the glass). Pass the plane's z to`begin(g, f, z)` or `toScreen(p, f, z)`. One dolly, one number, and the parallax is true forevery element at once: do not hand each plane its own drift.+## Lens and dolly++Two different moves make the subject bigger, and directors name them apart:++- **A dolly** moves the camera: the `zoom` key, distance D = 1/zoom. Near planes grow faster than+ far ones, so the depth changes as it goes. This is a push-in, a pull-back, a dolly in or out.+- **A lens zoom** changes the focal length with the camera standing still: the `lens` key+ (default 1). It multiplies every plane by the same factor about the frame's centre, so nothing+ shifts against anything else; the picture is magnified, flat. A crash zoom or punch-in is this.+ It reads as an operator's or a documentary's move, more noticed than a dolly. Use it when that+ is the voice; for travelling into a world, dolly.+- **A dolly zoom** does both against each other: the camera dollies while the lens is solved on+ every frame so the hero plane keeps its size, and the planes behind stretch away (dolly in) or+ loom (dolly out). The subject holds still in a world that has just changed shape: the moment of+ realisation (deck card `cam-vertigo-realisation`). It needs at least two planes behind the+ subject; with nothing behind it, it is only a zoom.++```ts+import { Camera, dollyZoom, heroScale } from "./camera";++const lensIn = new Camera(c, [{ f: 0, look, zoom: 1 }, { f: 40, lens: 1, ease: "out" }, { f: 52, lens: 2.2 }]); // a crash zoom+const dolly = new Camera(c, [{ f: 0, look, zoom: 1 }, { f: 60, zoom: 2.4 }]);+const vertigo = new Camera(c, [], { path: dollyZoom((f) => dolly.at(f)) }); // holds frame 0's hero scale+// dollyZoom(path, { hold: 1.5 }) holds a given scale; { at: 30 } holds the scale the path has at frame 30+```++`heroScale(cam)` is the hero plane's screen scale (dolly times lens), and `weight(cam)` follows+it, so a lens zoom thins the line just as a dolly does.++## Time: speed ramps, slow motion, freeze frames++`engine/src/canvas-core/timeRemap.ts` maps the film's frame to the scene's frame: draw the world at+`t.at(f)` instead of `f`. Speed is what you key and scene time is its exact integral, so time is+continuous, never runs backwards, and stays a pure function of the frame.++```ts+import { timeRemap } from "./timeRemap";++const t = timeRemap([+ { f: 84, speed: 0.3, ramp: 8 }, // ease into slow motion before the peak+ { f: 120, speed: 0, keepsMoving: "her name writes itself" }, // freeze: the world stops, the writing does not+ { f: 150, speed: 1, ramp: 14 }, // ease back to real time+]);+world(g, t.at(f)); // the remapped scene+name(g, f); // the writing, on the film's own frame+cues.push({ frame: t.filmFrameOf(LANDING), kind: "paper" }); // a sound on a remapped event+```++- **A ramp eases the speed**, on a smoothstep, so it starts and ends with no kick; `ramp: 0` is a+ deliberate hard change. A slowed scene is asked for frames between its frames, so it must+ draw at fractional time (motion is a function of time, never of a frame counter).+- **Score and sound stay on real time.** The score never slows; effects are cued by film frame.+ `filmFrameOf(sceneFrame)` gives the first film frame that shows a scene event, which is where+ its sound goes.+- **A freeze must keep something moving.** A `speed: 0` key without `keepsMoving` (in words)+ throws: a frozen frame with nothing moving is dead air, and the gate fails it. Drive the thing+ that moves (the name being written, the camera still creeping in) from the film's frame `f`.+ `t.freezes` lists each stop with what keeps moving.+- **Once a film for each.** One slow motion at the peak, one freeze on the telling pose (deck+ cards `time-ramp-at-peak`, `time-freeze-and-name`). The second halves the first.+## Shake`shake({ from, to, amp, seed, freq, rot, attack })` registers an impact or a handheld stretch:-- **amp in SCREEN pixels**, so the shake reads the same at any zoom; **rot** in radians at full+- **amp in SCREEN pixels**, so the shake reads the same at any dolly or lens; **rot** in radians at fullstrength, about the frame's centre. A small rotation is what actually sells handheld.- The envelope is an **attack ramp** (default 2 frames) into a **squared decay**: full strengthat the hit, gone a beat later. An impact rings down; it does not stop mid-air.@@ -59,9 +122,9 @@ every element at once: do not hand each plane its own drift.## Line weight at close range-Ink is authored at some view; at zoom S the same nib reads S times heavier. Divide stroke widths-by `weight(cam)` = S^0.35. Not S: a little weight gain is what makes a close-up feel close-rather than enlarged.+Ink is authored at some view; at a screen scale S (dolly times lens) the same nib reads S times+heavier. Divide stroke widths by `weight(cam)` = S^0.35. Not S: a little weight gain is what+makes a close-up feel close rather than enlarged.## The two drawing pathsdiff --git a/skills/anidoodle/references/motion-deck.json b/skills/anidoodle/references/motion-deck.jsonindex 0c5f196..67dce3d 100644--- a/skills/anidoodle/references/motion-deck.json+++ b/skills/anidoodle/references/motion-deck.json@@ -1,181 +1,231 @@{- "about": "The motion deck: moves this engine can already make, each with its numbers. Dealt by engine/tools/deck.mjs so two films do not reach for the same three. A dealt card is a prompt to consider, in the film's own subject and medium: keep it, adapt it, or drop it and say why. Times are seconds, distances are fractions of the frame's width, so every card holds at any size and frame rate.",+ "about": "The motion deck: moves this engine can already make, each with its numbers. Dealt by engine/tools/deck.mjs so two films do not reach for the same three. A dealt card is a prompt to consider, in the film's own subject and medium: keep it, adapt it, or drop it and say why. Times are seconds, distances are fractions of the frame's width, so every card holds at any size and frame rate. Each card's aka lists the everyday names people use for it; calls maps names to engine calls that are not cards; refused lists names anidoodle will not make, with the reason and what to make instead. deck.mjs find resolves a name against all three.","roles": { "workhorse": "carries a film quietly, safe to use twice", "accent": "noticed when it happens, once or twice", "signature": "can be the one move that is this film's own, used at the open, the middle and the close" },"moves": [- { "id": "open-mid-move", "cat": "open", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "open-mid-move", "cat": "open", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["start on the move", "moving open", "open on motion"],"move": "Frame 0 is already composed and already moving: the film opens partway into a camera move or an action, never on a still that then starts.","build": "A path camera whose move began before frame 0 (camera.ts, path: (f) => move(f + lead)), or a cycle opened at phase 0.3, so the first second has travel in it.","not": "A piece that draws itself: there the empty page is the opening." },- { "id": "open-iris-from-subject", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "launch", "explainer"],+ { "id": "open-iris-from-subject", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "launch", "explainer"], "aka": ["iris in", "iris open", "circle reveal"],"move": "The film opens through a round opening that grows from the thing it is about, 0.5 to 0.8 s, evenly in log space so it does not crawl then snap.","build": "iris(ctx, env, seam(f, 0, len), blank, scene, { center }) in transitions.ts; shape \"blot\" for an inked film.","not": "Centred on nothing. Or when the close also irises and a seam in the middle does: the third one is a preset." },- { "id": "open-detail-first", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "drawing"],+ { "id": "open-detail-first", "cat": "open", "role": "accent", "energy": "calm", "kinds": ["story", "loop", "drawing"], "aka": ["extreme close-up open", "macro open", "start on a detail"],"move": "Open so close on one detail (an eye, a hand, a nib) that the subject is not yet readable, then pull back over 1.5 to 3 s until it is.",- "build": "Camera keys from zoom 4 to 6 down to 1 with monoZoom: true; divide stroke widths by cam.weight(cam.at(f)) so the close-up reads close, not enlarged (camera.md).",+ "build": "A dolly back: Camera zoom keys from 4 to 6 down to 1 with monoZoom: true; divide stroke widths by cam.weight(cam.at(f)) so the close-up reads close, not enlarged (camera.md).","not": "A detail that was not drawn to be seen at that size. Check the first frame at --scale 2." },- { "id": "open-cold-action", "cat": "open", "role": "accent", "energy": "high", "kinds": ["story", "launch"],+ { "id": "open-cold-action", "cat": "open", "role": "accent", "energy": "high", "kinds": ["story", "launch"], "aka": ["cold open", "in medias res", "start in the action"],"move": "No establishing shot: the first frame is the middle of the action, and the wide shot comes second, as the answer to where we are.","build": "Order the shots action, then wide; the score enters on frame 0 with one sound that has a reason.","not": "A calm piece, or a subject the viewer cannot name from the close shot within a second." },- { "id": "seam-matched-cut", "cat": "seam", "role": "workhorse", "energy": "high", "kinds": ["any"],+ { "id": "seam-matched-cut", "cat": "seam", "role": "workhorse", "energy": "high", "kinds": ["any"], "aka": ["match on action", "hidden cut", "invisible cut", "motion match cut"],"move": "A hard cut hidden in travel. The outgoing shot accelerates over 0.2 to 0.4 s, its last frame is its fastest, the incoming shot opens at the same speed in the same direction and comes to rest over 0.8 to 1.4 s.","build": "matchedMove({ dir, exitDist, exitF, entryF }) in seams.ts, added to each scene's camera look; hold it with checkSeam. Render with --blur auto.","not": "Either shot has no room to travel, or the two travel different ways. Then both sides come to rest and it is a plain cut on a beat." },- { "id": "seam-flight-through", "cat": "seam", "role": "accent", "energy": "high", "kinds": ["story", "launch", "explainer"],+ { "id": "seam-flight-through", "cat": "seam", "role": "accent", "energy": "high", "kinds": ["story", "launch", "explainer"], "aka": ["zoom through", "zoom transition", "fly through", "push through"],"move": "The camera flies into the outgoing shot and comes out in the next: a push of about 1.2 over 0.2 s, the cut, then the incoming shot growing from about two thirds of its size to rest over 0.5 s.","build": "matchedZoom({ push, exitF, entryF }) in seams.ts multiplies each camera's zoom; the incoming scene must be painted wider than the frame, because it opens small.",- "not": "The thing flown into is not what the next shot is about. Then it is a zoom laid over a join." },- { "id": "seam-actor-carries", "cat": "seam", "role": "signature", "energy": "any", "kinds": ["any"],+ "not": "The thing flown into is not what the next shot is about. Then it is a push laid over a join." },+ { "id": "seam-actor-carries", "cat": "seam", "role": "signature", "energy": "any", "kinds": ["any"], "aka": ["persistent element", "carry-over", "object match", "hero object transition"],"move": "One object crosses the seam untouched while the world changes round it: same screen position, same size, same colour on the last frame of one scene and the first of the next.","build": "Drive it from one function of the absolute frame that both scenes call (relay in motif.ts); checkRelay holds the two sides to 2 px.","not": "The object has no reason to be in the second scene. A mascot that only watches is decoration." },- { "id": "seam-shape-becomes", "cat": "seam", "role": "signature", "energy": "medium", "kinds": ["any"],+ { "id": "seam-shape-becomes", "cat": "seam", "role": "signature", "energy": "medium", "kinds": ["any"], "aka": ["shape morph", "morph transition", "shape match", "shape tween"],"move": "A shape in the outgoing picture travels, stretches a little while moving, and becomes a shape of the next picture, landing on it exactly.","build": "handoff({ from, to, t0, t1 }) in morph.ts; coverShape when the target is the whole page; checkShapes at the landing.","not": "The two shapes share nothing the eye can follow (colour, edge, a rough outline). A morph between strangers is a wipe." },- { "id": "seam-pick-and-grow", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer", "story"],+ { "id": "seam-pick-and-grow", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer", "story"], "aka": ["expand to fullscreen", "card expand", "zoom into card", "selection zoom"],"move": "One item out of a set is chosen and grows until it is the next scene; the next scene's first frame is framed exactly like the item.","build": "A camera punch-in that does not come back (launchGallery.ts); frame the incoming scene's first frame from the card's box.","not": "The set was only built to be left." },- { "id": "seam-cover-from-inside", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "story", "explainer"],+ { "id": "seam-cover-from-inside", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["launch", "story", "explainer"], "aka": ["foreground wipe", "object wipe", "cover transition"],"move": "Something already in the scene grows until it covers the frame, and when it clears the next scene is there. The next scene is complete underneath on every frame.","build": "coverShape (morph.ts) on the scene's own shape, or the bloom in launchCut.ts; close it on the next picture's focal point.","not": "An arbitrary shape brought in to hide the join, or the third time in one film." },- { "id": "seam-brush", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["story", "drawing", "launch"],+ { "id": "seam-brush", "cat": "seam", "role": "accent", "energy": "medium", "kinds": ["story", "drawing", "launch"], "aka": ["wipe", "brush wipe", "paint wipe", "ink wipe"],"move": "A loaded brush is pulled across in the direction the story is already moving, wet ink running ahead of the new picture, 0.6 to 0.9 s.","build": "brushWipe(ctx, env, p, from, to, { angle, ink }) in transitions.ts.","not": "A clean, set register. Or more than twice." },- { "id": "seam-cut-on-beat", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "seam-cut-on-beat", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["cut on the beat", "match cut", "graphic match", "hard cut"],"move": "A plain hard cut with both sides at rest, on a strong beat, between two frames that match in one thing: a shape, a position, a direction of gaze.","build": "No call. Put the cut frame on the cue table's downbeat and check the pair as stills: one thing sits in the same place on both.","not": "Nothing matches, or the music has no beat there. Then use the gentle move." },- { "id": "seam-one-canvas", "cat": "seam", "role": "workhorse", "energy": "calm", "kinds": ["explainer", "launch", "story", "interactive"],+ { "id": "seam-one-canvas", "cat": "seam", "role": "workhorse", "energy": "calm", "kinds": ["explainer", "launch", "story", "interactive"], "aka": ["oner", "one take", "infinite canvas", "continuous shot"],"move": "The scenes sit side by side in one layout larger than the frame and the camera travels between them; the route says how they relate.","build": "One Camera for every plane (camera.ts); world-placed scenery so the view changes all the way (koiWorld.ts, webTour.ts).","not": "The places are unrelated, or the trip between two stops is long and empty." },- { "id": "seam-leave-as-arrived", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "seam-leave-as-arrived", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["exit animation", "animate out", "reverse entrance", "outro animation"],"move": "A thing leaves the way it came, mirrored in time and shorter: what arrived over 0.5 s on a settling curve leaves over 0.25 s on an accelerating one, along the same path.","build": "Run the entrance's own progress backwards through easeIn (seams.ts); if it was revealed from behind an edge it tucks back behind that edge where the edge is now.","not": "The exit is the point of the scene. Then it gets a move of its own." },+ { "id": "seam-sound-leads", "cat": "seam", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["J-cut", "L-cut", "sound bridge", "pre-lap", "audio lead", "split edit"],+ "move": "The sound crosses the cut ahead of the picture or behind it: the next scene is heard 0.3 to 0.8 s before it is seen (a J-cut), or the last scene is still heard 0.5 to 1.5 s into the next (an L-cut). The ear makes the join before the eye does.",+ "build": "Cue the incoming scene's first sound at CUT minus the lead in the SfxPlan (filmSfx cues are film frames), or let the outgoing scene's sound run past CUT with lengthS; the score can enter its next section a beat early (music/sound-design.md, Sound across a cut).",+ "not": "A hit or a contact: its sound belongs on its own frame, and one that trails its picture reads as lag." },- { "id": "cam-slow-push", "cat": "camera", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "cam-slow-push", "cat": "camera", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["slow push", "push in", "dolly in", "creep in", "Ken Burns"],"move": "A hold that is never still: the camera pushes in 3 to 6 percent over the whole shot, so a quiet shot still changes every second.","build": "Two Camera keys, zoom 1 to 1.04, ease \"linear\" for this one move only: an eased drift stops at both ends and the stop is the dead air.","not": "A shot with a lot of its own motion. Two moves at once fight." },- { "id": "cam-parallax-travel", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "explainer"],+ { "id": "cam-parallax-travel", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "explainer"], "aka": ["parallax", "truck shot", "lateral track", "multiplane", "parallax scroll"],"move": "The camera travels sideways and depth does the work: near things swing wide, far things barely stir, and something crosses the lens in front of the subject.","build": "One Camera, planes at z from -0.3 (across the glass) to 4 or more (camera.md, depth planes). Never a hand-set drift per layer.","not": "A flat style whose point is the flatness (a print, a diagram)." },- { "id": "cam-follow-with-lag", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "interactive"],+ { "id": "cam-follow-with-lag", "cat": "camera", "role": "workhorse", "energy": "medium", "kinds": ["story", "loop", "interactive"], "aka": ["tracking shot", "follow cam", "follow shot", "chase cam"],"move": "The camera follows a moving subject a little late: the subject pulls ahead when it accelerates and the frame catches up when it slows, so speed is felt.","build": "A path camera: path: (f) => ({ look: subject(f - lag), zoom }) with lag of 0.1 to 0.2 s; lead room in front of the subject.","not": "The subject must stay pinned for a read (a face, a label)." },- { "id": "cam-impact-shake", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"],+ { "id": "cam-impact-shake", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"], "aka": ["camera shake", "screen shake", "impact shake", "shake on hit"],"move": "One impact rings through the frame: full strength on the hit, gone within a beat, with a little rotation.","build": "cam.shake({ from, to, amp, seed, rot }) in camera.ts; amp is screen px, 0.8 to 1.5 percent of the width.","not": "More than two a film, or on anything that is not a real contact." },- { "id": "cam-pull-back-reveal", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"],+ { "id": "cam-pull-back-reveal", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"], "aka": ["pull back", "pull out", "dolly out", "reveal shot", "crane up", "zoom out to reveal"],"move": "The camera pulls back and the thing we were looking at turns out to be a small part of something larger.",- "build": "Camera keys in log2 zoom, monoZoom: true, 1.5 to 3 s; the large thing is painted in the world from the start, never faded in at the end.",- "not": "The larger thing adds nothing to the story. Then it is only a zoom out." },- { "id": "cam-rack-of-attention", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"],+ "build": "A dolly out: Camera zoom keys (eased in log2), monoZoom: true, 1.5 to 3 s; the large thing is painted in the world from the start, never faded in at the end.",+ "not": "The larger thing adds nothing to the story. Then it is only a pull-back." },+ { "id": "cam-rack-of-attention", "cat": "camera", "role": "accent", "energy": "calm", "kinds": ["story", "explainer", "launch"], "aka": ["rack focus", "focus pull", "pull focus", "shift focus"],"move": "Attention moves from one thing to another in the same frame without the camera moving: the first dims and softens its edges, the second gains contrast and line weight.","build": "Draw both from one emphasis value 0..1: stroke weight, saturation and value contrast (no ctx.filter, the contract forbids it).","not": "The two things are in different places in the story. That is a seam." },- { "id": "cam-whip-to-rest", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch"],+ { "id": "cam-whip-to-rest", "cat": "camera", "role": "accent", "energy": "high", "kinds": ["story", "launch"], "aka": ["whip pan", "swish pan", "flash pan", "whip"],"move": "A fast pan to a new subject inside one scene that decays to rest on it: the last third of the move is the slow part.","build": "Camera key with ease \"out\" over 0.4 to 0.7 s; keep the peak under speedCeiling(W, fps) (seams.ts) and render with --blur auto.","not": "Past the ceiling. Then cut on the beat instead." },+ { "id": "cam-vertigo-realisation", "cat": "camera", "role": "accent", "energy": "medium", "kinds": ["story", "explainer", "launch"], "aka": ["dolly zoom", "Vertigo", "vertigo effect", "zolly", "trombone shot", "Hitchcock zoom"],+ "move": "The moment of realisation: the subject keeps its size in the frame while the world behind it stretches away (or closes in), over 1 to 2.5 s, slow enough to be felt before it is noticed.",+ "build": "dollyZoom((f) => cam.at(f)) in camera.ts, used as a path camera, on a dolly of 1.6 to 3 times; the subject on the hero plane and at least two planes behind it at real depths (camera.md, Lens and dolly).",+ "not": "Fewer than two depth planes (with nothing behind the subject it is only a zoom), or a beat that is not a realisation. Once a film." },- { "id": "reveal-drawn-on", "cat": "reveal", "role": "signature", "energy": "any", "kinds": ["any"],+ { "id": "reveal-drawn-on", "cat": "reveal", "role": "signature", "energy": "any", "kinds": ["any"], "aka": ["line draw", "draw on", "stroke reveal", "self-drawing", "path animation", "timelapse", "speed paint"],"move": "The thing is drawn into the picture in the order a hand would make it, the tool visible, each stroke taking the time its length asks for.","build": "kind: \"drawing\" and the style plate's own draw order (workflows/drawing-process.md).","not": "A fade standing in for drawing. If it cannot be drawn on, it arrives some other honest way." },- { "id": "reveal-from-behind", "cat": "reveal", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "reveal-from-behind", "cat": "reveal", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["mask reveal", "masked rise", "reveal from below", "wipe reveal"],"move": "A thing comes out from behind something already in the picture (a hill, a card's edge, another figure), so the picture supplies the mask.","build": "Clip with the occluder's own outline (pathShape in morph.ts) and move the thing out from under it on a settling curve, 0.4 to 0.7 s.","not": "A mask in mid-air with nothing drawn where its edge is." },- { "id": "reveal-by-light", "cat": "reveal", "role": "accent", "energy": "calm", "kinds": ["story", "loop"],+ { "id": "reveal-by-light", "cat": "reveal", "role": "accent", "energy": "calm", "kinds": ["story", "loop"], "aka": ["light reveal", "lights on", "spotlight reveal"],"move": "The scene is there from the first frame but dark; light arrives (a door, a sun, a lamp) and the subject is found by it.","build": "Paint the lit and unlit values of every surface and mix them by distance from the light's edge as it moves.","not": "A style with no light in it (flat vector, a diagram)." },- { "id": "reveal-assemble", "cat": "reveal", "role": "accent", "energy": "medium", "kinds": ["explainer", "launch", "story"],+ { "id": "reveal-assemble", "cat": "reveal", "role": "accent", "energy": "medium", "kinds": ["explainer", "launch", "story"], "aka": ["build up", "assemble", "stack up", "pieces fly in"],"move": "Parts arrive from the back to the front, each held above the stack with a wide soft shadow that closes as it lands, 0.08 to 0.12 s apart.","build": "paperCraft.ts is the worked example; no more than about seven parts in flight at once.","not": "Parts that are not real parts of the subject." },- { "id": "reveal-count-during", "cat": "reveal", "role": "workhorse", "energy": "medium", "kinds": ["explainer", "launch", "infographic"],+ { "id": "reveal-count-during", "cat": "reveal", "role": "workhorse", "energy": "medium", "kinds": ["explainer", "launch", "infographic"], "aka": ["count-up", "count up", "number ticker", "counter", "rolling number"],"move": "A number changes while the thing it counts is changing, and stops on the frame the action stops. Never after.","build": "Drive the digits and the action from the same progress value (productUI.ts counts values this way).","not": "A figure that is not true of the data on screen." },- { "id": "type-written", "cat": "type", "role": "workhorse", "energy": "any", "kinds": ["launch", "explainer", "infographic"],+ { "id": "type-written", "cat": "type", "role": "workhorse", "energy": "any", "kinds": ["launch", "explainer", "infographic"], "aka": ["write on", "handwriting", "handwritten text", "signature animation"],"move": "A line is written by its tool, one stroke after another, at the speed of a hand, and holds long enough to be read twice.","build": "writeOn or sentence in kinetic.ts; on its own frame, or over a calm area where the frame would pass as a poster (workflows/launch-video.md, Type).","not": "Over a face, the focal detail or busy texture. In doubt the line gets its own frame." },- { "id": "type-one-line-at-a-time", "cat": "type", "role": "workhorse", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "type-one-line-at-a-time", "cat": "type", "role": "workhorse", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["line by line", "word by word", "kinetic typography", "kinetic type"],"move": "One line hands over to the next word by word, so there is never more than one full line on screen: the old line's words leave at twice the pace they came.","build": "sentence() in kinetic.ts for the arriving line; run the leaving line's word progress backwards at half the entry stagger; the new line's first word starts on a beat.","not": "Lines that must be compared. Those stay together." },- { "id": "type-names-the-thing", "cat": "type", "role": "accent", "energy": "calm", "kinds": ["explainer", "launch", "infographic"],+ { "id": "type-names-the-thing", "cat": "type", "role": "accent", "energy": "calm", "kinds": ["explainer", "launch", "infographic"], "aka": ["callout", "label", "annotation", "leader line"],"move": "A dot lands on one thing, a line is drawn out from it, a short label is written at its end; the dot follows the thing, the label holds still.","build": "drawCallout in callout.ts, pinned with cam.toScreen; one or two on screen.","not": "The picture is busy where the label would sit and a backing would cover something that matters." },- { "id": "type-label-becomes-heading", "cat": "type", "role": "signature", "energy": "medium", "kinds": ["explainer", "launch"],+ { "id": "type-label-becomes-heading", "cat": "type", "role": "signature", "energy": "medium", "kinds": ["explainer", "launch"], "aka": ["label to title", "text handoff", "title match"],"move": "A label on one scene travels across the seam and lands as the heading of the next, on that scene's first frame.","build": "A callout with handoff (callout.ts); the next scene draws it with drawLabel at the same pose; checkHandoff holds it to 2 px.","not": "The label's words are not what the next scene is about." },- { "id": "type-underline-then-point", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "type-underline-then-point", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["underline", "hand underline", "highlight word"],"move": "The one word that matters is underlined by hand after the line has landed, 0.25 s, on a beat. Underlined, never struck through.","build": "caption(..., \"underline\") in kinetic.ts, started when the line's progress reaches 1.","not": "More than one word a line, or more than twice a film." },+ { "id": "time-freeze-and-name", "cat": "type", "role": "accent", "energy": "medium", "kinds": ["story", "explainer", "launch"], "aka": ["freeze frame", "freeze and name", "character intro freeze", "freeze title"],+ "move": "The world stops on a telling pose and a name or a word is written by hand beside it; the camera keeps creeping in while it is written, then time picks up exactly where it stopped.",+ "build": "A speed 0 key in timeRemap (timeRemap.ts) whose keepsMoving names the writing; writeOn in kinetic.ts and a slow push, both on the film's own frame; hold for as long as the word takes to write plus one beat to read it.",+ "not": "Nothing is written or moving during the stop (dead air, and timeRemap refuses it), or a calm film where a hard stop is a jolt." },- { "id": "act-anticipate", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop", "launch"],+ { "id": "act-anticipate", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop", "launch"], "aka": ["anticipation", "wind-up"],"move": "Before any large action the body goes the other way first: a crouch before a jump, a draw back before a throw, 0.15 to 0.3 s, a quarter of the action's size.","build": "A held pose keyed before the action and blended through (a rig's mix between poses); bones keep their length (anatomy.md).","not": "A machine, or a move meant to startle." },- { "id": "act-follow-through", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop"],+ { "id": "act-follow-through", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["story", "loop"], "aka": ["follow-through", "overlapping action", "drag", "secondary motion"],"move": "Loose parts arrive late and go further: a tail, hair, a sleeve follow the body by 0.05 to 0.1 s a segment, each segment wider than the one before.","build": "Sample the driving angle at f - lag * i down the chain and scale its swing by 1 + 0.15 to 0.2 * i.","not": "A stiff material. Wood and metal do not whip." },- { "id": "act-settle", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["any"],+ { "id": "act-settle", "cat": "acting", "role": "workhorse", "energy": "any", "kinds": ["any"], "aka": ["overshoot", "settle", "pop-in", "spring settle", "back ease"],"move": "Nothing stops dead. A thing that lands goes a little past, comes back, and is at rest by 0.3 to 0.5 s; weight decides how far past.","build": "One overshoot of 4 to 8 percent then a decay on easeOut; heavier things overshoot less and take longer.","not": "Type meant to be read while it lands, and anything in a clean set register that should simply arrive." },- { "id": "act-head-stays", "cat": "acting", "role": "accent", "energy": "high", "kinds": ["story", "loop"],+ { "id": "act-head-stays", "cat": "acting", "role": "accent", "energy": "high", "kinds": ["story", "loop"], "aka": ["stable head", "head stabilisation", "level head"],"move": "In a run the body works hard and the head rides level: the eyes stay on one line while the spine folds and opens under them.","build": "Solve the neck last, to a head height that does not follow the body (hold the head to a few px through a stride).","not": "A bounce that is the joke (a toy, a rubber-hose character)." },- { "id": "act-blink-and-breathe", "cat": "acting", "role": "workhorse", "energy": "calm", "kinds": ["story", "loop", "launch"],+ { "id": "act-blink-and-breathe", "cat": "acting", "role": "workhorse", "energy": "calm", "kinds": ["story", "loop", "launch"], "aka": ["idle animation", "idle loop", "breathing", "blink"],"move": "A character at rest is alive: the chest rises over 3 to 4 s, a blink of 0.1 to 0.15 s every few seconds at uneven gaps, an ear or a tail answers a sound.","build": "Periodic over the loop length so the seam closes; blink times from rng(seed), never a fixed interval.","not": "A portrait whose stillness is the point." },- { "id": "emph-contact", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "loop", "launch"],+ { "id": "emph-contact", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "loop", "launch"], "aka": ["impact effect", "dust hit", "hit spark", "contact splash"],"move": "A contact is shown where it happens: dust, a splash or a compressed shadow on the frame of the hit, clearing over 0.4 to 0.8 s.","build": "Seeded particles born on the contact frame from the contact point; the sound effect cued to the same frame (music/sound-design.md).","not": "A touch with no force in it." },- { "id": "emph-world-answers", "cat": "emphasis", "role": "accent", "energy": "medium", "kinds": ["story", "loop"],+ { "id": "emph-world-answers", "cat": "emphasis", "role": "accent", "energy": "medium", "kinds": ["story", "loop"], "aka": ["secondary action", "reaction", "ripple effect", "wake"],"move": "The subject's action moves something else in the scene a moment later: grass bends in the wake, birds lift, water rings spread.","build": "Drive the secondary thing from the primary's position at f - delay, falling off with distance.","not": "A reaction that draws the eye off the subject at the moment that matters." },- { "id": "emph-hold-the-result", "cat": "emphasis", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "emph-hold-the-result", "cat": "emphasis", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["hold", "beat hold", "breather", "let it land"],"move": "After the biggest change in the film the result is held, alive but unbroken, for 1 to 2 s before anything else happens.","build": "A hold in the cue table after the payoff with only breathing motion in it (cam-slow-push, act-blink-and-breathe).","not": "A loop under 6 s, where the hold would be most of it." },+ { "id": "time-ramp-at-peak", "cat": "emphasis", "role": "accent", "energy": "high", "kinds": ["story", "launch", "loop"], "aka": ["speed ramp", "slow motion", "slow-mo", "time ramp", "bullet time"],+ "move": "At the top of the action (the peak of a jump, the instant before contact) time slows and stays slow long enough to read the shape, then gathers back into real time. The score keeps its own tempo throughout.",+ "build": "timeRemap in timeRemap.ts: ease down over 0.2 to 0.35 s to a speed of 0.2 to 0.4, hold 0.5 to 1.2 s, ease back over 0.3 to 0.6 s; draw the scene at t.at(f) (it must draw between its frames) and cue the contact sound at t.filmFrameOf(contact) (camera.md, Time).",+ "not": "Nothing is in flight, or a second time in one film: the second slow motion halves the first." },- { "id": "close-returns-to-open", "cat": "close", "role": "signature", "energy": "any", "kinds": ["story", "loop", "launch"],+ { "id": "close-returns-to-open", "cat": "close", "role": "signature", "energy": "any", "kinds": ["story", "loop", "launch"], "aka": ["bookend", "full circle", "callback ending", "loop back"],"move": "The last frame is the first frame, earned: the film ends where it began and the viewer now knows what it means.","build": "Draw the closing shot from the opening shot's own function at the same frame; for a loop, verify-export.mjs --loop holds the last frame to frame 0.","not": "A film whose point is that things changed for good." },- { "id": "close-subtract", "cat": "close", "role": "workhorse", "energy": "calm", "kinds": ["any"],+ { "id": "close-subtract", "cat": "close", "role": "workhorse", "energy": "calm", "kinds": ["any"], "aka": ["wind down", "quiet ending", "subtractive ending"],"move": "The ending takes things away: motion slows, parts leave, the music stops on a bar line, a breath of near silence, then one soft sound on the last picture.","build": "A section with fewer parts and no low drum, then one resolved note; music.mjs check prints the ARC line, which flags an ending that out-shouts the film.","not": "A sting of a few seconds, which is all ending." },- { "id": "close-mark-from-actor", "cat": "close", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"],+ { "id": "close-mark-from-actor", "cat": "close", "role": "accent", "energy": "medium", "kinds": ["launch", "explainer"], "aka": ["logo reveal", "logo resolve", "end card", "logo sting"],"move": "The thing that travelled through the film lands as part of the mark, and the end card opens from it.","build": "handoff (morph.ts) from the actor's last shape to the mark's shape; the wordmark written after it lands (logo in kinetic.ts).","not": "A mark the actor does not resemble in any way." }+ ],+ "calls": [+ { "id": "call-iris", "where": "transitions.ts", "call": "iris(ctx, env, p, from, to, { center, shape })", "aka": ["iris", "iris out", "circle wipe", "circle transition", "mask transition"],+ "use": "A round opening from a point or closing to one; open it from what the next scene is about (motion-grammar.md, Three ready-made seams)." },+ { "id": "call-flash-cut", "where": "transitions.ts", "call": "flashCut(ctx, env, local, cut, from, to)", "aka": ["smash cut", "flash cut", "flash transition", "white flash"],+ "use": "A hard cut under a short burst of light, on a strong beat; declare the film's flashes to checkFlashes." },+ { "id": "call-lens", "where": "camera.ts", "call": "Camera keys with lens (a true lens zoom), or dollyZoom", "aka": ["zoom in", "zoom out", "lens zoom", "crash zoom", "punch in", "snap zoom"],+ "use": "A lens zoom magnifies every plane by one factor and changes no parallax; to move closer through the world, key the dolly (zoom) instead (camera.md, Lens and dolly)." },+ { "id": "call-handheld", "where": "camera.ts", "call": "cam.shake({ from, to, amp, seed, rot, freq }) over a long window", "aka": ["handheld", "handheld camera", "shaky cam", "camera wobble"],+ "use": "A long low shake with a little rotation and a low freq reads as a hand on the camera; keep amp small (camera.md, Shake)." },+ { "id": "call-motion-blur", "where": "render.mjs", "call": "node tools/render.mjs <film> --blur auto", "aka": ["motion blur", "motion trail", "shutter blur"],+ "use": "Subframes per frame from each frame's measured speed, averaged in linear light; the film's own code is untouched." },+ { "id": "call-typewriter", "where": "launchKit.ts", "call": "typedAt(text, f, times) and caretAt", "aka": ["typewriter", "typing effect", "type on", "typing text"],+ "use": "Characters appear on a typing cadence with a caret, one tick sound per character (music/sound-design.md)." }+ ],+ "refused": [+ { "name": "glitch", "aka": ["glitch", "datamosh", "RGB split", "chromatic aberration"],+ "why": "Colour split and torn pixels need ctx.filter or pixel tricks the contract forbids, and they read as a template effect.",+ "instead": "a cut on the beat (seam-cut-on-beat), or one shake on a real impact (cam-impact-shake)" },+ { "name": "light sweep", "aka": ["light sweep", "shine", "sheen", "glare sweep"],+ "why": "A shine sliding across chrome is a stock overlay; nothing in the picture casts it.",+ "instead": "reveal-by-light: the light belongs to the world and finds the subject" },+ { "name": "fade-in", "aka": ["fade in", "fade up", "fade in on scroll", "opacity fade"],+ "why": "Marks are made, not faded: a fade standing in for drawing is the first tell on the craft bar.",+ "instead": "reveal-drawn-on, reveal-from-behind or type-written" },+ { "name": "particle burst", "aka": ["particle burst", "particles", "confetti", "sparkle burst"],+ "why": "A burst on everything is decoration with no force behind it, so it is never a default.",+ "instead": "emph-contact: dust or a splash born on a real contact, from the contact point" },+ { "name": "cross dissolve", "aka": ["cross dissolve", "crossfade", "dissolve"],+ "why": "Two copies of one thing, each half there, read as a ghost.",+ "instead": "seam-shape-becomes or seam-actor-carries (move one object, change what it is mid-trip); between unrelated scenes, the gentle move" },+ { "name": "lens flare", "aka": ["lens flare", "light leak", "bokeh", "anamorphic flare"],+ "why": "Lens faults painted onto a drawing read as stock overlays, not as light.",+ "instead": "one named light in the scene (realism-and-craft.md), or reveal-by-light" }]}diff --git a/skills/anidoodle/references/motion-grammar.md b/skills/anidoodle/references/motion-grammar.mdindex 0703bcd..815009a 100644--- a/skills/anidoodle/references/motion-grammar.md+++ b/skills/anidoodle/references/motion-grammar.md@@ -178,6 +178,29 @@ A card is a prompt, never an order. Keep it, adapt it to this film's subject andit, and say which in the brief. The default at the top of this page still holds: a card whose"not when" applies is dropped, and the gentle move takes its place.+## Names people use++People ask for moves by the names they know: a whip pan, a mask reveal, a Vertigo shot, a J-cut.+`node tools/deck.mjs find "<name>"` routes the words to the card that builds it, to an engine call+that is not a card (an iris, a lens zoom, a typewriter), or to a refusal. Every card carries those+names in its `aka`. Run it before building anything named, so a word never turns into an+improvised effect; the card's numbers are the default unless the person gave their own+(`workflows/start-here.md`, When they name a move).++## Names we refuse++Some names ask for an effect that breaks the contract or the craft bar. Say so in one line and+offer the alternative; `deck.mjs find` prints the same reason.++| Name | Why not | Make instead |+|---|---|---|+| glitch | colour split and torn pixels need `ctx.filter` or pixel tricks the contract forbids | a cut on the beat, or one shake on a real impact |+| light sweep | a shine sliding over chrome that nothing in the picture casts | `reveal-by-light`: the light belongs to the world |+| fade-in | marks are made, not faded; the first tell on the craft bar | drawn on, revealed from behind, or written |+| particle burst | decoration with no force behind it, never a default | `emph-contact`: dust or splash born on a real contact |+| cross dissolve | two copies of one thing, each half there, read as a ghost | one object moving and changing mid-trip; the gentle move |+| lens flare | lens faults painted onto a drawing read as stock overlays | one named light in the scene, or `reveal-by-light` |+## Callouts and the label handoff`engine/src/canvas-core/callout.ts` names one thing in the picture: a dot lands on it, a leaderdiff --git a/skills/anidoodle/references/music/sound-design.md b/skills/anidoodle/references/music/sound-design.mdindex b3cafc4..a8c9915 100644--- a/skills/anidoodle/references/music/sound-design.md+++ b/skills/anidoodle/references/music/sound-design.md@@ -87,6 +87,20 @@ export const audio = filmSfx(filmAudio(score, 15), plan); // Film.audio: score- One master at the very end: a look-ahead true-peak ceiling at -1 dBTP (`ceilingDb`). The scorearrives already mastered, so nothing is renormalised.+## Sound across a cut (J-cut and L-cut)++The cheapest smooth seam works on the ear: the sound crosses the cut ahead of the picture or+behind it. In a **J-cut** the next scene is heard before it is seen, 0.3 to 0.8 s early (the+pond's bubbles under the last shot of the room, the nib scratching before the page appears). In an+**L-cut** the last scene is still heard 0.5 to 1.5 s into the next (a page still rustling, a pile+of bricks still settling). The ear makes the join first, so the picture cut lands as an answer. It+uses the same cue table: cue the incoming scene's sound at `CUT - lead` (`{ frame: CUT - 15, kind:+"bubble" }`), or let the outgoing one run past the cut with a longer `lengthS` or its own+tail. The score can do it too, entering its next section a beat before the cut+(a pre-lap), or letting the old chord ring over the first beat of the new scene. This never moves+a hit: a contact's sound stays on its own frame (Land on the frame, below). What crosses the cut+is a place's sound, never an event's. Deck card `seam-sound-leads`.+## Levels and the audibility ruleA cue nobody hears is a bug, not a subtle choice. A test that only checks a cue exists provesdiff --git a/skills/anidoodle/references/workflows/start-here.md b/skills/anidoodle/references/workflows/start-here.mdindex a2894e4..fc951f4 100644--- a/skills/anidoodle/references/workflows/start-here.md+++ b/skills/anidoodle/references/workflows/start-here.md@@ -32,6 +32,19 @@ pick", pick, say what you picked and why in one line, and carry on.Stop asking the moment you can build. Two questions answered well beat six asked.+## When they name a move++When the person names a move ("a whip pan to the cat", "a slow-mo at the top of the jump"), look+the name up first: `node <skill>/engine/tools/deck.mjs find "<name>"` returns the card or engine+call that builds it, or the reason anidoodle refuses it and what it makes instead. Then record+the move in the brief in four parts: **name** (theirs, and the card id), **duration** (seconds),+**strength** (how far, how fast or how much: a distance as a share of the frame width, a speed,+an overshoot) and **what moves** (which element, camera or layer). Fill only what they said. For+every part they left open, the card's own numbers are the default, written down and marked as+defaults: "whip pan (cam-whip-to-rest) · 0.4 to 0.7 s, card default · peak under the speed+ceiling, card default · the camera, onto the cat, theirs". A vague ask becomes a spec someone can+check against the render.+## Defaults when they do not say| Open question | Default | Why |@@ -45,7 +58,8 @@ Stop asking the moment you can build. Two questions answered well beat six asked## Write it down before you drawOne short brief file in the project: kind, style (and why), shape(s), length, sound (style +-moods), characters, the one-sentence idea. Everything the person said goes in their words.+moods), characters, the one-sentence idea, and any named moves as name, duration, strength and+what moves (card defaults marked as such). Everything the person said goes in their words.Everything you decided is marked as yours so they can veto it in one line.## Before the first full render