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
design review: no clipped type, no edge-cropped content. framecheck.mjs (and a probe in the page: every fillText/writeOn/setType line and every card or product window reported by the art) fails anything the frame's edge cuts through, run by launch ship on every frame; the close-up frames the whole composer (a phone opens on the empty state, composer centred, docking on send), the lean keeps its card whole with margins, and what the camera is about to cut fades first. Clean look: the UI camera keeps the window whole, the UI owns its panel, the split beat is a two-column grid with words sized as the design, the end card is one centred group with presence; the clean example's third ask is Tally's own reports screen. Design review checklist in launch-video-kit.md
Alex Greenshpun609b2b7a7b5a
diff --git a/skills/anidoodle/SKILL.md b/skills/anidoodle/SKILL.mdindex 6fb3864..f51b6d0 100644--- a/skills/anidoodle/SKILL.md+++ b/skills/anidoodle/SKILL.md@@ -122,7 +122,7 @@ node tools/emit.mjs intro --out out/intro.html # one self-co| `registry.mjs` / `gallery.mjs` | the style list from the plates themselves / the gallery sheet || `docs-check.mjs` | fails when any doc's style count, length or path disagrees with the code || `verify-export.mjs` | QA on the rendered file: frames, duration, score, A/V sync, true peak after the encode; opt-in first frame, loop seam, `--delivery` |-| `launch.mjs` | a launch film: `new <name>` scaffolds the spec; `ship <name> --shapes 16x9,9x16` renders, posters, captions, verifies each |+| `launch.mjs` | a launch film: `new <name>` scaffolds the spec; `ship <name> --shapes 16x9,9x16` renders, posters, captions, verifies and framechecks each (`framecheck.mjs`: no text cut by the frame's edge) || `test.mjs` (`npm test`) | unit suites in `engine/test/`, no browser || `music.mjs` | `vocab` prints a style's vocabulary; `check` gates your composed score; `render`, `meter` || `sfx.mjs` | the sound-effects kit: `list`, `one`, `kit <dir>`, `test` |diff --git a/skills/anidoodle/engine/src/canvas-core/core.ts b/skills/anidoodle/engine/src/canvas-core/core.tsindex bc0e712..33b8ac1 100644--- a/skills/anidoodle/engine/src/canvas-core/core.ts+++ b/skills/anidoodle/engine/src/canvas-core/core.ts@@ -18,6 +18,21 @@ export type Env = {// get() returns the exact pixels renderFrame would draw for (film, frame) at w x h, or nothing;// put() offers a freshly drawn one. A core that never calls it draws exactly the same frames.bake?: { get(film: object, frame: number, w: number, h: number): CanvasImageSource | undefined; put(film: object, frame: number, layer: Layer): void };+ // set by the host on the film's own env (never on a plate's): what is drawn with it lands in the+ // frame, so the frame probe (framecheck.mjs) may hold its text and content boxes to the frame's edges+ root?: boolean;+};++// ---------------------------------------------------------------- the frame probe+// With a probe installed (hosts/page.ts, only while framecheck.mjs asks), drawing code reports the+// device-pixel box of what the viewer must see whole: a line of text, a card, a window. A box the+// frame's edge cuts through is a design fault (clipped type, an edge-cropped card). Off by default: no cost.+export type ProbeRec = { kind: "text" | "box"; label: string; x0: number; y0: number; x1: number; y1: number };+export const probeRect = (ctx: Ctx, env: Env, x: number, y: number, w: number, h: number, label: string, kind: ProbeRec["kind"] = "box") => {+ const p = (globalThis as { __ANIDOODLE_PROBE__?: (r: ProbeRec) => void }).__ANIDOODLE_PROBE__;+ if (!p || !env.root || ctx.globalAlpha < 0.1) return;+ const m = ctx.getTransform(), pts = [[x, y], [x + w, y], [x, y + h], [x + w, y + h]].map(([a, b]) => [m.a * a + m.c * b + m.e, m.b * a + m.d * b + m.f]);+ p({ kind, label, x0: Math.min(...pts.map((q) => q[0])), y0: Math.min(...pts.map((q) => q[1])), x1: Math.max(...pts.map((q) => q[0])), y1: Math.max(...pts.map((q) => q[1])) });};// ---------------------------------------------------------------- deterministic randomnessdiff --git a/skills/anidoodle/engine/src/canvas-core/kinetic.ts b/skills/anidoodle/engine/src/canvas-core/kinetic.tsindex 3343bdf..9c906fc 100644--- a/skills/anidoodle/engine/src/canvas-core/kinetic.ts+++ b/skills/anidoodle/engine/src/canvas-core/kinetic.ts@@ -11,7 +11,7 @@// logo(ctx, env, x, y, em, p, opts) the anidoodle wordmark, written by a dip pen// logoBug(ctx, env, frame, x, y, scale, opts) the wordmark as a corner mark that lives// caption(ctx, env, text, x, y, size, p, kind, opts) a small hand-lettered callout, underline or arrow-import { fractal, rng, sample, type Ctx, type Env, type Layer, type P } from "./core";+import { fractal, probeRect, rng, sample, type Ctx, type Env, type Layer, type P } from "./core";import { G, type Glyph } from "./drafting";import { DOT, TAIL, WORD, inkStroke, outlineOf, type Nib } from "./lettering";@@ -264,6 +264,7 @@ export const writeOn = (ctx: Ctx, env: Env, text: string, x: number, y: number,screen(ctx, env);if (style === "brick" && o.track === undefined) o = { ...o, track: 2.6, slant: o.slant ?? 0 };const lay = layout(env, text, x, y, size, o), us = reach(lay, p), color = o.color ?? PALETTE[style], popK = o.pop ?? 1, seed = o.seed ?? 1;+ if (env.root && lay.boxes.length) { const bx = lay.boxes; probeRect(ctx, env, Math.min(...bx.map((b) => b.c[0] - b.w / 2)), y - size * 1.05, Math.max(...bx.map((b) => b.c[0] + b.w / 2)) - Math.min(...bx.map((b) => b.c[0] - b.w / 2)), size * 1.3, text, "text"); }ctx.save();if (style === "ink") drawInk(ctx, lay, us, size * (o.weight ?? 1), color, p, popK);else if (style === "marker") drawMarker(ctx, lay, us, size * (o.weight ?? 1), color, p, popK);@@ -395,7 +396,9 @@ const SET_FONT = (w: number, px: number) => `${w} ${px}px "Avenir Next", "Helvetexport const setWidth = (ctx: Ctx, text: string, size: number, o: SetOpts = {}) => { ctx.font = (o.font ?? SET_FONT)(o.weight ?? 700, size); return ctx.measureText(text).width + Math.max(0, text.length - 1) * (o.track ?? -0.02) * size; };export const setType = (ctx: Ctx, env: Env, text: string, x: number, y: number, size: number, p: number, o: SetOpts = {}) => {if (p <= 0) return;- screen(ctx, env); ctx.save();+ screen(ctx, env);+ { const w = setWidth(ctx, text, size, o), x0 = o.align === "center" ? x - w / 2 : o.align === "right" ? x - w : x; probeRect(ctx, env, x0, y - size * 0.8, w, size, text, "text"); }+ ctx.save();ctx.font = (o.font ?? SET_FONT)(o.weight ?? 700, size); ctx.textBaseline = "alphabetic"; ctx.fillStyle = o.color ?? "#111214";const tr = (o.track ?? -0.02) * size, words = text.split(" "), space = ctx.measureText(" ").width;const wOf = (w: string) => ctx.measureText(w).width + Math.max(0, w.length - 1) * tr, total = words.reduce((a, w) => a + wOf(w), 0) + space * (words.length - 1);diff --git a/skills/anidoodle/engine/src/canvas-core/launchExampleClean.ts b/skills/anidoodle/engine/src/canvas-core/launchExampleClean.tsindex a02dd97..116e98e 100644--- a/skills/anidoodle/engine/src/canvas-core/launchExampleClean.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchExampleClean.ts@@ -3,13 +3,13 @@// 1 the product's own UI from data: the ask typed into its command bar, its action pressed, every// row springing from the before state to the after state;// 2 a split feature beat: words in their own column, the live UI beside them (above them on a phone);-// 3 any film in a card (here the web tour), with its words beside it.+// 3 another of the product's own screens, its reports, with its words beside it: every ask shows+// THIS product (a film ask, kind "film", plays any film in a card the same way).// Everything here is a PLACEHOLDER for a made-up product; your film's UI data comes from YOUR// product (its real screens, its real states), and its score is composed for its brief.// node tools/launch.mjs ship launchExampleClean --shapes 16x9,9x16import { makeLaunchFilm } from "./launchTemplate";import type { ProductUI } from "./productUI";-import { webTour } from "./webTour";const inbox: ProductUI = {title: "Tally", nav: ["Inbox", "Books", "Reports"], action: "Match all", command: "Ask Tally…",@@ -44,12 +44,24 @@ const books: ProductUI = {] },};+const reports: ProductUI = {+ title: "Tally", nav: ["Reports", "Books"], action: "Explain",+ before: { items: [+ { id: "p", label: "Payroll", value: "$48,200", bar: 0.62 }, { id: "h", label: "Cloud hosting", value: "$1,208", bar: 0.31 },+ { id: "t", label: "Travel", value: "$640", bar: 0.18 }, { id: "d", label: "Design tools", value: "$144", bar: 0.08 },+ ] },+ after: { items: [+ { id: "h", label: "Cloud hosting", value: "$1,208", bar: 0.31, tag: "up 18 %", accent: true }, { id: "p", label: "Payroll", value: "$48,200", bar: 0.62, tag: "as planned" },+ { id: "t", label: "Travel", value: "$640", bar: 0.18 }, { id: "d", label: "Design tools", value: "$144", bar: 0.08 },+ ] },+};+export const launchExampleClean = makeLaunchFilm({title: "Tally", preset: "clean", fps: 60,asks: [{ kind: "ui", ui: inbox, prompt: "match every receipt from September" },{ kind: "ui", ui: books, split: [{ text: "Books close", style: "ink", color: "#15161a" }, { text: "themselves.", style: "ink", color: "#2f54eb" }] },- { kind: "film", film: webTour, from: 0, to: 359, split: [{ text: "And it shows", style: "ink", color: "#15161a" }, { text: "you where.", style: "ink", color: "#2f54eb" }] },+ { kind: "ui", ui: reports, split: [{ text: "And it shows", style: "ink", color: "#15161a" }, { text: "you where.", style: "ink", color: "#2f54eb" }] },],words: [[{ text: "ASK ONCE.", style: "ink", color: "#15161a" }, { text: "DONE.", style: "ink", color: "#2f54eb" }]],tagline: "Bookkeeping that does itself",diff --git a/skills/anidoodle/engine/src/canvas-core/launchKit.ts b/skills/anidoodle/engine/src/canvas-core/launchKit.tsindex 17de213..3622f06 100644--- a/skills/anidoodle/engine/src/canvas-core/launchKit.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchKit.ts@@ -75,7 +75,7 @@ export const plateLayer = (env: Env, key: string, film: Film, frame: number, px// a surface the launch film draws into itself (a scene inside a scene), same reuse ruleexport const selfLayer = (env: Env, key: string, w: number, h: number): Layer => {const lk = `self:${key}:${w}x${h}`; let L = env.cache.get(lk) as Layer | undefined;- if (!L) { L = env.canvas(w, h); env.cache.set(lk, L); }+ if (!L) { L = env.canvas(w, h); env.cache.set(lk, L); if (env.root && w === Math.round(env.W * env.scale) && h === Math.round(env.H * env.scale)) (L.ctx as unknown as { __frame?: boolean }).__frame = true; } // a full-frame sheet: its text lands in the frame (the probe)L.ctx.setTransform(1, 0, 0, 1, 0, 0); L.ctx.clearRect(0, 0, w, h); return L;};@@ -124,6 +124,8 @@ export type ChatState = {label?: string; labelAlpha?: number; // the reply's byline// your product: the thread's name and subline, the button's word, the accent (defaults: anidoodle's own)title?: string; subtitle?: string; genLabel?: string; accent?: string;+ // focus pulls: the header's and the composer's opacity while the camera is close on something else (default 1)+ head?: number; composer?: number;};// THE CHAT'S GEOMETRY. One chat component, laid out per frame shape (launchLayout.ts): the window,@@ -171,11 +173,13 @@ export const drawChatFrame = (ctx: Ctx, s: ChatState, g: ChatGeom = CHAT_GEOM) =softShadow(ctx, CHAT.x, CHAT.y, CHAT.w, CHAT.h, CHAT.r, 1.2);ctx.fillStyle = P.card; rr(ctx, CHAT.x, CHAT.y, CHAT.w, CHAT.h, CHAT.r); ctx.fill();// the thread's head: a small ink dot and a name, nothing that belongs to anyone else+ if (s.head !== undefined) ctx.globalAlpha = s.head;ctx.fillStyle = P.ink; ctx.beginPath(); ctx.arc(CHAT.x + 58 * k, CHAT.y + 52 * k, 9 * k, 0, Math.PI * 2); ctx.fill();ctx.font = SANS(600, px.head); ctx.fillStyle = P.ink; ctx.textBaseline = "middle"; ctx.fillText(s.title ?? "anidoodle", CHAT.x + 80 * k, CHAT.y + 53 * k);const subX = s.title === undefined ? CHAT.x + 196 * k : CHAT.x + 80 * k + ctx.measureText(s.title).width + 16 * k;ctx.font = SANS(500, px.sub); ctx.fillStyle = P.mute; ctx.fillText(s.subtitle ?? "drawn in code", subX, CHAT.y + 54 * k);ctx.fillStyle = P.line; ctx.fillRect(CHAT.x + 32 * k, CHAT.y + 98 * k, CHAT.w - 64 * k, 1.5 * k);+ if (s.head !== undefined) ctx.globalAlpha = 1;// the sent message, right alignedif (s.sent) {ctx.globalAlpha = s.sentAlpha ?? 1; ctx.font = SANS(500, px.bubble);@@ -188,6 +192,7 @@ export const drawChatFrame = (ctx: Ctx, s: ChatState, g: ChatGeom = CHAT_GEOM) =}if (s.label) { ctx.globalAlpha = s.labelAlpha ?? 1; ctx.fillStyle = P.ink; ctx.beginPath(); ctx.arc(REPLY.x + 9 * k, REPLY.y - 26 * k, 7 * k, 0, Math.PI * 2); ctx.fill(); ctx.font = SANS(600, px.label); ctx.textBaseline = "middle"; ctx.fillText(s.label, REPLY.x + 26 * k, REPLY.y - 25 * k); ctx.globalAlpha = 1; }// the composer+ if (s.composer !== undefined) ctx.globalAlpha = s.composer;ctx.fillStyle = P.paper; rr(ctx, INPUT.x, INPUT.y, INPUT.w, INPUT.h, INPUT.r); ctx.fill();ctx.lineWidth = 2 * k; ctx.strokeStyle = P.line; ctx.stroke();ctx.font = SANS(500, TEXT.px); ctx.textBaseline = "alphabetic";@@ -205,6 +210,7 @@ export const drawChatFrame = (ctx: Ctx, s: ChatState, g: ChatGeom = CHAT_GEOM) =const pr = s.genPress ?? 0, hot = s.genHot ?? 0, q = 1 - 0.07 * pr, gx = GEN.x + (GEN.w * (1 - q)) / 2, gy = GEN.y + (GEN.h * (1 - q)) / 2;ctx.fillStyle = hot > 0 ? mixHex(acc, s.accent ? deepen(acc) : P.accentDeep, 0.35 * hot + 0.4 * pr) : acc; rr(ctx, gx, gy, GEN.w * q, GEN.h * q, GEN.r * q); ctx.fill();ctx.fillStyle = "#fff"; ctx.font = SANS(600, px.gen * q); ctx.textBaseline = "middle"; ctx.textAlign = "center"; ctx.fillText(s.genLabel ?? "Generate", GEN.x + GEN.w / 2, GEN.y + GEN.h / 2 + 1 * k); ctx.textAlign = "left";+ if (s.composer !== undefined) ctx.globalAlpha = 1;};// where the caret is: the end of the typed words (on their last line in a wrapping composer)export const caretAt = (ctx: Ctx, typed: string, g: ChatGeom = CHAT_GEOM): P => {@@ -252,9 +258,9 @@ export const inkDropAt = (f: number, d: { t0: number; land: number }, to: P, g:// `grow` (default an out-cubic from land to full) is how open the card is at frame f: the template// passes a spring, so the card lands on the spring's first arrival and its sound cue can sit thereexport const inkCard = (ctx: Ctx, x: number, y: number, s: number, f: number, d: Drop, art: Layer, label: string, crop?: [number, number, number, number], g: ChatGeom = CHAT_GEOM, growAt?: (f: number) => number) => {- const k = g.k, P = pal(g);- ctx.fillStyle = P.ink; ctx.globalAlpha = ramp(f, d.land, d.land + 10); ctx.beginPath(); ctx.arc(x + 9 * k, y - 16 * k, 7 * k, 0, Math.PI * 2); ctx.fill();- ctx.font = SANS(600, g.px.label); ctx.textBaseline = "middle"; ctx.fillText(label, x + 26 * k, y - 15 * k); ctx.globalAlpha = 1;+ const k = g.k, P = pal(g), A = ctx.globalAlpha; // a card drawn under a focus pull keeps the caller's opacity+ ctx.fillStyle = P.ink; ctx.globalAlpha = A * ramp(f, d.land, d.land + 10); ctx.beginPath(); ctx.arc(x + 9 * k, y - 16 * k, 7 * k, 0, Math.PI * 2); ctx.fill();+ ctx.font = SANS(600, g.px.label); ctx.textBaseline = "middle"; ctx.fillText(label, x + 26 * k, y - 15 * k); ctx.globalAlpha = A;const grow = growAt ? growAt(f) : out3(ramp(f, d.land, d.full)), c: P = [x + s / 2, y + s / 2];softShadow(ctx, x, y, s, s, 20 * k, Math.min(1, grow) * 1.3);ctx.save(); rr(ctx, x, y, s, s, 20 * k); ctx.clip();diff --git a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts b/skills/anidoodle/engine/src/canvas-core/launchLayout.tsindex ee38c1e..bdb7402 100644--- a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchLayout.ts@@ -72,7 +72,8 @@ const desk = (c: LayoutContent): LaunchLayout => {bug: { x: W - 40, y: H - 34, px: 24 },type: { maxW: 1560, cap1: 190, capN: 130, minPx: MIN_PX.desk.type, cover: 1110 },end: { cx: W / 2, titleY: 400, titleMax: 150, titleW: 1300, tagline: [c.tagline], taglineY: 520, taglinePx: 30, taglineLH: 40, panelY: py, monoPx: 30, rowH: 60, padX: 60, lineY0: py + 55, footerPx: 24, footerY: py + ph + 60, caret: [16, 34] },- split: { words: { x: 130, y: 150, w: 640, h: 780 }, ui: { x: 840, y: 110, w: 960, h: 860 }, vertical: false, wordsPx: 96 },+ // a two-column grid on the frame's centre line: words 40 %, a 100 px gutter, the live UI 46 %, equal margins+ split: { words: { x: 150, y: 150, w: 720, h: 780 }, ui: { x: 970, y: 120, w: 800, h: 840 }, vertical: false, wordsPx: 96 },stage: { x: 0, y: 0, w: W, h: H }, band: null,roles: [],};diff --git a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/skills/anidoodle/engine/src/canvas-core/launchTemplate.tsindex 6b4dd99..44eaebd 100644--- a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts@@ -22,7 +22,7 @@//// export const myLaunch = makeLaunchFilm({ title: "Tally", asks: [...], words: [...], ... });// (or: node tools/launch.mjs new myLaunch; then node tools/launch.mjs ship myLaunch --shapes 16x9,9x16)-import type { Ctx, Env, P } from "./core";+import { probeRect, type Ctx, type Env, type P } from "./core";import type { Film } from "./film";import {C, SANS, MONO, camLerp, caretAt, charTimes, clamp, drawChatFrame, expo, inOut, inkCard, inkDrop,@@ -191,49 +191,68 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {if (clean) { c.setTransform(env.scale, 0, 0, env.scale, 0, 0); c.font = SANS(600, L.bug.px * 0.8); c.fillStyle = PAL.soft; c.textAlign = "right"; c.textBaseline = "alphabetic"; c.fillText(spec.title, L.bug.x, L.bug.y); c.textAlign = "left"; return; }writeOn(c, env, spec.title, L.bug.x, L.bug.y, L.bug.px, 1, "ink", { color: C.soft, align: "right", seed: 3 });};- const chat = (ctx: Ctx, env: Env, f: number, typed: string, caret: boolean, pr: number, hot: number) => {- drawChatFrame(ctx, { typed, caret, placeholder: spec.placeholder ?? "Describe what you want…", genPress: pr, genHot: hot, title: spec.title, subtitle: spec.subtitle ?? "", genLabel: spec.genLabel, accent: ACC }, G);- const sc = scrollAt(f);+ // focus: while the camera is close on the composer the thread recedes (it would be cut by the frame's+ // edge), and while it leans on a card everything but that card does; nothing is ever half off-frame+ // And whatever the camera's edge is about to cut fades before it does: an element's opacity is how+ // far inside the view it sits (full at 24 px in, none at the edge), so nothing shows half off-frame.+ type Focus = { macro: number; lean: number; keep: number; cam: Cam };+ const seen = (cam: Cam, x0: number, y0: number, x1: number, y1: number) => { const hw = W / 2 / cam.z, hh = H / 2 / cam.z, d = Math.min(x0 - (cam.c[0] - hw), cam.c[0] + hw - x1, y0 - (cam.c[1] - hh), cam.c[1] + hh - y1) * cam.z; return clamp(d / (24 * k)); };+ // (on a phone the close-up is nearly the whole window, so the header and thread stay, cut only by `seen`)+ const chat = (ctx: Ctx, env: Env, f: number, typed: string, caret: boolean, pr: number, hot: number, fo: Focus = { macro: 0, lean: 0, keep: -1, cam: CAM.home }, Gc: ChatGeom = G) => {+ const C0 = G.CHAT, mf = L.phone ? 0 : fo.macro, headA = Math.min(1 - mf, seen(fo.cam, C0.x + 40 * k, C0.y + 30 * k, C0.x + C0.w - 40 * k, C0.y + 76 * k)), compA = seen(fo.cam, Gc.INPUT.x, Gc.INPUT.y, Gc.INPUT.x + Gc.INPUT.w, Gc.INPUT.y + Gc.INPUT.h);+ drawChatFrame(ctx, { typed, caret, placeholder: spec.placeholder ?? "Describe what you want…", genPress: pr, genHot: hot, title: spec.title, subtitle: spec.subtitle ?? "", genLabel: spec.genLabel, accent: ACC, head: headA, composer: compA }, Gc);+ const sc = scrollAt(f), rest = (1 - mf) * (1 - fo.lean), [, cyT, , chH] = TH.clip;ctx.save(); ctx.beginPath(); ctx.rect(...TH.clip); ctx.clip();items.forEach((it, k) => {if (f < it.at) return;const y = ys[k] - sc; if (y > VIEW_BOTTOM || y + it.h < 100) return;+ // what of it the thread's window shows, and whether the camera shows all of that+ const vy0 = Math.max(y, cyT), vy1 = Math.min(y + it.h, cyT + chH), x0 = it.card !== undefined ? TH.cardX : TH.bubbleR - TH.bubbleMaxW, x1 = it.card !== undefined ? TH.cardX + CARD : TH.bubbleR;+ const A = (it.card === fo.keep ? 1 - mf : rest) * (vy1 > vy0 ? seen(fo.cam, x0, vy0, x1, vy1) : 1); if (A < 0.01) return;if (it.user !== undefined) {- ctx.globalAlpha = ramp(f, it.at, it.at + 8); ctx.font = SANS(500, G.px.bubble);+ ctx.globalAlpha = A * ramp(f, it.at, it.at + 8); ctx.font = SANS(500, G.px.bubble);const bw = Math.max(...it.lines!.map((l) => ctx.measureText(l).width)) + 2 * TH.bubblePad; ctx.fillStyle = PAL.chip; rr(ctx, TH.bubbleR - bw, y, bw, it.h - 2, TH.bubbleRad); ctx.fill();ctx.fillStyle = PAL.ink; ctx.textBaseline = "middle"; it.lines!.forEach((l, j) => ctx.fillText(l, TH.bubbleR - bw + TH.bubblePad, y + TH.bubbleH / 2 + j * TH.bubbleLineH)); ctx.globalAlpha = 1;} else {const i = it.card!, a = spec.asks[i] as PlateAsk;const d = T[i].drop, b = T[i].base;- inkCard(ctx, TH.cardX, y + TH.cardDy, CARD, f, { t0: b + d.t0, land: b + d.land, full: b + d.full }, plateLayer(env, `ask${i}`, a.plate, plateFrame(i, f), 1080), a.label, a.crop, G, growAt(i));+ { const py0 = Math.max(y + TH.cardDy, cyT), py1 = Math.min(y + TH.cardDy + CARD, cyT + chH); ctx.globalAlpha = A; if (py1 > py0) probeRect(ctx, env, TH.cardX, py0, CARD, py1 - py0, `answer card ${i}`); } // the part the thread's window shows+ inkCard(ctx, TH.cardX, y + TH.cardDy, CARD, f, { t0: b + d.t0, land: b + d.land, full: b + d.full }, plateLayer(env, `ask${i}`, a.plate, plateFrame(i, f), 1080), y + TH.cardDy - 30 * k > cyT ? a.label : "", a.crop, G, growAt(i)); // a byline scrolled under the window's top is not drawn at all+ ctx.globalAlpha = 1;}});ctx.restore();chatIdx.forEach((i) => { const t = T[i]; inkDrop(ctx, f, { t0: t.base + t.drop.t0, land: t.base + t.drop.land }, [TH.cardX + CARD / 2, cardY(i, t.base + t.drop.land) + CARD / 2], G); });};- // the camera: macro on the composer while typing, out to the room for the press, then a lean in on the new card+ // the camera: close on the composer while typing (the WHOLE composer in frame, so the typed words+ // never leave it), out to the room for the press, then a lean onto the new card, which stays whole+ // with a margin on every sideconst HOME = CAM.home;- const leanOn = (i: number): Cam => ({ c: lerpP(HOME.c, [TH.cardX + CARD / 2, cardY(i, T[i].base + T[i].len) + CARD / 2], 0.55), z: CAM.leanZ });- type CaretFn = (typed: string) => P;- // on a phone frame the words wrap, so the caret jumps back a line: the camera follows a smoothed- // caret (the mean of its last 10 frames), a glide down to the new line, never a jump- const phoneMacro = (caret: CaretFn, i: number, l: number, z: number): P => {- const half = W / 2 / z, lo = G.INPUT.x - 24 * k + half, hi = Math.max(lo, G.GEN.x + G.GEN.w + 30 * k - half);- let x = 0, y = 0; for (let j = 0; j < 10; j++) { const [cx, cy] = caret(typedAt((spec.asks[i] as PlateAsk).prompt, l - j, T[i].times)); x += clamp(cx - 110 * k, lo, hi); y += cy; }- const yLo = G.INPUT.y + H / 2 / z - 90 * k, yHi = G.INPUT.y + G.INPUT.h + 40 * k - H / 2 / z;- return [x / 10, clamp(y / 10, Math.min(yLo, yHi), Math.max(yLo, yHi))];+ const inView = (c: P, z: number): P => { const hw = W / 2 / z, hh = H / 2 / z; return [clamp(c[0], Math.min(hw, W - hw), Math.max(hw, W - hw)), clamp(c[1], Math.min(hh, H - hh), Math.max(hh, H - hh))]; };+ // (a phone composer is nearly the frame's width, so there the close-up IS the window: the empty state, creeping 3 %)+ const MZ = L.phone ? 1 : Math.max(1, Math.min(CAM.macroZ, (0.9 * W) / (G.INPUT.w + 48 * k), (0.8 * H) / (G.INPUT.h + 48 * k)) / 1.03);+ const leanOn = (i: number): Cam => {+ const cy = cardY(i, T[i].base + T[i].len), lab = 44 * k, box = { x: TH.cardX, y: cy - lab, w: CARD, h: CARD + lab }, m = 36 * k;+ const z = Math.max(1, Math.min(CAM.leanZ, (0.86 * W) / box.w, (0.86 * H) / box.h)), hw = W / 2 / z, hh = H / 2 / z;+ const c = lerpP(HOME.c, [box.x + box.w / 2, box.y + box.h / 2], 0.55);+ return { c: [clamp(c[0], box.x + box.w + m - hw, box.x - m + hw), clamp(c[1], box.y + box.h + m - hh, box.y - m + hh)], z };};+ type CaretFn = (typed: string) => P;const prevChat = (i: number) => i > 0 && isChat(spec.asks[i - 1]) && T[i].tin === 0;- // `lean` (0..1) is how far the camera leans in; the corner mark steps aside while it does, since- // the lean carries the composer under the corner and type never sits over the UI or the art- const camAt = (caret: CaretFn, f: number, i: number): { cam: Cam; lean: number } => {- const t = T[i], l = f - t.base, typed = typedAt((spec.asks[i] as PlateAsk).prompt, l, t.times), [cx] = caret(typed);- // the macro creeps in while the words arrive: the frame is never a still- const mz = CAM.macroZ + CAM.macroCreep * inOut(ramp(l, t.times[0] - 8, t.b));- const macro: Cam = { c: L.shape === "16x9" ? [Math.max(G.TEXT.x + CAM.macroX0, cx - 110), CAM.macroY] : phoneMacro(caret, i, l, mz), z: mz };- if (prevChat(i) && l < 16) { const q = inOut(ramp(l, 0, 16)); return { cam: camLerp(leanOn(i - 1), macro, q), lean: 1 - q }; }- if (l > t.drop.full - 10) { const q = inOut(ramp(l, t.drop.full - 10, t.len)); return { cam: camLerp(HOME, leanOn(i), q), lean: q }; }- return { cam: l < t.b - 4 ? macro : camLerp(macro, HOME, expo(ramp(l, t.b - 4, t.down))), lean: 0 };+ // the empty state: on a phone the first ask's composer starts in the middle of the empty thread (the+ // way a chat app opens) and docks at the bottom as Generate is pressed; the hook is the prompt, centred+ const liftDy = (i: number, l: number) => (L.phone && i === chatIdx[0] && !prevChat(i) ? (G.CHAT.y + G.CHAT.h * 0.52 - (G.INPUT.y + G.INPUT.h / 2)) * (1 - expo(ramp(l, T[i].b - 4, T[i].down))) : 0);+ const lifted = (dy: number): ChatGeom => (dy ? { ...G, INPUT: { ...G.INPUT, y: G.INPUT.y + dy }, GEN: { ...G.GEN, y: G.GEN.y + dy }, TEXT: { ...G.TEXT, base: G.TEXT.base + dy } } : G);+ // `lean` (0..1) is how far the camera leans in, `macro` how close it is on the composer; the corner+ // mark steps aside while it leans, since the lean carries the composer under the corner+ const camAt = (_caret: CaretFn, f: number, i: number): { cam: Cam; lean: number; macro: number; keep: number } => {+ const t = T[i], l = f - t.base;+ // the close-up creeps in while the words arrive: the frame is never a still+ const mz = MZ * (1 + 0.03 * ramp(l, -20, t.b)), dy = liftDy(i, l), macro: Cam = { c: inView([G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2 + dy], mz), z: mz };+ if (prevChat(i) && l < 16) { const q = inOut(ramp(l, 0, 16)); return { cam: camLerp(leanOn(i - 1), macro, q), lean: 1 - q, macro: q, keep: i - 1 }; }+ if (l > t.drop.full - 10) { const q = inOut(ramp(l, t.drop.full - 10, t.len)); return { cam: camLerp(HOME, leanOn(i), q), lean: q, macro: 0, keep: i }; }+ const w = l < t.b - 4 ? 1 : 1 - expo(ramp(l, t.b - 4, t.down));+ return { cam: l < t.b - 4 ? macro : camLerp(macro, HOME, expo(ramp(l, t.b - 4, t.down))), lean: 0, macro: w, keep: -1 };};// the same camera without a canvas (for the sound's pan): the caret from the build-time width estimateconst caretEst: CaretFn = (typed) => {@@ -245,13 +264,13 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {if (l >= t.b - 4 && l < t.up + 24) pointer(ctx, l < t.up + 4 ? lerpP(off, on, out3(ramp(l, t.b - 4, t.down))) : lerpP(on, off, inOut(ramp(l, t.up + 4, t.up + 24))), pr * 0.8, CAM.pointerS);};const chatScene = (ctx: Ctx, env: Env, f: number, i: number) => {- const t = T[i], l = f - t.base, caret: CaretFn = (s) => caretAt(ctx, s, G);- const { cam, lean } = camAt(caret, f, i);+ const t = T[i], l = f - t.base, Gc = lifted(liftDy(i, l)), caret: CaretFn = (s) => caretAt(ctx, s, Gc);+ const { cam, lean, macro, keep } = camAt(caret, f, i);useCam(ctx, env, cam);const typed = typedAt((spec.asks[i] as PlateAsk).prompt, l, t.times), pr = press(l, t.down, t.up);- chat(ctx, env, f, l < t.up ? typed : "", l < t.up, pr, ramp(l, t.down - 10, t.down - 2));+ chat(ctx, env, f, l < t.up ? typed : "", l < t.up, pr, ramp(l, t.down - 10, t.down - 2), { macro, lean, keep, cam }, Gc);// the pointer comes in for the press and glides back out; it never pops- pointerPath(ctx, l, t, CAM.pointerOn, pr);+ pointerPath(ctx, l, t, [CAM.pointerOn[0], CAM.pointerOn[1] + (Gc.GEN.y - G.GEN.y)], pr);// the mark is gone BEFORE the lean moves the composer under it, and back only once the camera has leftconst show = lean > 0 && l > ASK / 2 ? 1 - ramp(l, t.drop.full - 18, t.drop.full - 10) : prevChat(i) && l < 24 ? ramp(l, 16, 24) : 1;if (show > 0) { ctx.globalAlpha = show; bug(ctx, env); ctx.globalAlpha = 1; }@@ -265,10 +284,12 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {// a full-frame UI ask has the chat's camera grammar: close on the command bar while the ask is typed// (creeping in), out to the whole window for the press, then a lean onto the items as they landconst uiCam = (i: number, l: number): Cam => {- const a = spec.asks[i] as UiAsk, t = T[i], r = panelOf(i), win = uiWindow(r, a.ui, minPx), cmd = uiCommandAt(r, a.ui, minPx);- const lean: Cam = { c: lerpP(HOME.c, [win.x + win.w / 2, win.y + win.h * 0.6], 0.4), z: 1.07 };- if (l >= t.drop.t0) return camLerp(HOME, lean, inOut(ramp(l, t.drop.t0, t.len + 40))); // still moving when the ask ends- const z0 = cmd && a.prompt ? Math.min(2.2, (W * 0.92) / cmd.w) : 1.04, open: Cam = { c: cmd && a.prompt ? [cmd.x + cmd.w / 2, cmd.y + cmd.h / 2] : HOME.c, z: z0 * (1 + 0.06 * ramp(l, -20, t.b)) }; // already creeping on frame 0+ // the window stays whole in frame on every frame: the camera creeps toward it, eases back for the+ // press, then leans in as the items land, never closer than the window's own fit+ const a = spec.asks[i] as UiAsk, t = T[i], win = uiWindow(panelOf(i), a.ui, minPx), wc: P = [win.x + win.w / 2, win.y + win.h / 2];+ const fit = Math.max(1, Math.min((0.94 * W) / win.w, (0.92 * H) / win.h)), toward = (z: number): Cam => ({ c: inView(lerpP(HOME.c, wc, clamp((z - 1) / (fit - 1 || 1))), z), z });+ if (l >= t.drop.t0) return toward(1 + (fit - 1) * 0.9 * inOut(ramp(l, t.drop.t0, t.len + 40))); // still moving when the ask ends+ const open = toward(1 + (fit - 1) * 0.5 * ramp(l, -20, t.b)); // already creeping on frame 0return camLerp(open, HOME, expo(ramp(l, t.b - 4, t.down)));};const ground = (ctx: Ctx, env: Env) => { ctx.setTransform(env.scale, 0, 0, env.scale, 0, 0); ctx.fillStyle = PAL.bg; ctx.fillRect(0, 0, W, H); };@@ -276,6 +297,7 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {const a = spec.asks[i] as UiAsk, t = T[i], l = f - t.base, r = panelOf(i), pr = press(l, t.down, t.up);ground(ctx, env); if (a.split?.length) push(ctx, env, r, l, t.len, t.drop.t0); else useCam(ctx, env, uiCam(i, l));const typed = a.prompt ? typedAt(a.prompt, l, t.times) : "";+ { const w = uiWindow(r, a.ui, minPx); probeRect(ctx, env, w.x, w.y, w.w, w.h, "product window"); }drawProductUI(ctx, r, a.ui, { f: l, t0: t.drop.t0 }, THEME, { minPx, typed, caret: !!a.prompt && l < t.down, press: pr, hot: ramp(l, t.down - 10, t.down - 2), accent: ACC });pointerPath(ctx, l, t, (([x, y]) => [x + 14 * k, y + 8 * k] as P)(uiActionAt(r, a.ui, minPx)), pr);if (a.split?.length) splitWords(ctx, env, a.split, l, t.tin);@@ -293,13 +315,15 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {bug(ctx, env);};// words in their own column beside the live UI (stacked above it on a phone): sized to the column, written or set on- const splitLines = (lines: TypeLine[]) => { const col = L.split.words, out: TypeLine[] = []; for (const ln of lines) { const size = Math.min(L.split.wordsPx, (col.w / measure(ln.text, 100)) * 100); if (size >= L.split.wordsPx * 0.62 || !ln.text.includes(" ")) out.push(ln); else wrapEst(ln.text, L.split.wordsPx, col.w * 1.05).forEach((t) => out.push({ ...ln, text: t })); } return out; };+ // the words are the design of the beat: as large as their column allows (set type is wider than it is tall, so its cap is higher)+ const wordsCap = clean ? L.split.wordsPx * 1.6 : L.split.wordsPx, wOf = (t: string, sz: number) => (clean ? estWidth(t, sz) * 1.12 : measure(t, sz));+ const splitLines = (lines: TypeLine[]) => { const col = L.split.words, out: TypeLine[] = []; for (const ln of lines) { const size = Math.min(wordsCap, (col.w / wOf(ln.text, 100)) * 100); if (size >= wordsCap * 0.62 || !ln.text.includes(" ")) out.push(ln); else wrapEst(ln.text, wordsCap, col.w * 1.05).forEach((t) => out.push({ ...ln, text: t })); } return out; };const splitWords = (ctx: Ctx, env: Env, lines0: TypeLine[], l: number, tin: number) => {- const col = L.split.words, lines = splitLines(lines0), size = Math.min(L.split.wordsPx, ...lines.map((x) => (col.w / measure(x.text, 100)) * 100)), gap = size * 1.3;+ const col = L.split.words, lines = splitLines(lines0), size = Math.min(wordsCap, ...lines.map((x) => (col.w / wOf(x.text, 100)) * 100)), gap = size * (clean ? 1.08 : 1.3);const y0 = L.split.vertical ? col.y + size : col.y + col.h / 2 - ((lines.length - 1) * gap) / 2 + size * 0.35;lines.forEach((x, j) => {const p = ramp(l, tin + j * 12, tin + 18 + j * 12);- if (clean) setType(ctx, env, x.text, col.x, y0 + j * gap, size * 0.82, p, { color: x.color === C.accent ? THEME.accent : x.color ?? PAL.ink, weight: 800 });+ if (clean) setType(ctx, env, x.text, col.x, y0 + j * gap, size, p, { color: x.color === C.accent ? THEME.accent : x.color ?? PAL.ink, weight: 800 });else writeOn(ctx, env, x.text, col.x, y0 + j * gap, size, p, x.style, { color: x.color, align: "left", seed: 21 + j });});};@@ -311,10 +335,20 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {// ---------------------------------------------------------------- the motif: the drop that becomes the mark's dotconst MOTIF = spec.motif !== false;- const titleSize = clean ? Math.min(L.end.titleMax * 0.8, (L.end.titleW / (estWidth(spec.title, 100) * 1.1)) * 100) : Math.min(L.end.titleMax, (L.end.titleW / measure(spec.title, 100)) * 100);+ const titleSize = clean ? Math.min(L.end.titleMax * 1.6, (L.end.titleW / (estWidth(spec.title, 100) * 1.1)) * 100) : Math.min(L.end.titleMax, (L.end.titleW / measure(spec.title, 100)) * 100);+ // the clean end card is ONE centred group with presence: the wordmark large, the line under it,+ // the install block, the footer, stacked and centred in the frame (the drawn one keeps its layout)+ const END_L = (() => {+ if (!clean) return L.end;+ const E = L.end, n = spec.install.length, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, W * 0.8), tLH = Math.round(tp * 1.3);+ const mono = Math.min(E.monoPx * 1.35, ...spec.install.map((x) => (W * 0.86 - 2 * E.padX) / (x.length * 0.61))), rowH = Math.round(mono * 2), ph = rowH * n + 50 * k;+ const g1 = titleSize * 0.42, g2 = tLH * 0.9, g3 = spec.footer ? 44 * k : 0, block = titleSize * 0.74 + g1 + tl.length * tLH + g2 + ph + g3 + (spec.footer ? E.footerPx : 0);+ const titleY = (H - block) / 2 + titleSize * 0.74, taglineY = titleY + g1 + tLH / 2, panelY = taglineY + (tl.length - 0.5) * tLH + g2;+ return { ...E, titleY, tagline: tl, taglinePx: tp, taglineLH: tLH, taglineY, panelY, monoPx: mono, rowH, lineY0: panelY + 25 * k + rowH / 2, footerY: panelY + ph + g3 + E.footerPx / 2, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] as [number, number] };+ })();const titleW = clean ? estWidth(spec.title, titleSize) * 1.08 : measure(spec.title, titleSize);const dotR = titleSize * (clean ? 0.1 : 0.085), dotGap = titleSize * 0.1;- const P1: P = [L.end.cx + titleW / 2 - (dotGap + 2 * dotR) / 2 + dotGap + dotR, L.end.titleY - dotR * 1.05];+ const P1: P = [END_L.cx + titleW / 2 - (dotGap + 2 * dotR) / 2 + dotGap + dotR, END_L.titleY - dotR * 1.05];const coverFrom = (p: P) => Math.max(...[[0, 0], [W, 0], [0, H], [W, H]].map(([x, y]) => Math.hypot(x - p[0], y - p[1])));const RAD = coverFrom(P1) * 1.14, R0 = bloomRadius(2, 1e6, { inF: 16, close: false, radius: RAD }), RIM = Math.max(1, dotR - R0);// where the drop lifts off: Generate as the viewer sees it on the last chat ask (the card's centre if the lean hid it), the product's action, or the film's card@@ -346,7 +380,7 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {};// ---------------------------------------------------------------- the end cardconst endPage = (c: Ctx, env: Env, e: number) => {- const E = L.end, cx = E.cx, size = titleSize;+ const E = END_L, cx = E.cx, size = titleSize;// (with the motif the page blooms from the dot, wider and sooner: the name starts as it opens, so no frame waits)if (MOTIF) { const tx = P1[0] - dotR - dotGap; if (clean) setType(c, env, spec.title, tx, E.titleY, size, ramp(e, 4, 26), { align: "right", color: PAL.ink, weight: 800 }); else writeOn(c, env, spec.title, tx, E.titleY, size, ramp(e, 4, 40), "ink", { color: C.ink, align: "right", seed: 11 }); c.setTransform(env.scale, 0, 0, env.scale, 0, 0); c.fillStyle = INK; c.beginPath(); c.arc(P1[0], P1[1], dotR, 0, Math.PI * 2); c.fill(); }else if (clean) setType(c, env, spec.title, cx, E.titleY, size, ramp(e, 8, 30), { align: "center", color: PAL.ink, weight: 800 });@@ -391,7 +425,7 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {// a clean word page: a round iris, the lines SET (heavy sans, left-aligned at the margin, each rising into place)const cleanType = (ctx: Ctx, env: Env, lines: TypeLine[], local: number, len: number, under: (first: boolean) => void) => bloomFrame(ctx, env, local, len, under, (c) => {const nL = lines.length, maxW = L.type.maxW, x0 = (W - maxW) / 2;- const size = Math.min(nL === 1 ? 170 : 124, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = H / 2 - ((nL - 1) * gap) / 2 + size * 0.36;+ const size = Math.min(nL === 1 ? 220 : 170, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = H / 2 - ((nL - 1) * gap) / 2 + size * 0.36;lines.forEach((l, i) => setType(c, env, l.text, x0, y0 + i * gap, size, ramp(local, 14 + TYPE_O.lead + i * CLEAN_ST, 14 + TYPE_O.lead + 18 + i * CLEAN_ST), { color: l.color === C.accent ? THEME.accent : l.color ?? PAL.ink, weight: 800 }));bug(c, env);}, { W, H, ...bloomOpts, rim: 4, ink: THEME.accent, radius: TYPE_R });diff --git a/skills/anidoodle/engine/src/canvas-core/productUI.ts b/skills/anidoodle/engine/src/canvas-core/productUI.tsindex a5a7bb6..9a609ad 100644--- a/skills/anidoodle/engine/src/canvas-core/productUI.ts+++ b/skills/anidoodle/engine/src/canvas-core/productUI.ts@@ -43,8 +43,8 @@ export const springLand = (t0: number, omega = DEF.omega, zeta = DEF.zeta) => {// ---------------------------------------------------------------- geometrytype Geo = { u: number; win: Rect; px: { title: number; nav: number; row: number; small: number; value: number; stat: number }; head: Rect; action: Rect; command: Rect | null; stats: Rect | null; body: Rect; row: number };// the window is fitted to its content (rows at a comfortable height) and centred in the rectangle it is given-const geo = (r0: Rect, ui: ProductUI, minPx: number): Geo => {- const u = clamp(Math.min(r0.w / 880, r0.h / 640), 0.55, 2.4), f = (x: number, lo = minPx) => Math.max(x * u, lo);+const geo = (r0: Rect, ui: ProductUI, minPx: number): Geo => { // sized to own its panel: a 720 x 600 design at 1x+ const u = clamp(Math.min(r0.w / 720, r0.h / 600), 0.55, 2.4), f = (x: number, lo = minPx) => Math.max(x * u, lo);const px = { title: f(30), nav: f(20, minPx * 0.8), row: f(26), small: f(20, minPx * 0.8), value: f(26), stat: f(46) };const pad = 28 * u, headH = Math.max(76 * u, px.title * 2.1), cmdH = Math.max(66 * u, px.row * 2.3);const nStats = Math.max(ui.before.stats?.length ?? 0, ui.after.stats?.length ?? 0), statH = px.stat * 1.1 + px.small * 1.6 + 30 * u;diff --git a/skills/anidoodle/engine/src/hosts/page.ts b/skills/anidoodle/engine/src/hosts/page.tsindex 59a511d..d1422fb 100644--- a/skills/anidoodle/engine/src/hosts/page.ts+++ b/skills/anidoodle/engine/src/hosts/page.ts@@ -1,7 +1,7 @@// THE ONE GENERATED PAGE. Playwright, the HTML player and (Phase 5) Hyperframes all drive this// same page through window.FILM. Everything host-specific (DOM, clocks, asset decoding, Web// Audio) lives HERE; the art core never sees it.-import type { Ctx, Env, Layer } from "../canvas-core/core";+import type { Ctx, Env, Layer, ProbeRec } from "../canvas-core/core";import { Film, renderFrame, validate } from "../canvas-core/film";declare global { interface Window { FILM: unknown; __ASSETS__?: Record<string, string>; __BAKE_SRC__?: Record<string, string>; __ANIDOODLE_SRC__?: WeakMap<object, string>; __SHAPE__?: string } }@@ -40,7 +40,7 @@ export const mountFilm = (film: Film) => {const opts = film.meta.raster === "cpu" ? { willReadFrequently: true } : undefined; // see Film.meta.rasterconst surface = (w: number, h: number): Layer => { const c = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(w, h) : Object.assign(document.createElement("canvas"), { width: w, height: h }); return { canvas: c, ctx: c.getContext("2d", opts) as unknown as Ctx } as Layer; };const bakes = bakeStore(surface);- const mount = (scale = 1) => { canvas.width = Math.round(film.meta.W * scale); canvas.height = Math.round(film.meta.H * scale); ctx = canvas.getContext("2d", opts) as CanvasRenderingContext2D; env = { W: film.meta.W, H: film.meta.H, scale, cache: new Map(), canvas: surface, image: (n) => images.get(n), bake: bakes.bake }; return film.meta; };+ const mount = (scale = 1) => { canvas.width = Math.round(film.meta.W * scale); canvas.height = Math.round(film.meta.H * scale); ctx = canvas.getContext("2d", opts) as CanvasRenderingContext2D; env = { W: film.meta.W, H: film.meta.H, scale, cache: new Map(), canvas: surface, image: (n) => images.get(n), bake: bakes.bake, root: true }; return film.meta; };// contract rule 4: every asset is loaded AND decoded before frame 0, or the film refuses to startconst ready = (async () => {const problems = validate(film); if (problems.length) throw new Error("timeline: " + problems.join("; "));@@ -124,6 +124,32 @@ export const mountFilm = (film: Film) => {ctx.putImageData(img, 0, 0); current = n;return { shot: shot.id, ms: performance.now() - t0, samples, speed };};+ // THE FRAME PROBE (tools/framecheck.mjs). For each frame asked, every line of text (fillText on the+ // frame or a full-frame sheet, writeOn, setType) and every content box the art core reports+ // (probeRect: a card, a window) is collected in device pixels; a box the frame's edge cuts through+ // is returned. Whatever lies wholly outside the frame, or wholly inside it, is fine.+ const probe = (frames: number[]) => {+ const out: (ProbeRec & { frame: number })[] = [], g = globalThis as { __ANIDOODLE_PROBE__?: (r: ProbeRec) => void };+ const protos = [CanvasRenderingContext2D.prototype, ...(typeof OffscreenCanvasRenderingContext2D !== "undefined" ? [OffscreenCanvasRenderingContext2D.prototype] : [])] as unknown as { fillText: (t: string, x: number, y: number, w?: number) => void }[];+ const orig = protos.map((p) => p.fillText);+ let frame = 0, recs: ProbeRec[] = [];+ protos.forEach((p, i) => { p.fillText = function (this: Ctx & { __frame?: boolean }, t: string, x: number, y: number, w?: number) {+ if ((this === ctx || this.__frame) && this.globalAlpha >= 0.1 && String(t).trim()) {+ const m = this.measureText(t), a = this.textAlign, dx = a === "center" ? -m.width / 2 : a === "right" || a === "end" ? -m.width : 0, T = this.getTransform();+ const bx = [[x + dx, y - m.actualBoundingBoxAscent], [x + dx + m.width, y - m.actualBoundingBoxAscent], [x + dx, y + m.actualBoundingBoxDescent], [x + dx + m.width, y + m.actualBoundingBoxDescent]].map(([u, v]) => [T.a * u + T.c * v + T.e, T.b * u + T.d * v + T.f]);+ recs.push({ kind: "text", label: String(t), x0: Math.min(...bx.map((q) => q[0])), y0: Math.min(...bx.map((q) => q[1])), x1: Math.max(...bx.map((q) => q[0])), y1: Math.max(...bx.map((q) => q[1])) });+ }+ return (orig[i] as (t: string, x: number, y: number, w?: number) => void).call(this, t, x, y, w);+ }; });+ g.__ANIDOODLE_PROBE__ = (r) => recs.push(r);+ try {+ for (frame of frames) {+ recs = []; seek(frame); const W = canvas.width, H = canvas.height, tol = 1.5;+ for (const r of recs) { const inter = r.x1 > 0 && r.x0 < W && r.y1 > 0 && r.y0 < H, inside = r.x0 >= -tol && r.y0 >= -tol && r.x1 <= W + tol && r.y1 <= H + tol; if (inter && !inside) out.push({ ...r, frame }); }+ }+ } finally { protos.forEach((p, i) => (p.fillText = orig[i] as never)); delete g.__ANIDOODLE_PROBE__; }+ return out;+ };const audio = (sr: number) => { if (!film.audio) return null; const [L, R] = film.audio(sr); if (L.length !== R.length) throw new Error("audio channels have different lengths"); const pcm = new Float32Array(L.length * 2); for (let i = 0; i < L.length; i++) { pcm[i * 2] = L[i]; pcm[i * 2 + 1] = R[i]; } return { sampleRate: sr, frames: L.length, float32: b64(new Uint8Array(pcm.buffer)) }; };const warm = () => film.shots.forEach((s) => { seek(s.start); seek(s.start + ((s.end - s.start) >> 1)); }); // first + middle frame of every shot: builds tiles, pre-allocates the layer pool// POSTER. Platforms show frame 0 as the thumbnail, so a delivery may open on a chosen frame (the@@ -145,7 +171,7 @@ export const mountFilm = (film: Film) => {if (u > 0 && posterOf) { ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = Math.min(1, u); ctx.globalCompositeOperation = "source-over"; if (u >= 1) ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.drawImage(posterOf.img, 0, 0); ctx.restore(); }current = n; return r;};- window.FILM = { meta: { ...film.meta, hasAudio: typeof film.audio === "function", shots: film.shots.map(({ id, start, end }) => ({ id, start, end })) }, ready, mount, seek, hash, audio, warm, blur, poster, bakes: { load: bakes.load, take: bakes.take, hashes: bakes.hashes, stats: () => bakes.stats }, png: () => canvas.toDataURL("image/png").slice(22), frame: () => current };+ window.FILM = { probe, meta: { ...film.meta, hasAudio: typeof film.audio === "function", shots: film.shots.map(({ id, start, end }) => ({ id, start, end })) }, ready, mount, seek, hash, audio, warm, blur, poster, bakes: { load: bakes.load, take: bakes.take, hashes: bakes.hashes, stats: () => bakes.stats }, png: () => canvas.toDataURL("image/png").slice(22), frame: () => current };// ---- the player: click or space to play, arrows to step, ?frame=N to open on a frameready.then(() => {diff --git a/skills/anidoodle/engine/test/launchLayout.test.ts b/skills/anidoodle/engine/test/launchLayout.test.tsindex e188be6..bc10ce0 100644--- a/skills/anidoodle/engine/test/launchLayout.test.ts+++ b/skills/anidoodle/engine/test/launchLayout.test.ts@@ -44,5 +44,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(shapes.every((x, i) => x.meta.W === SHAPES[(Object.keys(SHAPES) as Shape[])[i]].W && x.meta.H === SHAPES[(Object.keys(SHAPES) as Shape[])[i]].H), "each shape renders at its own frame size");ok(f.reshape("16x9") === f && f.reshape("9x16") === f.reshape("9x16"), "reshape returns the film itself for its own shape, and one film per shape");const tall = fitWords([{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }], f.reshape("9x16").layout), wide = fitWords([{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }], f.layout);+ // a film ask (any film in a card) with its words beside it builds in every shape, its seam into the end card matched+ const fa = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content.prompts[0], plate, label: "l" }, { kind: "film", film: plate, split: [{ text: "Any film.", style: "ink", color: "#000" }] }], tagline: "t", install: ["npm i tally"], bpm: 90, score: null });+ ok((Object.keys(SHAPES) as Shape[]).every((sh) => fa.reshape(sh).seams.every((q) => Math.hypot(q.out.p[0] - q.into.p[0], q.out.p[1] - q.into.p[1]) < 2)), "a film ask builds in every shape, the motif's seam matched");ok(wide.length === 1 && tall.length === 2, `a word page re-sets its lines for a narrow frame (16x9: ${wide.length} line, 9x16: ${tall.map((l) => l.text).join(" / ")})`);};diff --git a/skills/anidoodle/engine/tools/adapters/playwright.mjs b/skills/anidoodle/engine/tools/adapters/playwright.mjsindex bd69776..07b47dd 100644--- a/skills/anidoodle/engine/tools/adapters/playwright.mjs+++ b/skills/anidoodle/engine/tools/adapters/playwright.mjs@@ -33,6 +33,8 @@ export const open = async ({ pw, browser: found }, pagePath, { scale = 1, worker// hash of the motion-blurred frame: what a --blur render actually writes, so the probe checks THATblurHash: (n, samples, w = 0) => pick(w).evaluate(([f, s]) => { window.FILM.blur(f, s); return window.FILM.hash(); }, [n, samples]),audio: (sr) => pages[0].evaluate((s) => window.FILM.audio(s), sr),+ // the frame probe (hosts/page.ts): text and content boxes the frame's edge cuts through+ probe: (frames) => pages[0].evaluate((fs) => window.FILM.probe(fs), frames),// keeps the fresh bakes, then closes; returns how many plate frames were storedclose: async () => { let saved = 0; if (useBakes) for (const p of pages) saved += await saveBakes(p, bv).catch(() => 0); await browser.close(); return saved; },};diff --git a/skills/anidoodle/engine/tools/framecheck.mjs b/skills/anidoodle/engine/tools/framecheck.mjsnew file mode 100644index 0000000..99620ca--- /dev/null+++ b/skills/anidoodle/engine/tools/framecheck.mjs@@ -0,0 +1,28 @@+// FRAMECHECK. A design fault the determinism gate cannot see: type or content cut by the frame's+// edge. Every line of text (fillText, writeOn, setType) and every content box the art reports+// (probeRect: an answer card, a product window, a film's card) must lie wholly inside the frame or+// wholly outside it, on every frame checked. A deliberate full-bleed is not reported as a box.+// node tools/framecheck.mjs <film>[-<shape>] [--every 1] [--from F] [--to T]+import { resolve } from "node:path";+import { buildPage } from "./build-page.mjs";+import { detect } from "./detect.mjs";+import * as playwright from "./adapters/playwright.mjs";+import { requireFilm } from "./names.mjs";++const pos = [], opt = {};+for (let i = 2; i < process.argv.length; i++) { const a = process.argv[i]; if (a.startsWith("--")) opt[a.slice(2)] = process.argv[++i]; else pos.push(a); }+const film = requireFilm(pos[0], "framecheck", "node tools/framecheck.mjs <film>[-<shape>] [--every 1] [--from F] [--to T]");+export const frameCheck = async (film, { every = 1, from = 0, to } = {}) => {+ const page = await buildPage({ entry: `src/hosts/page-${film}.ts`, out: resolve(`dist/${film}.html`), title: film });+ const s = await playwright.open(detect(), page.out, { workers: 1 }), meta = await s.info(), N = to ?? meta.durationFrames;+ const frames = []; for (let f = from; f < N; f += every) frames.push(f);+ const bad = []; for (let i = 0; i < frames.length; i += 40) bad.push(...(await s.probe(frames.slice(i, i + 40))));+ await s.close();+ return { meta, frames: frames.length, bad };+};+const r = await frameCheck(film, { every: Number(opt.every ?? 1), from: Number(opt.from ?? 0), to: opt.to === undefined ? undefined : Number(opt.to) });+const groups = new Map(); for (const b of r.bad) { const k = `${b.kind} "${b.label.slice(0, 48)}"`; const g = groups.get(k) ?? []; g.push(b.frame); groups.set(k, g); }+console.log(`FRAMECHECK ${film} ${r.meta.W}x${r.meta.H}, ${r.frames} frames`);+for (const [k, fs] of groups) { const b = r.bad.find((x) => `${x.kind} "${x.label.slice(0, 48)}"` === k); console.log(` FAIL ${k} cut by the frame's edge on ${fs.length} frame(s): ${fs.slice(0, 8).join(", ")}${fs.length > 8 ? " ..." : ""} box ${[b.x0, b.y0, b.x1, b.y1].map((v) => Math.round(v)).join(",")}`); }+console.log(r.bad.length ? `FRAMECHECK: FAIL ${groups.size} item(s) cut by the frame's edge` : `FRAMECHECK: PASS no text or content box cut by the frame's edge`);+process.exit(r.bad.length ? 1 : 0);diff --git a/skills/anidoodle/engine/tools/launch.mjs b/skills/anidoodle/engine/tools/launch.mjsindex 6ba209f..900ba70 100644--- a/skills/anidoodle/engine/tools/launch.mjs+++ b/skills/anidoodle/engine/tools/launch.mjs@@ -13,7 +13,8 @@// 3 captions out/<name>-<shape>.srt and .vtt (the sidecar; captions: "burn" also burns them in)// 4 verify verify-export --delivery: size, frame count, duration, the score, the sync of every// marker, the true peak after the encode, a legible frame 0-// 5 gate with --gate: gate.mjs (determinism, contract, dead air) on the rendered file+// 5 frame framecheck.mjs: no text and no card or window cut by the frame's edge, every frame+// 6 gate with --gate: gate.mjs (determinism, contract, dead air) on the rendered file// then one table. Exit 1 if any shape fails anything.import { spawnSync } from "node:child_process";import { existsSync, mkdirSync, writeFileSync } from "node:fs";@@ -104,7 +105,7 @@ const quiet = (args) => { const r = spawnSync(process.execPath, args, { encodingmkdirSync(resolve("out"), { recursive: true });const rows = [];for (const sh of shapes) {- const f = `${film}-${sh}`, mp4 = `out/${f}.mp4`, row = { shape: sh, mp4, render: false, poster: "", captions: 0, verify: "", gate: "" };+ const f = `${film}-${sh}`, mp4 = `out/${f}.mp4`, row = { shape: sh, mp4, render: false, poster: "", captions: 0, verify: "", frame: "", gate: "" };console.log(`\n==================== ${f} ====================`);row.render = node(["tools/render.mjs", f, ...pass]);if (row.render) {@@ -113,12 +114,13 @@ for (const sh of shapes) {row.captions = (await writeCaptions(f)).count;const v = quiet(["tools/verify-export.mjs", f, "--file", mp4, "--delivery"]); console.log(v.out.split("\n").filter((l) => /FAIL|PASS (frame|true peak|decoded)|VERIFY-EXPORT/.test(l)).join("\n"));row.verify = (v.out.match(/VERIFY-EXPORT: (PASS|FAIL)[^\n]*/) ?? ["", "FAIL"])[0].replace("VERIFY-EXPORT: ", "");+ const fc = quiet(["tools/framecheck.mjs", f]); row.frame = (fc.out.match(/FRAMECHECK: (PASS|FAIL)[^\n]*/) ?? ["", "FAIL"])[0].replace("FRAMECHECK: ", ""); if (!fc.ok) console.log(fc.out.split("\n").filter((l) => /FAIL/.test(l)).join("\n"));if (rest.includes("--gate")) { const g = quiet(["tools/gate.mjs", f, "--mp4", mp4]); row.gate = (g.out.match(/GATE: (PASS|FAIL)[^\n]*/) ?? [g.ok ? "PASS" : "FAIL"])[0]; if (!g.ok) console.log(g.out.split("\n").filter((l) => /FAIL/.test(l)).join("\n")); }}rows.push(row);}console.log(`\nSHIP ${film}`);-for (const r of rows) console.log(` ${r.shape.padEnd(5)} ${r.render ? r.mp4 : "RENDER FAILED"}\n verify ${r.verify || "-"}${r.gate ? ` gate ${r.gate}` : ""}\n poster ${r.poster || "-"} captions ${r.captions} cues -> out/${film}-${r.shape}.srt/.vtt`);-const ok = rows.every((r) => r.render && /^PASS/.test(r.verify) && r.poster !== "FAIL" && (!r.gate || /PASS/.test(r.gate)));+for (const r of rows) console.log(` ${r.shape.padEnd(5)} ${r.render ? r.mp4 : "RENDER FAILED"}\n verify ${r.verify || "-"}\n frame ${r.frame || "-"}${r.gate ? `\n gate ${r.gate}` : ""}\n poster ${r.poster || "-"} captions ${r.captions} cues -> out/${film}-${r.shape}.srt/.vtt`);+const ok = rows.every((r) => r.render && /^PASS/.test(r.verify) && /^PASS/.test(r.frame) && r.poster !== "FAIL" && (!r.gate || /PASS/.test(r.gate)));console.log(ok ? `\nSHIP: PASS ${rows.length} shape(s)` : "\nSHIP: FAIL");process.exit(ok ? 0 : 1);diff --git a/skills/anidoodle/references/workflows/launch-video-kit.md b/skills/anidoodle/references/workflows/launch-video-kit.mdindex fff4a32..7cd5f06 100644--- a/skills/anidoodle/references/workflows/launch-video-kit.md+++ b/skills/anidoodle/references/workflows/launch-video-kit.md@@ -8,7 +8,7 @@ product. The rules they serve are in `launch-video.md`.`launchTemplate.ts` turns data into a film: one to three asks, a type frame between them, and anend card with your install lines. `launchExample.ts` is a complete one for a made-up product (thedrawn look, chat asks); `launchExampleClean.ts` is the second look on a UI-first product (the-product's own UI, a split beat, a film in a card, 60 fps). Copy their shape, not their contents:+product's own UI in three screens, two of them split beats, 60 fps). Copy their shape, not their contents:the plates, the UI data and the score are the product's own, made for its brief.```bash@@ -20,7 +20,27 @@ node tools/launch.mjs ship myLaunch --shapes 16x9,1x1,9x16 --blur auto --gate`ship` renders every shape to `out/myLaunch-<shape>.mp4`, writes its poster (`.poster.png`, thefilm's own legible frame) and its captions (`.srt`, `.vtt`), runs `verify-export --delivery` on eachfile (size, frames, score, A/V sync at every marker, the true peak after the encode, a legible frame-0) and, with `--gate`, the gate; one table at the end, exit 1 if any shape fails.+0), `framecheck.mjs` on every frame (no text, no card, no product window cut by the frame's edge)+and, with `--gate`, the gate; one table at the end, exit 1 if any shape fails.++### Design review checklist (every shape, before anything ships)++The gate proves a film is deterministic; it cannot see whether it is well designed. Review the+contact sheet of EVERY shape against this list, and fix, never waive:++- **No clipped type.** Every word a viewer reads is whole on every frame: the typed prompt, the+ bubbles, the labels, the words, the install lines. `framecheck.mjs` (run by `ship`) fails any+ line of text the frame's edge cuts through.+- **No edge-cropped content.** A card, a product window, a film's card sits whole in the frame+ with a margin, unless it is a deliberate full-bleed (the whole frame is that one thing). What+ the camera is about to cut fades before it does. `framecheck.mjs` checks the cards and windows.+- **Balanced composition per shape.** The subject owns the frame (a product UI about 70-80 % of a+ 16x9 frame's width), a split beat is a real two-column grid with the words sized as the design,+ the end card is one centred group with presence; no big dead areas, nothing huddled in a corner.+- **Coherent example content.** Every ask shows THIS product: its UI, its plates, its words. No+ stock plate or another product's screen inside a film about something else.+- **Judge design, not only collisions**: hierarchy, spacing, whether each frame would pass as a+ poster.```tsimport { C } from "./launchKit";@@ -46,10 +66,12 @@ export const myLaunch = makeLaunchFilm({What you get, from data:-- **Chat asks** (`kind` omitted): the first prompt already being typed at frame 0 in a close-up (a- hook that reads muted), the camera easing out for the press, an ink drop arcing from Generate+- **Chat asks** (`kind` omitted): the first prompt already being typed at frame 0, the whole+ composer in frame so every typed word stays readable (a hook that reads muted; on a phone frame+ the composer starts in the middle of the empty thread and docks on send, the way a chat app opens), the camera easing out for the press, an ink drop arcing from Generateinto the thread and blooming open into a card where the plate draws itself live (the card opens- on a spring), the thread keeping earlier answers and scrolling, a gentle lean onto each new card.+ on a spring), the thread keeping earlier answers and scrolling, a gentle lean onto each new card that keeps it whole with a margin (what the camera is about+ to cut fades first).- **UI asks** (`kind: "ui"`): the product's interface drawn from data (`productUI.ts`) in its`before` state; the ask typed into its command bar if it has a `prompt`; the pointer presses its`action`; every item springs to its place in the `after` state (matched by `id`: rows move,@@ -95,8 +117,8 @@ identity, by title and by content (the same novelty gate `music.mjs check` runs)`shape: "16x9" | "1x1" | "4x5" | "9x16"` (or `film.reshape(shape)`, or the film name`myLaunch-9x16` in any tool) composes the same cut for another frame through `launchLayout.ts`:the chat window, composer and card are laid out for the frame (a phone composer wraps the prompt-and the camera glides after the caret, a line at a time), word pages re-set their lines, the split-beat stacks, the end card stacks and centres. The timing, the cut and the sound do not change.+and the camera keeps the whole composer in frame), word pages re-set their lines, the split beat+stacks, the end card stacks and centres. The timing, the cut and the sound do not change.Every line a viewer must read is phone-safe on 1x1, 4x5 and 9x16: at least 32 px at 1080 across(about 11 pt on a phone) for prompts, bubbles, card labels, tagline and install lines, 64 px for aword page; the layout throws with the fix when one cannot be (an install line too long for 9x16).diff --git a/skills/anidoodle/references/workflows/launch-video.md b/skills/anidoodle/references/workflows/launch-video.mdindex 5345d05..d0651c7 100644--- a/skills/anidoodle/references/workflows/launch-video.md+++ b/skills/anidoodle/references/workflows/launch-video.md@@ -161,7 +161,10 @@ into place), round iris seams, the product's own UI. Pick one per film; never mifirst (type over art, spacing, hierarchy), then timing. Render only the changed range(`render.mjs --from F --to T` writes `out/<film>.<F>-<T>.mp4`, silent). Give notes in camera words ("slow this zoom to 0.7x","hold the word 10 frames longer"), never "make it better".-8. **QA**: `launch.mjs ship <film> --shapes ... --gate` runs, for EVERY shape shipped, the gate+8. **QA**: review every shape's contact sheet against the design checklist in+ `launch-video-kit.md` (no clipped type, no edge-cropped content, balanced per shape, coherent+ content). `launch.mjs ship <film> --shapes ... --gate` runs, for EVERY shape shipped, `framecheck`+ (text and cards whole on every frame), the gate(determinism, contract, dead air; declare real holds in `meta.holds`, each with its reason)and `verify-export --delivery` (size, frames, score, sync, true peak, a legible frame 0), andwrites the poster and captions; add `verify-export <film>-<shape> --first-frame #rrggbb` for a