Skip to content

Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.

launch 9:16: every line inside the platforms' safe zones; ship fails zone hits by default

Alex Greenshpunc825f5c661c8
diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchCut.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchCut.ts
index 57b17bf..9576c66 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchCut.ts
+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchCut.ts
@@ -84,12 +84,12 @@ export const bloomFrame = (ctx: Ctx, env: Env, local: number, len: number, under
// `bug` draws a corner brand mark on the page (the logo recurs on every frame of the film).
// `lead`: when the first line starts, relative to the bloom being open (default -2); `stagger`: frames
// between lines (default 20); a line takes 18 frames to write.
-export type TypeOpts = BloomOpts & { maxW?: number; lead?: number; stagger?: number };
+export type TypeOpts = BloomOpts & { maxW?: number; lead?: number; stagger?: number; text?: P }; // text: the words' centre (default the frame's)
export const typeFrame = (ctx: Ctx, env: Env, lines: TypeLine[], local: number, len: number, under: (first: boolean) => void, bug?: (c: Ctx) => void, o: TypeOpts = {}) => {
const IN = o.inF ?? 14, W = o.W ?? 1920, H = o.H ?? 1080, maxW = o.maxW ?? 1560, lead = o.lead ?? -2, st = o.stagger ?? 20;
bloomFrame(ctx, env, local, len, under, (c) => {
- const n = lines.length, size = Math.min(n === 1 ? 190 : 130, ...lines.map((l) => (maxW / measure(l.text, 100)) * 100)), gap = size * 1.45, y0 = H / 2 - ((n - 1) * gap) / 2 + size * 0.5;
- lines.forEach((l, i) => writeOn(c, env, l.text, W / 2, y0 + i * gap, size, ramp(local, IN + lead + i * st, IN + lead + 18 + i * st), l.style, { color: l.color, align: "center", seed: 7 + i }));
+ const n = lines.length, size = Math.min(n === 1 ? 190 : 130, ...lines.map((l) => (maxW / measure(l.text, 100)) * 100)), gap = size * 1.45, y0 = (o.text ? o.text[1] : H / 2) - ((n - 1) * gap) / 2 + size * 0.5;
+ lines.forEach((l, i) => writeOn(c, env, l.text, o.text ? o.text[0] : W / 2, y0 + i * gap, size, ramp(local, IN + lead + i * st, IN + lead + 18 + i * st), l.style, { color: l.color, align: "center", seed: 7 + i }));
bug?.(c);
}, o);
};
diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
index bdb7402..6e0e048 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
@@ -13,6 +13,7 @@
// L.split a feature beat: the words' column and the live UI's, which never overlap
// L.stage / L.band the picture's area and, with captions burned in, the captions' own band
// L.roles every text role and its size, which launchLayout checks against minPx
+// L.safe / L.zones where text may sit: on 9x16 inside the platforms' safe zones (PHONE_SAFE), else the frame
import { CHAT_GEOM, chatGeom, type ChatGeom, type Rect } from "./launchKit";
import type { Cam } from "./launchKit";
import type { P } from "./core";
@@ -31,6 +32,16 @@ export const parseShapes = (s: string): Shape[] => {
if (bad.length || !out.length) throw new Error(`shapes: '${bad.join(", ") || s}' is not a shape; use ${Object.keys(SHAPES).join(", ")}`);
return out as Shape[];
};
+// The 9:16 platform safe zones: Reels, TikTok and Shorts lay their own interface over the top band, the
+// bottom band and a right-hand column of buttons. Shares of the frame: top and bottom of its height,
+// right of its width. tools/textrules.mjs checks rendered frames against the same numbers (a unit test
+// holds the two equal). They apply to 9x16 only; the feed shapes have no such overlay.
+export const PHONE_SAFE = { top: 0.14, bottom: 0.25, right: 0.14 } as const;
+/** The rectangle a W x H frame leaves free of the platforms' interface (the whole frame for a shape the zones do not apply to). */
+export const safeRect = (shape: Shape, W: number, H: number): Rect => shape === "9x16" ? { x: 0, y: H * PHONE_SAFE.top, w: W * (1 - PHONE_SAFE.right), h: H * (1 - PHONE_SAFE.top - PHONE_SAFE.bottom) } : { x: 0, y: 0, w: W, h: H };
+// on 9x16 the layout keeps this far inside a zone's line (a zone's edge is not a visible edge, so the gap is small)
+const ZONE_GAP = 8;
+
// phone-safe minimums, px at the delivered size: `read` = a line the viewer must read (a prompt, a
// label, the words, the install lines); `chrome` = the UI around them (a header, a button's word)
export const MIN_PX = { phone: { read: 32, chrome: 24, type: 64 }, desk: { read: 18, chrome: 16, type: 80 } };
@@ -54,10 +65,12 @@ export type LaunchLayout = {
thread: { top: number; viewBottom: number; clip: [number, number, number, number]; bubbleH: number; bubbleLineH: number; bubblePad: number; bubbleR: number; bubbleMaxW: number; bubbleRad: number; gap: number; card: number; cardX: number; cardDy: number; bubbles: string[][] };
cam: { home: Cam; macroZ: number; macroCreep: number; macroX0: number; macroY: number; follow: boolean; leanZ: number; pointerOff: P; pointerS: number; pointerOn: P };
bug: { x: number; y: number; px: number };
- type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number };
+ type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number; at?: P }; // at: the words' centre when it is not the frame's
end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };
split: { words: Rect; ui: Rect; vertical: boolean; wordsPx: number };
stage: Rect; band: Rect | null;
+ uiFull: Rect; // a product-UI ask's panel when it has no words beside it
+ safe: Rect; zones: boolean;
roles: Role[];
};
export type LayoutContent = { prompts: string[]; install: string[]; tagline: string; title?: string; band?: boolean };
@@ -75,17 +88,25 @@ const desk = (c: LayoutContent): LaunchLayout => {
// 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,
+ uiFull: { x: 250, y: 90, w: 1420, h: 880 }, safe: { x: 0, y: 0, w: W, h: H }, zones: false,
roles: [],
};
};
-// the phone compositions: one column, the chat as tall as the frame allows, type sizes floored at the phone minimums
-const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number): LaunchLayout => {
- const W = 1080, H = H0, m = 40, k = { "1x1": 1.12, "4x5": 1.22, "9x16": 1.36 }[shape], min = MIN_PX.phone;
+// the phone compositions: one column, the chat as tall as the frame allows, type sizes floored at the phone minimums.
+// Each is composed inside E, the edges it treats as its frame: the frame itself for 1x1 and 4x5; on 9x16
+// the safe rectangle S, so every line a viewer reads stays clear of the platforms' interface (the picture's
+// background still fills the whole frame). E sits `m - ZONE_GAP` outside a zone's line, so the margins
+// leave ZONE_GAP against a zone and the full margin m against the frame's own left edge.
+const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: Rect): LaunchLayout => {
+ // (9x16 composes inside its safe rectangle, about a 4x5 frame's worth of room, so it takes 4x5's scale)
+ const W = 1080, H = H0, m = 40, k = { "1x1": 1.12, "4x5": 1.22, "9x16": 1.22 }[shape], min = MIN_PX.phone, zones = shape === "9x16";
+ const E = zones ? { x0: 0, y0: S.y - (m - ZONE_GAP), x1: S.x + S.w + (m - ZONE_GAP), y1: Math.min(S.y + S.h, H) } : { x0: 0, y0: 0, x1: W, y1: H };
+ const Ew = E.x1 - E.x0, Eh = E.y1 - E.y0;
const px = { head: Math.max(22 * k, min.chrome), sub: Math.max(18 * k, min.chrome), bubble: Math.max(26 * k, min.read), label: Math.max(20 * k, min.read), gen: Math.max(24 * k, min.chrome) };
// the window stops above the corner mark's own strip: the mark never sits on the UI
const bugPx = Math.max(24 * k, min.chrome), bugStrip = Math.round(bugPx + 34);
- const promptPx = Math.max(34 * k, min.read), chatR = { x: m, y: m, w: W - 2 * m, h: H - m - bugStrip, r: 34 * k };
+ const promptPx = Math.max(34 * k, min.read), chatR = { x: E.x0 + m, y: E.y0 + m, w: Ew - 2 * m, h: Eh - m - bugStrip, r: 34 * k };
// the composer holds the longest prompt; the button sits on its last line
const base = chatGeom(chatR, k, px, promptPx, 1), textW = base.GEN.x - 20 * k - base.TEXT.x;
const lines = Math.min(3, Math.max(1, ...c.prompts.map((p) => wrapEst(p, promptPx, textW).length)));
@@ -95,31 +116,40 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number): Lau
// the answer card: as wide as the thread allows, and short enough that a card and the prompt above it both fit the view
const card = Math.round(Math.min(g.INPUT.w, viewBottom - top - 58 * k - 2 * bubbleLineH - 60 * k));
const cardX = g.CHAT.x + (g.CHAT.w - card) / 2;
- // the end card, stacked and centred in the frame
- const mono = Math.min(30 * k, ...c.install.map((s) => (W - 2 * 32 - 2 * 36) / (s.length * 0.61)));
- const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, W - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);
+ // the end card, stacked and centred in E
+ const mono = Math.min(30 * k, ...c.install.map((s) => (Ew - 2 * 32 - 2 * 36) / (s.length * 0.61)));
+ const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, Ew - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);
const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * c.install.length + 50 * k;
- const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = (H - block) / 2 - 20;
+ const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = E.y0 + (Eh - block) / 2 - 20;
const titleY = y0 + titleMax * 0.62, taglineY = y0 + titleMax + 60 + tLH / 2, panelY = taglineY + (tagline.length - 0.5) * tLH + 50;
- const split = shape === "9x16"
- ? { words: { x: 90, y: 150, w: W - 180, h: 520 }, ui: { x: m + 20, y: 720, w: W - 2 * m - 40, h: H - 720 - 150 }, vertical: true, wordsPx: 96 }
+ // the split beat, stacked: the words on top, the live UI under them. On 9x16 both sit in the window's
+ // rectangle, and the UI is inset so its push (12 % at most) never carries its text past that rectangle.
+ const PUSH = 1.12, R = { x: chatR.x, y: chatR.y, w: chatR.w, h: chatR.h };
+ const wordsH = Math.round(R.h * 0.32), uiTop = R.y + wordsH + 30, uiW = Math.floor(R.w / PUSH), uiH = Math.floor((R.y + R.h - uiTop) / PUSH);
+ const split = zones
+ ? { words: { x: R.x + 20, y: R.y + 10, w: R.w - 40, h: wordsH }, ui: { x: Math.round(R.x + (R.w - uiW) / 2), y: Math.round(uiTop + (R.y + R.h - uiTop - uiH) / 2), w: uiW, h: uiH }, vertical: true, wordsPx: 96 }
: { words: { x: 80, y: 90, w: W - 160, h: Math.round(H * 0.3) }, ui: { x: m + 20, y: Math.round(H * 0.3) + 130, w: W - 2 * m - 40, h: H - Math.round(H * 0.3) - 130 - 90 }, vertical: true, wordsPx: shape === "1x1" ? 76 : 84 };
+ // a UI ask on its own: on 9x16 the window's rectangle less 6 %, the room its camera creeps into
+ const uiFull = zones ? { x: Math.round(R.x + R.w * 0.03), y: Math.round(R.y + R.h * 0.03), w: Math.round(R.w * 0.94), h: Math.round(R.h * 0.94) } : { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) };
// the hook: the prompt big, the camera gliding after the caret (and down a line when the words wrap)
const macroZ = { "1x1": 1.85, "4x5": 1.95, "9x16": 2.05 }[shape];
return {
shape, W, H, k, phone: true, chat: g,
thread: { top, viewBottom, clip: [g.CHAT.x, g.CHAT.y + 102 * k, g.CHAT.w, viewBottom - (g.CHAT.y + 102 * k)], bubbleH: 58 * k + (px.bubble - 26 * k) * 1.2, bubbleLineH, bubblePad: 26 * k, bubbleR: g.INPUT.x + g.INPUT.w, bubbleMaxW, bubbleRad: 22 * k, gap: 26 * k, card, cardX, cardDy: 34 * k + (px.label - 20 * k), bubbles },
- cam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },
- bug: { x: W - m - 10, y: H - bugStrip / 2 + bugPx * 0.1, px: bugPx },
- type: { maxW: W - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9 },
- end: { cx: W / 2, titleY, titleMax, titleW: W - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },
- split, stage: { x: 0, y: 0, w: W, h: H }, band: null,
+ // on 9x16 the lean on a new card goes further: the card is smaller there, and the rest of the window fades as it leaves the safe area
+ cam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: zones ? 1.5 : 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },
+ bug: { x: E.x1 - m - 10, y: E.y1 - bugStrip / 2 + bugPx * 0.1, px: bugPx },
+ type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: [E.x0 + Ew / 2, R.y + R.h / 2] as P } : {}) },
+ end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },
+ split, stage: { x: 0, y: 0, w: W, h: H }, band: null, uiFull, safe: S, zones,
roles: [],
};
};
// the caption band, when captions are burned in: its own strip under the picture, never over it.
// The layout is composed for the picture's area (the stage), and the band is drawn below it.
+// On 9x16 the band sits at the bottom of the safe rectangle (captions are text a viewer reads), and the
+// strip under it, in the platforms' bottom zone, is the picture's background.
const BAND = { "16x9": 0, "1x1": 150, "4x5": 170, "9x16": 230 };
/** The layout of a launch film in `shape`, for this content. Throws when a line a viewer must read cannot be phone-safe. */
@@ -128,8 +158,9 @@ export const launchLayout = (shape: Shape, c: LayoutContent): LaunchLayout => {
const { W, H } = SHAPES[shape], band = c.band ? BAND[shape] : 0;
if (c.band && shape === "16x9") throw new Error("launchLayout 16x9: burned-in captions are for the phone shapes (1x1, 4x5, 9x16); a 16x9 film ships its captions as a .srt/.vtt sidecar");
// (a wide frame plays where sidecar captions work, YouTube, LinkedIn, the site: its captions ship as .srt/.vtt)
- const L = shape === "16x9" ? desk(c) : phone(shape, c, H - band);
- L.H = H; L.stage = { x: 0, y: 0, w: W, h: H - band }; L.band = band ? { x: 0, y: H - band, w: W, h: band } : null;
+ const S = safeRect(shape, W, H), bandY = !band ? H : shape === "9x16" ? S.y + S.h - band : H - band;
+ const L = shape === "16x9" ? desk(c) : phone(shape, c, bandY, S);
+ L.H = H; L.stage = { x: 0, y: 0, w: W, h: bandY }; L.band = band ? { x: 0, y: bandY, w: W, h: band } : null;
const min = L.phone ? MIN_PX.phone : MIN_PX.desk, g = L.chat;
L.roles = [
{ role: "prompt", px: g.TEXT.px, min: min.read }, { role: "bubble", px: g.px.bubble, min: min.read }, { role: "card label", px: g.px.label, min: min.read },
diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
index c9391ce..27bbe47 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
@@ -157,7 +157,11 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const G: ChatGeom = clean ? { ...L.chat, theme: CLEAN, drop: INK, iris: true } : L.chat;
const W = L.W, H = L.stage.h, TH = L.thread, CAM = L.cam, CARD = TH.card, VIEW_BOTTOM = TH.viewBottom, k = G.k, minPx = L.phone ? 32 : 18;
const GEN_C: P = [G.GEN.x + G.GEN.w / 2, G.GEN.y + G.GEN.h / 2];
- const UI_FULL: Rect = L.phone ? { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) } : { x: 250, y: 90, w: 1420, h: 880 };
+ const UI_FULL: Rect = L.uiFull;
+ // 9x16: text stays inside the platforms' safe rectangle SAFE (launchLayout.PHONE_SAFE). The camera's
+ // close-ups zoom about a point that stays put, and whatever a move carries toward a zone fades first.
+ const ZONES = L.zones, SAFE = L.safe, SC: P = [SAFE.x + SAFE.w / 2, SAFE.y + SAFE.h / 2];
+ const about = (p: P, z: number): P => [p[0] - (p[0] - W / 2) / z, p[1] - (p[1] - H / 2) / z]; // a camera at zoom z that leaves world point p where it is on screen
const THEME: UiTheme = { bg: PAL.bg, card: PAL.card, ink: PAL.ink, soft: PAL.soft, mute: PAL.mute, line: PAL.line, chip: PAL.chip, accent: ACC ?? PAL.accent, paper: PAL.paper };
// ---------------------------------------------------------------- the beat grid and the asks' lengths (30 fps units; 60 fps draws between them)
@@ -200,8 +204,14 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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 9x16 the edge that counts is the safe rectangle's, so text fades before it reaches a zone; the fade
+ // is short, ZONE_FADE px, because the hook's composer spans the window and a zone's line is not a visible edge)
+ const ZONE_FADE = 8;
+ const seenSafe = (cam: Cam, x0: number, y0: number, x1: number, y1: number) => { const [a, b] = toScreen(cam, [x0, y0], W, H), [c, d] = toScreen(cam, [x1, y1], W, H); return clamp(Math.min(a - SAFE.x, SAFE.x + SAFE.w - c, b - SAFE.y, SAFE.y + SAFE.h - d) / ZONE_FADE); };
+ const seen = ZONES ? seenSafe : (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`)
+ // a card's width with its byline, which can run past the card (an estimate that errs wide)
+ const cardSpan = (i: number) => Math.max(CARD, 26 * k + estWidth((spec.asks[i] as PlateAsk).label, G.px.label));
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 || Gc !== G ? 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, composerGeom: Gc === G ? undefined : Gc }, G);
@@ -209,9 +219,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
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;
+ const y = ys[k] - sc; if (y > VIEW_BOTTOM || y + it.h < (ZONES ? cyT : 100)) return; // (on 9x16 an item scrolled wholly under the window's top is not drawn)
// 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 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 + (ZONES ? cardSpan(it.card) : 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 = A * ramp(f, it.at, it.at + 8); ctx.font = SANS(500, G.px.bubble);
@@ -236,7 +246,13 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// (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 cy = cardY(i, T[i].base + T[i].len), lab = 44 * k, box = { x: TH.cardX, y: cy - lab, w: ZONES ? cardSpan(i) : CARD, h: CARD + lab }, m = 36 * k;
+ if (ZONES) {
+ // 9x16: the card and its byline centred in the safe rectangle, as large as it allows up to leanZ
+ const S = SAFE, z = Math.max(1, Math.min(CAM.leanZ, (0.86 * S.w) / box.w, (0.86 * S.h) / box.h)), bc: P = [box.x + box.w / 2, box.y + box.h / 2];
+ const c: P = [bc[0] - (SC[0] - W / 2) / z, bc[1] - (SC[1] - H / 2) / z];
+ return { c: [clamp(c[0], box.x + box.w - (S.x + S.w - m - W / 2) / z, box.x - (S.x + m - W / 2) / z), clamp(c[1], box.y + box.h - (S.y + S.h - m - H / 2) / z, box.y - (S.y + m - H / 2) / z)], z };
+ }
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 };
@@ -250,12 +266,15 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// which shrinks and docks at the bottom of the chat as Generate is pressed.
const HERO = (() => {
if (!isChat(spec.asks[0])) return null;
- const prompt = spec.asks[0].prompt, min = L.phone ? 64 : 56, inW = Math.min(L.phone ? W * 0.9 : W * 0.72, G.CHAT.w - 60 * k); // most of the width, inside the chat window
+ const prompt = spec.asks[0].prompt, min = L.phone ? 64 : 56, inW = ZONES ? G.CHAT.w - 24 : Math.min(L.phone ? W * 0.9 : W * 0.72, G.CHAT.w - 60 * k); // most of the width, inside the chat window (on 9x16 all of it: the window is narrower there)
for (let px = L.phone ? 76 : 68; px >= min; px -= 2) {
const kh = px / 34, genW = 166 * kh, textW = inW - 44 * kh - genW - 44 * kh, lines = wrapEst(prompt, px, textW).length;
if (lines > 3 && px > min) continue;
if (lines > 3) throw new Error(`launchTemplate ${shape}: the first prompt "${prompt}" needs ${lines} lines at the hook's ${min} px; shorten it (the hook must read muted in the first 2 s)`);
- const h = 104 * kh + (lines - 1) * Math.round(px * 1.3), fake = { x: (W - inW) / 2 - 60 * kh, y: 0, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh };
+ // centred in the frame, or on 9x16 in the chat window (which is centred in the safe rectangle)
+ const h = 104 * kh + (lines - 1) * Math.round(px * 1.3), fake = ZONES
+ ? { x: G.CHAT.x + (G.CHAT.w - inW) / 2 - 60 * kh, y: G.CHAT.y + G.CHAT.h / 2 - H * 0.5, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh }
+ : { x: (W - inW) / 2 - 60 * kh, y: 0, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh };
const g = chatGeom(fake, kh, { ...G.px, gen: 24 * kh }, px, lines, genW);
return { ...g, CHAT: G.CHAT, theme: G.theme, drop: G.drop, iris: G.iris } as ChatGeom;
}
@@ -274,7 +293,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const t = T[i], l = f - t.base;
// the close-up creeps in while the words arrive: the frame is never a still
// (the hero hook is its own close-up: the camera holds the whole frame, creeping 2 %)
- const hero = !!HERO && i === 0, mz = hero ? 1 + 0.02 * ramp(l, -20, t.b) : MZ * (1 + 0.03 * ramp(l, -20, t.b)), macro: Cam = { c: inView(hero ? HOME.c : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], mz), z: mz };
+ const hero = !!HERO && i === 0, mz = hero ? 1 + 0.02 * ramp(l, -20, t.b) : MZ * (1 + 0.03 * ramp(l, -20, t.b));
+ // (9x16: the creep is about the window's centre for the hook, the composer's otherwise, so neither moves toward a zone)
+ const macro: Cam = ZONES ? { c: inView(about(hero ? [G.CHAT.x + G.CHAT.w / 2, G.CHAT.y + G.CHAT.h / 2] : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], mz), mz), z: mz } : { c: inView(hero ? HOME.c : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], 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));
@@ -313,7 +334,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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 });
+ // (9x16: fitted to the safe rectangle, and zooming about the window's centre, which never moves)
+ const fit = ZONES ? Math.max(1, Math.min((0.94 * SAFE.w) / win.w, (0.92 * SAFE.h) / win.h)) : Math.max(1, Math.min((0.94 * W) / win.w, (0.92 * H) / win.h));
+ const toward = (z: number): Cam => (ZONES ? { c: inView(about(wc, z), z), z } : { c: inView(lerpP(HOME.c, wc, clamp((z - 1) / (fit - 1 || 1))), z), z });
if (l >= t.down) return toward(1 + (fit - 1) * 0.9 * inOut(ramp(l, t.down, t.len + 40))); // from the press on, never resting; still moving when the ask ends
const open = toward(1 + (fit - 1) * 0.5 * ramp(l, -20, t.b)); // already creeping on frame 0
return camLerp(open, HOME, expo(ramp(l, t.b - 4, t.down)));
@@ -366,10 +389,11 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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;
+ // (9x16: measured on the safe rectangle's width and centred on its height)
+ const AW = ZONES ? SAFE.w - 24 : W, E = L.end, n = spec.install.length, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);
+ const mono = Math.min(E.monoPx * 1.35, ...spec.install.map((x) => (AW * 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;
+ const titleY = (ZONES ? SAFE.y * 2 + SAFE.h - block : 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);
@@ -451,15 +475,15 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const cut = makeCut(segs);
// 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 ? 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;
+ const nL = lines.length, maxW = L.type.maxW, at = L.type.at, x0 = at ? at[0] - maxW / 2 : (W - maxW) / 2;
+ const size = Math.min(nL === 1 ? 220 : 170, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = (at ? at[1] : 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 });
// a word page's bloom is sized to the frame it covers (the desktop's 1250 px over a 1110 px cover):
// on a smaller frame a fixed bloom would cover it before the words start, and two frames would match
const TYPE_R = L.shape === "16x9" ? undefined : Math.round((1250 * L.type.cover) / 1110);
- const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R };
+ const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at } : {}) };
const drawStage = (ctx: Ctx, env: Env, t: number) => {
const { s, local } = cut.at(t), exact = Number.isInteger(t);
if (s.kind === "pic") content(ctx, env, cut.contentOf(s, local), exact);
@@ -485,11 +509,13 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const capAt = (t: number) => caps.find((c) => t >= c.from && t < c.to);
const band = (ctx: Ctx, env: Env, t: number) => {
const B = L.band!; ctx.setTransform(env.scale, 0, 0, env.scale, 0, 0);
+ if (B.y + B.h < L.H) { ctx.fillStyle = PAL.bg; ctx.fillRect(0, B.y + B.h, W, L.H - B.y - B.h); } // 9x16: under the band, the platforms' bottom zone: background only
ctx.fillStyle = PAL.card; ctx.fillRect(B.x, B.y, B.w, B.h); ctx.fillStyle = PAL.line; ctx.fillRect(B.x, B.y, B.w, 2);
const c = capAt(t); if (!c) return;
- const px = Math.max(36, Math.round(B.h * 0.2)), lines = wrapEst(c.text, px, B.w - 120).slice(0, 2), a = Math.min(ramp(t, c.from, c.from + 6), 1 - ramp(t, c.to - 6, c.to));
+ const TX = ZONES ? { x: SAFE.x, w: SAFE.w } : B; // the caption's own column: on 9x16 clear of the right-hand buttons
+ const px = Math.max(36, Math.round(B.h * 0.2)), lines = wrapEst(c.text, px, TX.w - 120).slice(0, 2), a = Math.min(ramp(t, c.from, c.from + 6), 1 - ramp(t, c.to - 6, c.to));
ctx.globalAlpha = a; ctx.fillStyle = PAL.ink; ctx.font = SANS(600, px); ctx.textAlign = "center"; ctx.textBaseline = "middle";
- lines.forEach((l, j) => ctx.fillText(l, B.x + B.w / 2, B.y + B.h / 2 + (j - (lines.length - 1) / 2) * px * 1.25)); ctx.globalAlpha = 1; ctx.textAlign = "left";
+ lines.forEach((l, j) => ctx.fillText(l, TX.x + TX.w / 2, B.y + B.h / 2 + (j - (lines.length - 1) / 2) * px * 1.25)); ctx.globalAlpha = 1; ctx.textAlign = "left";
};
const draw = (ctx: Ctx, F: number, env: Env) => {
const t = F / m;
diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts
index 3e58c9c..81caed3 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts
+++ b/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts
@@ -2,7 +2,7 @@
// chat, the cards, the word pages, the split beat, the end card), every line a viewer reads is at
// least the phone-safe size, nothing sits over anything else, and 16x9 is the desktop film exactly.
import { CHAT_GEOM, chatGeom, CHAT } from "../src/canvas-core/launchKit";
-import { launchLayout, SHAPES, MIN_PX, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";
+import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";
import { makeLaunchFilm, fitWords } from "../src/canvas-core/launchTemplate";
import type { Film } from "../src/canvas-core/film";
@@ -14,8 +14,11 @@ export const name = "launchLayout";
export const run = (ok: (cond: boolean, label: string) => void) => {
const g = chatGeom(CHAT, 1, CHAT_GEOM.px, 34, 0);
ok(JSON.stringify([g.CHAT, g.INPUT, g.GEN, g.REPLY.x, g.REPLY.y, g.TEXT]) === JSON.stringify([CHAT_GEOM.CHAT, CHAT_GEOM.INPUT, CHAT_GEOM.GEN, CHAT_GEOM.REPLY.x, CHAT_GEOM.REPLY.y, CHAT_GEOM.TEXT]), "the chat derivation at k = 1 IS the desktop chat (one component, not two)");
- const content = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };
+ const content0 = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };
+ // anidoodle's own install lines (47 characters) cannot be 32 px mono inside 9x16's safe width, so 9x16 is laid out with shorter ones
+ const phoneContent = { ...content0, install: ["npm install your-product", "your-product init"] };
for (const shape of Object.keys(SHAPES) as Shape[]) {
+ const content = shape === "9x16" ? phoneContent : content0;
const L = launchLayout(shape, content), frame = { x: 0, y: 0, w: L.W, h: L.H }, c = L.chat;
ok(L.W === SHAPES[shape].W && L.H === SHAPES[shape].H, `${shape}: the frame is ${L.W}x${L.H}`);
const small = L.roles.filter((r) => r.px < r.min);
@@ -29,23 +32,36 @@ export const run = (ok: (cond: boolean, label: string) => void) => {
ok(pw <= L.W, `${shape}: the install panel (${pw.toFixed(0)} px at ${L.end.monoPx.toFixed(1)} px mono) fits the frame's width`);
ok(L.end.titleY < L.end.taglineY && L.end.taglineY < L.end.panelY && L.end.footerY < L.stage.h, `${shape}: the end card stacks title, line, panel, footer, all in frame`);
ok(!overlap(L.split.words, L.split.ui) && inside(L.split.words, L.stage) && inside(L.split.ui, L.stage), `${shape}: a split beat's words and live UI have their own areas (${L.split.vertical ? "stacked" : "side by side"})`);
- if (L.phone) { const B = launchLayout(shape, { ...content, band: true }); ok(!!B.band && !overlap(B.band, B.stage) && B.band.y + B.band.h === B.H, `${shape}: burned-in captions get their own band under the picture (${B.band?.h} px)`); }
+ if (L.phone) { const B = launchLayout(shape, { ...content, band: true }); ok(!!B.band && !overlap(B.band, B.stage) && B.band.y + B.band.h === (B.zones ? B.safe.y + B.safe.h : B.H), `${shape}: burned-in captions get their own band under the picture (${B.band?.h} px${B.zones ? ", at the safe rectangle's bottom" : ""})`); }
+ // the 9:16 platform safe zones: every rectangle that holds text sits inside the safe rectangle; other shapes have none
+ if (shape !== "9x16") { ok(!L.zones && JSON.stringify(L.safe) === JSON.stringify(frame), `${shape}: no safe zones (the whole frame is free for text)`); continue; }
+ const S = L.safe, E = L.end, pushed = (r: R, z: number) => ({ x: r.x + r.w / 2 - (r.w * z) / 2, y: r.y + r.h / 2 - (r.h * z) / 2, w: r.w * z, h: r.h * z });
+ ok(L.zones && Math.abs(S.y - L.H * PHONE_SAFE.top) < 1e-9 && Math.abs(S.x + S.w - L.W * (1 - PHONE_SAFE.right)) < 1e-9 && Math.abs(S.y + S.h - L.H * (1 - PHONE_SAFE.bottom)) < 1e-9, `9x16: the safe rectangle is the frame less the top ${Math.round(PHONE_SAFE.top * 100)} %, bottom ${Math.round(PHONE_SAFE.bottom * 100)} % and right ${Math.round(PHONE_SAFE.right * 100)} %`);
+ ok(inside(c.CHAT, S), `9x16: the chat window, and every line in it, sits inside the safe rectangle (${[c.CHAT.x, c.CHAT.y, c.CHAT.x + c.CHAT.w, c.CHAT.y + c.CHAT.h].map((v) => v.toFixed(0)).join(",")})`);
+ ok(inside(L.split.words, S) && inside(pushed(L.split.ui, 1.12), S), "9x16: the split beat's words and its live UI, pushed in to its fullest 12 %, sit inside the safe rectangle");
+ ok(inside(pushed(L.uiFull, 1.06), S), "9x16: a UI ask on its own leaves its camera room to creep without leaving the safe rectangle");
+ const bugW = estWidth("Your Product", L.bug.px) * 1.2;
+ ok(inside({ x: L.bug.x - bugW, y: L.bug.y - L.bug.px, w: bugW, h: L.bug.px * 1.3 }, S), "9x16: the corner mark sits inside the safe rectangle");
+ const at = L.type.at!; ok(!!at && inside({ x: at[0] - L.type.maxW / 2, y: at[1] - 10, w: L.type.maxW, h: 20 }, S), "9x16: a word page's lines are centred in the safe rectangle and no wider than it");
+ const pw0 = Math.max(...content.install.map((x) => monoWidth(x, E.monoPx))) + 2 * E.padX;
+ ok(inside({ x: E.cx - Math.max(E.titleW, pw0) / 2, y: E.titleY - E.titleMax, w: Math.max(E.titleW, pw0), h: E.footerY + E.footerPx - (E.titleY - E.titleMax) }, S), "9x16: the end card (name, line, install panel, footer) sits inside the safe rectangle");
}
- let err = ""; try { launchLayout("16x9", { ...content, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");
- err = ""; try { launchLayout("9x16", { ...content, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);
+ let err = ""; try { launchLayout("16x9", { ...content0, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");
+ err = ""; try { launchLayout("9x16", content0); } catch (e) { err = (e as Error).message; } ok(/install lines would be .*Shorten the install line/.test(err), `9x16 refuses an install line too long for the safe width at 32 px: ${err.slice(0, 80)}`);
+ err = ""; try { launchLayout("9x16", { ...content0, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);
ok(parseShapes("16x9, 9x16").join() === "16x9,9x16", "parseShapes reads a --shapes list");
err = ""; try { parseShapes("16x10"); } catch (e) { err = (e as Error).message; } ok(/not a shape/.test(err), "parseShapes refuses an unknown shape");
// one timeline, every shape: the same cut and length, a different composition
const plate: Film = { meta: { title: "plate", W: 1080, H: 1080, fps: 30, bpm: 90, durationFrames: 60 }, assets: { images: {} }, shots: [{ id: "p", start: 0, end: 60, draw: () => {} }] };
- const f = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content.prompts[0], plate, label: "l" }, { prompt: content.prompts[1], plate, label: "l" }], words: [[{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }]], tagline: content.tagline, install: ["npm i tally"], bpm: 90, claimBar: 4, score: null });
+ const f = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content0.prompts[0], plate, label: "l" }, { prompt: content0.prompts[1], plate, label: "l" }], words: [[{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }]], tagline: content0.tagline, install: ["npm i tally"], bpm: 90, claimBar: 4, score: null });
const shapes = (Object.keys(SHAPES) as Shape[]).map((s) => f.reshape(s));
ok(shapes.every((x) => x.meta.durationFrames === f.meta.durationFrames && JSON.stringify(x.cut.STARTS) === JSON.stringify(f.cut.STARTS)), `every shape is the same cut (${f.meta.durationFrames} frames, cuts at ${f.cut.STARTS.join(", ")})`);
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 });
+ const fa = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content0.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");
// the hook: the first prompt is the hero, large enough to read muted in the first 2 s, in every shape
ok((Object.keys(SHAPES) as Shape[]).every((sh) => { const x = f.reshape(sh); return (x.heroPx ?? 0) >= (x.layout.phone ? 64 : 56); }), `the first prompt is the hero: ${(Object.keys(SHAPES) as Shape[]).map((sh) => `${sh} ${f.reshape(sh).heroPx} px`).join(", ")} (>= 64 on a phone frame, 56 on 16x9)`);
diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/textrules.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/textrules.test.ts
index 0e30534..310f139 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/test/textrules.test.ts
+++ b/plugins/anidoodle/skills/anidoodle/engine/test/textrules.test.ts
@@ -2,9 +2,12 @@
// including the failing cases: a cue that is too short, text under the platforms' buttons.
// @ts-ignore: a plain ES module shared with the tools
import { SAFE_ZONES, isPortrait916, readingNeed, readingTime, safeZoneHits, zoneRects } from "../tools/textrules.mjs";
+import { PHONE_SAFE } from "../src/canvas-core/launchLayout";
export const name = "textrules";
export const run = (ok: (cond: boolean, label: string) => void) => {
+ // one set of numbers: the layout composes inside PHONE_SAFE, framecheck checks against SAFE_ZONES
+ ok(JSON.stringify(SAFE_ZONES) === JSON.stringify(PHONE_SAFE), `the checked safe zones are the ones the launch layout composes for (${JSON.stringify(SAFE_ZONES)})`);
// ---- reading time: max(0.7 s, 0.3 s per word)
ok(readingNeed("Hi") === 0.7 && readingNeed("one two") === 0.7, "one or two words need the 0.7 s floor");
ok(Math.abs(readingNeed("one two three four five six") - 1.8) < 1e-9, "six words need 1.8 s (0.3 s each)");
diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/framecheck.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/framecheck.mjs
index 09d963c..f4079b8 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/tools/framecheck.mjs
+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/framecheck.mjs
@@ -8,9 +8,8 @@
// button column the platforms cover with their own interface. Other shapes report N/A.
// The rules and their numbers are textrules.mjs.
// node tools/framecheck.mjs <film>[-<shape>] [--every 1] [--from F] [--to T] [--zones fail|warn]
-// --zones warn lists safe-zone text as FLAG and does not fail the run (launch.mjs ship uses it, because
-// the launch template's phone layouts are a chat window across the whole frame; --strict-zones there
-// makes it fail). Reading time and the edge cut always fail.
+// --zones warn lists safe-zone text as FLAG and does not fail the run (launch.mjs ship passes it on with
+// its own --zones warn; by default safe-zone text fails). Reading time and the edge cut always fail.
import { resolve } from "node:path";
import { buildPage } from "./build-page.mjs";
import { detect } from "./detect.mjs";
diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs
index 92048f1..02e4ad4 100644
--- a/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs
+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs
@@ -7,7 +7,7 @@
// It renders as it is (placeholder plates and UI), so the pipeline can be proved before the art.
//
// node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180]
-// [--poster-frame N] [--gate] [--strict-zones]
+// [--poster-frame N] [--gate] [--zones warn]
// for each shape, from ONE timeline (launchLayout re-composes it, never a crop):
// 1 render out/<name>-<shape>.mp4 (render.mjs; --blur/--shutter/--poster-frame pass through)
// 2 poster out/<name>-<shape>.poster.png, the film's own legible frame (meta.poster: the end card)
@@ -16,7 +16,7 @@
// marker, the true peak after the encode, a legible frame 0
// 5 frame framecheck.mjs: no text and no card or window cut by the frame's edge, every frame;
// each text cue up for max(0.7 s, 0.3 s per word) (N/A without cues); on 9:16 no text in
-// the platforms' top, bottom or right-hand zones (FLAG only; --strict-zones makes it fail)
+// the platforms' top, bottom or right-hand zones (it fails the shape; --zones warn only flags it)
// 6 gate with --gate: gate.mjs (determinism, contract, dead air) on the rendered file
// and once for the film, before the shapes: facts.mjs, every claim it makes is listed in facts.json
// with its source (a film that makes no claims is N/A). Then one table. Exit 1 if anything fails.
@@ -31,7 +31,7 @@ import { initFacts, readFacts } from "./facts.mjs";
const [cmd, name, ...rest] = process.argv.slice(2);
const arg = (k, d) => { const i = rest.indexOf(`--${k}`); return i >= 0 ? rest[i + 1] : d; };
const die = (m) => { console.error(`launch: ${m}`); process.exit(2); };
-const USAGE = "node tools/launch.mjs new <name> [--preset drawn|clean]\n node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180] [--poster-frame N] [--gate] [--strict-zones]";
+const USAGE = "node tools/launch.mjs new <name> [--preset drawn|clean]\n node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180] [--poster-frame N] [--gate] [--zones warn]";
const DRAWN = (n) => `// ${n}: a launch film on the template (references/workflows/launch-video-kit.md).
// Fill every TODO from the sourced brief (references/workflows/launch-video.md, "Ground it in the real
@@ -113,7 +113,8 @@ const pass = ["blur", "shutter", "poster-frame", "blur-max", "blur-px"].flatMap(
const node = (args) => spawnSync(process.execPath, args, { stdio: "inherit" }).status === 0;
const quiet = (args) => { const r = spawnSync(process.execPath, args, { encoding: "utf8", maxBuffer: 1 << 26 }); return { ok: r.status === 0, out: (r.stdout ?? "") + (r.stderr ?? "") }; };
mkdirSync(resolve("out"), { recursive: true });
-const rows = [], zoneMode = rest.includes("--strict-zones") ? "fail" : "warn";
+const zoneMode = arg("zones", "fail"); if (!["fail", "warn"].includes(zoneMode)) die(`--zones is fail or warn, got '${zoneMode}'\nusage: ${USAGE}`);
+const rows = [];
const fx = readFacts(resolve("facts.json")), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);
console.log(`\nFACTS ${film}: ${factsRes.status}${factsRes.status === "N/A" ? ` ${factsRes.reason}` : ` ${factsRes.checked} claim(s)`}`);
for (const p of factsRes.problems) console.log(` FAIL "${p.claim.slice(0, 60)}" ${p.why}`);
diff --git a/plugins/anidoodle/skills/anidoodle/references/formats.md b/plugins/anidoodle/skills/anidoodle/references/formats.md
index 7a0a984..a619741 100644
--- a/plugins/anidoodle/skills/anidoodle/references/formats.md
+++ b/plugins/anidoodle/skills/anidoodle/references/formats.md
@@ -97,10 +97,11 @@ Words on screen, wherever the shape:
of the height, and the right 14 % of the width (the button column) between them. The shares are
the cautious end of the creator safe-area guidance those apps publish for vertical video,
rounded up; their layouts change, so re-check before a campaign. `framecheck.mjs` finds text in
- those zones on any 9:16 frame (`SAFE-ZONES`); on `launch.mjs ship` it is a FLAG that does not
- fail the shape, because the launch template's phone layouts are a chat window across the whole
- frame; `--strict-zones` makes it fail. Other shapes report N/A. Burned-in captions
- (`captions: "burn"`) sit in the bottom zone by design: for those feeds, ship the sidecar.
+ those zones on any 9:16 frame (`SAFE-ZONES`) and `launch.mjs ship` fails the shape for it
+ (`--zones warn` only flags it). The launch template composes its 9:16 layout inside the safe
+ rectangle: the chat, the words, the split beat, the end card and the corner mark, with burned-in
+ captions (`captions: "burn"`) in a band at the safe rectangle's bottom. The background still fills
+ the frame. Other shapes report N/A.
- **Claims** in a film, on screen or spoken, are listed with their sources in `facts.json`
(`workflows/facts.md`).
diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md
index 3d0fd27..8cd32c5 100644
--- a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md
+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video-kit.md
@@ -35,8 +35,8 @@ contact sheet of EVERY shape against this list, and fix, never waive:
- **Time to read.** Each text up at least `max(0.7 s, 0.3 s per word)`, and never over a busy picture
without a plate (`craft-bar.md`). `framecheck.mjs` fails a declared cue held too briefly.
- **Phone safe zones on 9:16.** No text in the top 14 %, the bottom 25 % or the right 14 % of the
- frame, where the platforms put their own interface (`formats.md`). `ship` flags it per shape;
- `--strict-zones` fails it.
+ frame, where the platforms put their own interface (`formats.md`). `ship` fails the shape for it;
+ `--zones warn` only flags it. The template's 9:16 layout already keeps every line inside.
- **Every claim sourced.** The words, the tagline and any extra `claims` in the spec are listed in
`facts.json` with their source sentence and URL or file (`workflows/facts.md`); `ship` checks it.
- **No edge-cropped content.** A card, a product window, a film's card sits whole in the frame
diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md
index 277a173..4e9847a 100644
--- a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md
+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md
@@ -144,10 +144,11 @@ into place), round iris seams, the product's own UI. Pick one per film; never mi
- **Shapes**: `16x9` for YouTube and the site, `1x1` or `4x5` for feeds, `9x16` for Reels and
Shorts. Re-compose per shape from one timeline; never crop a wide render. The template does it
through `launchLayout.ts` (`launch.mjs ship <film> --shapes 16x9,1x1,9x16`), with phone-safe type:
- every line a viewer reads at least 32 px at 1080 across on the phone shapes.
+ every line a viewer reads at least 32 px at 1080 across on the phone shapes, and on 9x16 inside the
+ platforms' safe zones (`formats.md`).
- **Captions**: feeds autoplay muted. Ship `.srt`/`.vtt` for players that take a sidecar (YouTube,
LinkedIn, the site); burn them into their OWN band under the picture for feeds that do not
- (`captions: "burn"`), never over the art.
+ (`captions: "burn"`), never over the art; on 9x16 the band sits at the bottom of the safe zones.
- **Sync and peak are checked on the file you ship**, not the master: the sound at every sync
marker within 1 ms of the mix, the true peak at or under -1 dBTP after the AAC encode
(`verify-export --delivery`).
diff --git a/skills/anidoodle/engine/src/canvas-core/launchCut.ts b/skills/anidoodle/engine/src/canvas-core/launchCut.ts
index 57b17bf..9576c66 100644
--- a/skills/anidoodle/engine/src/canvas-core/launchCut.ts
+++ b/skills/anidoodle/engine/src/canvas-core/launchCut.ts
@@ -84,12 +84,12 @@ export const bloomFrame = (ctx: Ctx, env: Env, local: number, len: number, under
// `bug` draws a corner brand mark on the page (the logo recurs on every frame of the film).
// `lead`: when the first line starts, relative to the bloom being open (default -2); `stagger`: frames
// between lines (default 20); a line takes 18 frames to write.
-export type TypeOpts = BloomOpts & { maxW?: number; lead?: number; stagger?: number };
+export type TypeOpts = BloomOpts & { maxW?: number; lead?: number; stagger?: number; text?: P }; // text: the words' centre (default the frame's)
export const typeFrame = (ctx: Ctx, env: Env, lines: TypeLine[], local: number, len: number, under: (first: boolean) => void, bug?: (c: Ctx) => void, o: TypeOpts = {}) => {
const IN = o.inF ?? 14, W = o.W ?? 1920, H = o.H ?? 1080, maxW = o.maxW ?? 1560, lead = o.lead ?? -2, st = o.stagger ?? 20;
bloomFrame(ctx, env, local, len, under, (c) => {
- const n = lines.length, size = Math.min(n === 1 ? 190 : 130, ...lines.map((l) => (maxW / measure(l.text, 100)) * 100)), gap = size * 1.45, y0 = H / 2 - ((n - 1) * gap) / 2 + size * 0.5;
- lines.forEach((l, i) => writeOn(c, env, l.text, W / 2, y0 + i * gap, size, ramp(local, IN + lead + i * st, IN + lead + 18 + i * st), l.style, { color: l.color, align: "center", seed: 7 + i }));
+ const n = lines.length, size = Math.min(n === 1 ? 190 : 130, ...lines.map((l) => (maxW / measure(l.text, 100)) * 100)), gap = size * 1.45, y0 = (o.text ? o.text[1] : H / 2) - ((n - 1) * gap) / 2 + size * 0.5;
+ lines.forEach((l, i) => writeOn(c, env, l.text, o.text ? o.text[0] : W / 2, y0 + i * gap, size, ramp(local, IN + lead + i * st, IN + lead + 18 + i * st), l.style, { color: l.color, align: "center", seed: 7 + i }));
bug?.(c);
}, o);
};
diff --git a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts b/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
index bdb7402..6e0e048 100644
--- a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
+++ b/skills/anidoodle/engine/src/canvas-core/launchLayout.ts
@@ -13,6 +13,7 @@
// L.split a feature beat: the words' column and the live UI's, which never overlap
// L.stage / L.band the picture's area and, with captions burned in, the captions' own band
// L.roles every text role and its size, which launchLayout checks against minPx
+// L.safe / L.zones where text may sit: on 9x16 inside the platforms' safe zones (PHONE_SAFE), else the frame
import { CHAT_GEOM, chatGeom, type ChatGeom, type Rect } from "./launchKit";
import type { Cam } from "./launchKit";
import type { P } from "./core";
@@ -31,6 +32,16 @@ export const parseShapes = (s: string): Shape[] => {
if (bad.length || !out.length) throw new Error(`shapes: '${bad.join(", ") || s}' is not a shape; use ${Object.keys(SHAPES).join(", ")}`);
return out as Shape[];
};
+// The 9:16 platform safe zones: Reels, TikTok and Shorts lay their own interface over the top band, the
+// bottom band and a right-hand column of buttons. Shares of the frame: top and bottom of its height,
+// right of its width. tools/textrules.mjs checks rendered frames against the same numbers (a unit test
+// holds the two equal). They apply to 9x16 only; the feed shapes have no such overlay.
+export const PHONE_SAFE = { top: 0.14, bottom: 0.25, right: 0.14 } as const;
+/** The rectangle a W x H frame leaves free of the platforms' interface (the whole frame for a shape the zones do not apply to). */
+export const safeRect = (shape: Shape, W: number, H: number): Rect => shape === "9x16" ? { x: 0, y: H * PHONE_SAFE.top, w: W * (1 - PHONE_SAFE.right), h: H * (1 - PHONE_SAFE.top - PHONE_SAFE.bottom) } : { x: 0, y: 0, w: W, h: H };
+// on 9x16 the layout keeps this far inside a zone's line (a zone's edge is not a visible edge, so the gap is small)
+const ZONE_GAP = 8;
+
// phone-safe minimums, px at the delivered size: `read` = a line the viewer must read (a prompt, a
// label, the words, the install lines); `chrome` = the UI around them (a header, a button's word)
export const MIN_PX = { phone: { read: 32, chrome: 24, type: 64 }, desk: { read: 18, chrome: 16, type: 80 } };
@@ -54,10 +65,12 @@ export type LaunchLayout = {
thread: { top: number; viewBottom: number; clip: [number, number, number, number]; bubbleH: number; bubbleLineH: number; bubblePad: number; bubbleR: number; bubbleMaxW: number; bubbleRad: number; gap: number; card: number; cardX: number; cardDy: number; bubbles: string[][] };
cam: { home: Cam; macroZ: number; macroCreep: number; macroX0: number; macroY: number; follow: boolean; leanZ: number; pointerOff: P; pointerS: number; pointerOn: P };
bug: { x: number; y: number; px: number };
- type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number };
+ type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number; at?: P }; // at: the words' centre when it is not the frame's
end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };
split: { words: Rect; ui: Rect; vertical: boolean; wordsPx: number };
stage: Rect; band: Rect | null;
+ uiFull: Rect; // a product-UI ask's panel when it has no words beside it
+ safe: Rect; zones: boolean;
roles: Role[];
};
export type LayoutContent = { prompts: string[]; install: string[]; tagline: string; title?: string; band?: boolean };
@@ -75,17 +88,25 @@ const desk = (c: LayoutContent): LaunchLayout => {
// 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,
+ uiFull: { x: 250, y: 90, w: 1420, h: 880 }, safe: { x: 0, y: 0, w: W, h: H }, zones: false,
roles: [],
};
};
-// the phone compositions: one column, the chat as tall as the frame allows, type sizes floored at the phone minimums
-const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number): LaunchLayout => {
- const W = 1080, H = H0, m = 40, k = { "1x1": 1.12, "4x5": 1.22, "9x16": 1.36 }[shape], min = MIN_PX.phone;
+// the phone compositions: one column, the chat as tall as the frame allows, type sizes floored at the phone minimums.
+// Each is composed inside E, the edges it treats as its frame: the frame itself for 1x1 and 4x5; on 9x16
+// the safe rectangle S, so every line a viewer reads stays clear of the platforms' interface (the picture's
+// background still fills the whole frame). E sits `m - ZONE_GAP` outside a zone's line, so the margins
+// leave ZONE_GAP against a zone and the full margin m against the frame's own left edge.
+const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: Rect): LaunchLayout => {
+ // (9x16 composes inside its safe rectangle, about a 4x5 frame's worth of room, so it takes 4x5's scale)
+ const W = 1080, H = H0, m = 40, k = { "1x1": 1.12, "4x5": 1.22, "9x16": 1.22 }[shape], min = MIN_PX.phone, zones = shape === "9x16";
+ const E = zones ? { x0: 0, y0: S.y - (m - ZONE_GAP), x1: S.x + S.w + (m - ZONE_GAP), y1: Math.min(S.y + S.h, H) } : { x0: 0, y0: 0, x1: W, y1: H };
+ const Ew = E.x1 - E.x0, Eh = E.y1 - E.y0;
const px = { head: Math.max(22 * k, min.chrome), sub: Math.max(18 * k, min.chrome), bubble: Math.max(26 * k, min.read), label: Math.max(20 * k, min.read), gen: Math.max(24 * k, min.chrome) };
// the window stops above the corner mark's own strip: the mark never sits on the UI
const bugPx = Math.max(24 * k, min.chrome), bugStrip = Math.round(bugPx + 34);
- const promptPx = Math.max(34 * k, min.read), chatR = { x: m, y: m, w: W - 2 * m, h: H - m - bugStrip, r: 34 * k };
+ const promptPx = Math.max(34 * k, min.read), chatR = { x: E.x0 + m, y: E.y0 + m, w: Ew - 2 * m, h: Eh - m - bugStrip, r: 34 * k };
// the composer holds the longest prompt; the button sits on its last line
const base = chatGeom(chatR, k, px, promptPx, 1), textW = base.GEN.x - 20 * k - base.TEXT.x;
const lines = Math.min(3, Math.max(1, ...c.prompts.map((p) => wrapEst(p, promptPx, textW).length)));
@@ -95,31 +116,40 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number): Lau
// the answer card: as wide as the thread allows, and short enough that a card and the prompt above it both fit the view
const card = Math.round(Math.min(g.INPUT.w, viewBottom - top - 58 * k - 2 * bubbleLineH - 60 * k));
const cardX = g.CHAT.x + (g.CHAT.w - card) / 2;
- // the end card, stacked and centred in the frame
- const mono = Math.min(30 * k, ...c.install.map((s) => (W - 2 * 32 - 2 * 36) / (s.length * 0.61)));
- const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, W - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);
+ // the end card, stacked and centred in E
+ const mono = Math.min(30 * k, ...c.install.map((s) => (Ew - 2 * 32 - 2 * 36) / (s.length * 0.61)));
+ const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, Ew - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);
const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * c.install.length + 50 * k;
- const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = (H - block) / 2 - 20;
+ const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = E.y0 + (Eh - block) / 2 - 20;
const titleY = y0 + titleMax * 0.62, taglineY = y0 + titleMax + 60 + tLH / 2, panelY = taglineY + (tagline.length - 0.5) * tLH + 50;
- const split = shape === "9x16"
- ? { words: { x: 90, y: 150, w: W - 180, h: 520 }, ui: { x: m + 20, y: 720, w: W - 2 * m - 40, h: H - 720 - 150 }, vertical: true, wordsPx: 96 }
+ // the split beat, stacked: the words on top, the live UI under them. On 9x16 both sit in the window's
+ // rectangle, and the UI is inset so its push (12 % at most) never carries its text past that rectangle.
+ const PUSH = 1.12, R = { x: chatR.x, y: chatR.y, w: chatR.w, h: chatR.h };
+ const wordsH = Math.round(R.h * 0.32), uiTop = R.y + wordsH + 30, uiW = Math.floor(R.w / PUSH), uiH = Math.floor((R.y + R.h - uiTop) / PUSH);
+ const split = zones
+ ? { words: { x: R.x + 20, y: R.y + 10, w: R.w - 40, h: wordsH }, ui: { x: Math.round(R.x + (R.w - uiW) / 2), y: Math.round(uiTop + (R.y + R.h - uiTop - uiH) / 2), w: uiW, h: uiH }, vertical: true, wordsPx: 96 }
: { words: { x: 80, y: 90, w: W - 160, h: Math.round(H * 0.3) }, ui: { x: m + 20, y: Math.round(H * 0.3) + 130, w: W - 2 * m - 40, h: H - Math.round(H * 0.3) - 130 - 90 }, vertical: true, wordsPx: shape === "1x1" ? 76 : 84 };
+ // a UI ask on its own: on 9x16 the window's rectangle less 6 %, the room its camera creeps into
+ const uiFull = zones ? { x: Math.round(R.x + R.w * 0.03), y: Math.round(R.y + R.h * 0.03), w: Math.round(R.w * 0.94), h: Math.round(R.h * 0.94) } : { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) };
// the hook: the prompt big, the camera gliding after the caret (and down a line when the words wrap)
const macroZ = { "1x1": 1.85, "4x5": 1.95, "9x16": 2.05 }[shape];
return {
shape, W, H, k, phone: true, chat: g,
thread: { top, viewBottom, clip: [g.CHAT.x, g.CHAT.y + 102 * k, g.CHAT.w, viewBottom - (g.CHAT.y + 102 * k)], bubbleH: 58 * k + (px.bubble - 26 * k) * 1.2, bubbleLineH, bubblePad: 26 * k, bubbleR: g.INPUT.x + g.INPUT.w, bubbleMaxW, bubbleRad: 22 * k, gap: 26 * k, card, cardX, cardDy: 34 * k + (px.label - 20 * k), bubbles },
- cam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },
- bug: { x: W - m - 10, y: H - bugStrip / 2 + bugPx * 0.1, px: bugPx },
- type: { maxW: W - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9 },
- end: { cx: W / 2, titleY, titleMax, titleW: W - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },
- split, stage: { x: 0, y: 0, w: W, h: H }, band: null,
+ // on 9x16 the lean on a new card goes further: the card is smaller there, and the rest of the window fades as it leaves the safe area
+ cam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: zones ? 1.5 : 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },
+ bug: { x: E.x1 - m - 10, y: E.y1 - bugStrip / 2 + bugPx * 0.1, px: bugPx },
+ type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: [E.x0 + Ew / 2, R.y + R.h / 2] as P } : {}) },
+ end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },
+ split, stage: { x: 0, y: 0, w: W, h: H }, band: null, uiFull, safe: S, zones,
roles: [],
};
};
// the caption band, when captions are burned in: its own strip under the picture, never over it.
// The layout is composed for the picture's area (the stage), and the band is drawn below it.
+// On 9x16 the band sits at the bottom of the safe rectangle (captions are text a viewer reads), and the
+// strip under it, in the platforms' bottom zone, is the picture's background.
const BAND = { "16x9": 0, "1x1": 150, "4x5": 170, "9x16": 230 };
/** The layout of a launch film in `shape`, for this content. Throws when a line a viewer must read cannot be phone-safe. */
@@ -128,8 +158,9 @@ export const launchLayout = (shape: Shape, c: LayoutContent): LaunchLayout => {
const { W, H } = SHAPES[shape], band = c.band ? BAND[shape] : 0;
if (c.band && shape === "16x9") throw new Error("launchLayout 16x9: burned-in captions are for the phone shapes (1x1, 4x5, 9x16); a 16x9 film ships its captions as a .srt/.vtt sidecar");
// (a wide frame plays where sidecar captions work, YouTube, LinkedIn, the site: its captions ship as .srt/.vtt)
- const L = shape === "16x9" ? desk(c) : phone(shape, c, H - band);
- L.H = H; L.stage = { x: 0, y: 0, w: W, h: H - band }; L.band = band ? { x: 0, y: H - band, w: W, h: band } : null;
+ const S = safeRect(shape, W, H), bandY = !band ? H : shape === "9x16" ? S.y + S.h - band : H - band;
+ const L = shape === "16x9" ? desk(c) : phone(shape, c, bandY, S);
+ L.H = H; L.stage = { x: 0, y: 0, w: W, h: bandY }; L.band = band ? { x: 0, y: bandY, w: W, h: band } : null;
const min = L.phone ? MIN_PX.phone : MIN_PX.desk, g = L.chat;
L.roles = [
{ role: "prompt", px: g.TEXT.px, min: min.read }, { role: "bubble", px: g.px.bubble, min: min.read }, { role: "card label", px: g.px.label, min: min.read },
diff --git a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
index c9391ce..27bbe47 100644
--- a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
+++ b/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts
@@ -157,7 +157,11 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const G: ChatGeom = clean ? { ...L.chat, theme: CLEAN, drop: INK, iris: true } : L.chat;
const W = L.W, H = L.stage.h, TH = L.thread, CAM = L.cam, CARD = TH.card, VIEW_BOTTOM = TH.viewBottom, k = G.k, minPx = L.phone ? 32 : 18;
const GEN_C: P = [G.GEN.x + G.GEN.w / 2, G.GEN.y + G.GEN.h / 2];
- const UI_FULL: Rect = L.phone ? { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) } : { x: 250, y: 90, w: 1420, h: 880 };
+ const UI_FULL: Rect = L.uiFull;
+ // 9x16: text stays inside the platforms' safe rectangle SAFE (launchLayout.PHONE_SAFE). The camera's
+ // close-ups zoom about a point that stays put, and whatever a move carries toward a zone fades first.
+ const ZONES = L.zones, SAFE = L.safe, SC: P = [SAFE.x + SAFE.w / 2, SAFE.y + SAFE.h / 2];
+ const about = (p: P, z: number): P => [p[0] - (p[0] - W / 2) / z, p[1] - (p[1] - H / 2) / z]; // a camera at zoom z that leaves world point p where it is on screen
const THEME: UiTheme = { bg: PAL.bg, card: PAL.card, ink: PAL.ink, soft: PAL.soft, mute: PAL.mute, line: PAL.line, chip: PAL.chip, accent: ACC ?? PAL.accent, paper: PAL.paper };
// ---------------------------------------------------------------- the beat grid and the asks' lengths (30 fps units; 60 fps draws between them)
@@ -200,8 +204,14 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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 9x16 the edge that counts is the safe rectangle's, so text fades before it reaches a zone; the fade
+ // is short, ZONE_FADE px, because the hook's composer spans the window and a zone's line is not a visible edge)
+ const ZONE_FADE = 8;
+ const seenSafe = (cam: Cam, x0: number, y0: number, x1: number, y1: number) => { const [a, b] = toScreen(cam, [x0, y0], W, H), [c, d] = toScreen(cam, [x1, y1], W, H); return clamp(Math.min(a - SAFE.x, SAFE.x + SAFE.w - c, b - SAFE.y, SAFE.y + SAFE.h - d) / ZONE_FADE); };
+ const seen = ZONES ? seenSafe : (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`)
+ // a card's width with its byline, which can run past the card (an estimate that errs wide)
+ const cardSpan = (i: number) => Math.max(CARD, 26 * k + estWidth((spec.asks[i] as PlateAsk).label, G.px.label));
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 || Gc !== G ? 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, composerGeom: Gc === G ? undefined : Gc }, G);
@@ -209,9 +219,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
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;
+ const y = ys[k] - sc; if (y > VIEW_BOTTOM || y + it.h < (ZONES ? cyT : 100)) return; // (on 9x16 an item scrolled wholly under the window's top is not drawn)
// 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 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 + (ZONES ? cardSpan(it.card) : 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 = A * ramp(f, it.at, it.at + 8); ctx.font = SANS(500, G.px.bubble);
@@ -236,7 +246,13 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// (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 cy = cardY(i, T[i].base + T[i].len), lab = 44 * k, box = { x: TH.cardX, y: cy - lab, w: ZONES ? cardSpan(i) : CARD, h: CARD + lab }, m = 36 * k;
+ if (ZONES) {
+ // 9x16: the card and its byline centred in the safe rectangle, as large as it allows up to leanZ
+ const S = SAFE, z = Math.max(1, Math.min(CAM.leanZ, (0.86 * S.w) / box.w, (0.86 * S.h) / box.h)), bc: P = [box.x + box.w / 2, box.y + box.h / 2];
+ const c: P = [bc[0] - (SC[0] - W / 2) / z, bc[1] - (SC[1] - H / 2) / z];
+ return { c: [clamp(c[0], box.x + box.w - (S.x + S.w - m - W / 2) / z, box.x - (S.x + m - W / 2) / z), clamp(c[1], box.y + box.h - (S.y + S.h - m - H / 2) / z, box.y - (S.y + m - H / 2) / z)], z };
+ }
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 };
@@ -250,12 +266,15 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// which shrinks and docks at the bottom of the chat as Generate is pressed.
const HERO = (() => {
if (!isChat(spec.asks[0])) return null;
- const prompt = spec.asks[0].prompt, min = L.phone ? 64 : 56, inW = Math.min(L.phone ? W * 0.9 : W * 0.72, G.CHAT.w - 60 * k); // most of the width, inside the chat window
+ const prompt = spec.asks[0].prompt, min = L.phone ? 64 : 56, inW = ZONES ? G.CHAT.w - 24 : Math.min(L.phone ? W * 0.9 : W * 0.72, G.CHAT.w - 60 * k); // most of the width, inside the chat window (on 9x16 all of it: the window is narrower there)
for (let px = L.phone ? 76 : 68; px >= min; px -= 2) {
const kh = px / 34, genW = 166 * kh, textW = inW - 44 * kh - genW - 44 * kh, lines = wrapEst(prompt, px, textW).length;
if (lines > 3 && px > min) continue;
if (lines > 3) throw new Error(`launchTemplate ${shape}: the first prompt "${prompt}" needs ${lines} lines at the hook's ${min} px; shorten it (the hook must read muted in the first 2 s)`);
- const h = 104 * kh + (lines - 1) * Math.round(px * 1.3), fake = { x: (W - inW) / 2 - 60 * kh, y: 0, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh };
+ // centred in the frame, or on 9x16 in the chat window (which is centred in the safe rectangle)
+ const h = 104 * kh + (lines - 1) * Math.round(px * 1.3), fake = ZONES
+ ? { x: G.CHAT.x + (G.CHAT.w - inW) / 2 - 60 * kh, y: G.CHAT.y + G.CHAT.h / 2 - H * 0.5, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh }
+ : { x: (W - inW) / 2 - 60 * kh, y: 0, w: inW + 120 * kh, h: H * 0.5 + h / 2 + 36 * kh };
const g = chatGeom(fake, kh, { ...G.px, gen: 24 * kh }, px, lines, genW);
return { ...g, CHAT: G.CHAT, theme: G.theme, drop: G.drop, iris: G.iris } as ChatGeom;
}
@@ -274,7 +293,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const t = T[i], l = f - t.base;
// the close-up creeps in while the words arrive: the frame is never a still
// (the hero hook is its own close-up: the camera holds the whole frame, creeping 2 %)
- const hero = !!HERO && i === 0, mz = hero ? 1 + 0.02 * ramp(l, -20, t.b) : MZ * (1 + 0.03 * ramp(l, -20, t.b)), macro: Cam = { c: inView(hero ? HOME.c : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], mz), z: mz };
+ const hero = !!HERO && i === 0, mz = hero ? 1 + 0.02 * ramp(l, -20, t.b) : MZ * (1 + 0.03 * ramp(l, -20, t.b));
+ // (9x16: the creep is about the window's centre for the hook, the composer's otherwise, so neither moves toward a zone)
+ const macro: Cam = ZONES ? { c: inView(about(hero ? [G.CHAT.x + G.CHAT.w / 2, G.CHAT.y + G.CHAT.h / 2] : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], mz), mz), z: mz } : { c: inView(hero ? HOME.c : [G.INPUT.x + G.INPUT.w / 2, G.INPUT.y + G.INPUT.h / 2], 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));
@@ -313,7 +334,9 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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 });
+ // (9x16: fitted to the safe rectangle, and zooming about the window's centre, which never moves)
+ const fit = ZONES ? Math.max(1, Math.min((0.94 * SAFE.w) / win.w, (0.92 * SAFE.h) / win.h)) : Math.max(1, Math.min((0.94 * W) / win.w, (0.92 * H) / win.h));
+ const toward = (z: number): Cam => (ZONES ? { c: inView(about(wc, z), z), z } : { c: inView(lerpP(HOME.c, wc, clamp((z - 1) / (fit - 1 || 1))), z), z });
if (l >= t.down) return toward(1 + (fit - 1) * 0.9 * inOut(ramp(l, t.down, t.len + 40))); // from the press on, never resting; still moving when the ask ends
const open = toward(1 + (fit - 1) * 0.5 * ramp(l, -20, t.b)); // already creeping on frame 0
return camLerp(open, HOME, expo(ramp(l, t.b - 4, t.down)));
@@ -366,10 +389,11 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
// 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;
+ // (9x16: measured on the safe rectangle's width and centred on its height)
+ const AW = ZONES ? SAFE.w - 24 : W, E = L.end, n = spec.install.length, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);
+ const mono = Math.min(E.monoPx * 1.35, ...spec.install.map((x) => (AW * 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;
+ const titleY = (ZONES ? SAFE.y * 2 + SAFE.h - block : 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);
@@ -451,15 +475,15 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const cut = makeCut(segs);
// 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 ? 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;
+ const nL = lines.length, maxW = L.type.maxW, at = L.type.at, x0 = at ? at[0] - maxW / 2 : (W - maxW) / 2;
+ const size = Math.min(nL === 1 ? 220 : 170, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = (at ? at[1] : 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 });
// a word page's bloom is sized to the frame it covers (the desktop's 1250 px over a 1110 px cover):
// on a smaller frame a fixed bloom would cover it before the words start, and two frames would match
const TYPE_R = L.shape === "16x9" ? undefined : Math.round((1250 * L.type.cover) / 1110);
- const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R };
+ const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at } : {}) };
const drawStage = (ctx: Ctx, env: Env, t: number) => {
const { s, local } = cut.at(t), exact = Number.isInteger(t);
if (s.kind === "pic") content(ctx, env, cut.contentOf(s, local), exact);
@@ -485,11 +509,13 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {
const capAt = (t: number) => caps.find((c) => t >= c.from && t < c.to);
const band = (ctx: Ctx, env: Env, t: number) => {
const B = L.band!; ctx.setTransform(env.scale, 0, 0, env.scale, 0, 0);
+ if (B.y + B.h < L.H) { ctx.fillStyle = PAL.bg; ctx.fillRect(0, B.y + B.h, W, L.H - B.y - B.h); } // 9x16: under the band, the platforms' bottom zone: background only
ctx.fillStyle = PAL.card; ctx.fillRect(B.x, B.y, B.w, B.h); ctx.fillStyle = PAL.line; ctx.fillRect(B.x, B.y, B.w, 2);
const c = capAt(t); if (!c) return;
- const px = Math.max(36, Math.round(B.h * 0.2)), lines = wrapEst(c.text, px, B.w - 120).slice(0, 2), a = Math.min(ramp(t, c.from, c.from + 6), 1 - ramp(t, c.to - 6, c.to));
+ const TX = ZONES ? { x: SAFE.x, w: SAFE.w } : B; // the caption's own column: on 9x16 clear of the right-hand buttons
+ const px = Math.max(36, Math.round(B.h * 0.2)), lines = wrapEst(c.text, px, TX.w - 120).slice(0, 2), a = Math.min(ramp(t, c.from, c.from + 6), 1 - ramp(t, c.to - 6, c.to));
ctx.globalAlpha = a; ctx.fillStyle = PAL.ink; ctx.font = SANS(600, px); ctx.textAlign = "center"; ctx.textBaseline = "middle";
- lines.forEach((l, j) => ctx.fillText(l, B.x + B.w / 2, B.y + B.h / 2 + (j - (lines.length - 1) / 2) * px * 1.25)); ctx.globalAlpha = 1; ctx.textAlign = "left";
+ lines.forEach((l, j) => ctx.fillText(l, TX.x + TX.w / 2, B.y + B.h / 2 + (j - (lines.length - 1) / 2) * px * 1.25)); ctx.globalAlpha = 1; ctx.textAlign = "left";
};
const draw = (ctx: Ctx, F: number, env: Env) => {
const t = F / m;
diff --git a/skills/anidoodle/engine/test/launchLayout.test.ts b/skills/anidoodle/engine/test/launchLayout.test.ts
index 3e58c9c..81caed3 100644
--- a/skills/anidoodle/engine/test/launchLayout.test.ts
+++ b/skills/anidoodle/engine/test/launchLayout.test.ts
@@ -2,7 +2,7 @@
// chat, the cards, the word pages, the split beat, the end card), every line a viewer reads is at
// least the phone-safe size, nothing sits over anything else, and 16x9 is the desktop film exactly.
import { CHAT_GEOM, chatGeom, CHAT } from "../src/canvas-core/launchKit";
-import { launchLayout, SHAPES, MIN_PX, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";
+import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";
import { makeLaunchFilm, fitWords } from "../src/canvas-core/launchTemplate";
import type { Film } from "../src/canvas-core/film";
@@ -14,8 +14,11 @@ export const name = "launchLayout";
export const run = (ok: (cond: boolean, label: string) => void) => {
const g = chatGeom(CHAT, 1, CHAT_GEOM.px, 34, 0);
ok(JSON.stringify([g.CHAT, g.INPUT, g.GEN, g.REPLY.x, g.REPLY.y, g.TEXT]) === JSON.stringify([CHAT_GEOM.CHAT, CHAT_GEOM.INPUT, CHAT_GEOM.GEN, CHAT_GEOM.REPLY.x, CHAT_GEOM.REPLY.y, CHAT_GEOM.TEXT]), "the chat derivation at k = 1 IS the desktop chat (one component, not two)");
- const content = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };
+ const content0 = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };
+ // anidoodle's own install lines (47 characters) cannot be 32 px mono inside 9x16's safe width, so 9x16 is laid out with shorter ones
+ const phoneContent = { ...content0, install: ["npm install your-product", "your-product init"] };
for (const shape of Object.keys(SHAPES) as Shape[]) {
+ const content = shape === "9x16" ? phoneContent : content0;
const L = launchLayout(shape, content), frame = { x: 0, y: 0, w: L.W, h: L.H }, c = L.chat;
ok(L.W === SHAPES[shape].W && L.H === SHAPES[shape].H, `${shape}: the frame is ${L.W}x${L.H}`);
const small = L.roles.filter((r) => r.px < r.min);
@@ -29,23 +32,36 @@ export const run = (ok: (cond: boolean, label: string) => void) => {
ok(pw <= L.W, `${shape}: the install panel (${pw.toFixed(0)} px at ${L.end.monoPx.toFixed(1)} px mono) fits the frame's width`);
ok(L.end.titleY < L.end.taglineY && L.end.taglineY < L.end.panelY && L.end.footerY < L.stage.h, `${shape}: the end card stacks title, line, panel, footer, all in frame`);
ok(!overlap(L.split.words, L.split.ui) && inside(L.split.words, L.stage) && inside(L.split.ui, L.stage), `${shape}: a split beat's words and live UI have their own areas (${L.split.vertical ? "stacked" : "side by side"})`);
- if (L.phone) { const B = launchLayout(shape, { ...content, band: true }); ok(!!B.band && !overlap(B.band, B.stage) && B.band.y + B.band.h === B.H, `${shape}: burned-in captions get their own band under the picture (${B.band?.h} px)`); }
+ if (L.phone) { const B = launchLayout(shape, { ...content, band: true }); ok(!!B.band && !overlap(B.band, B.stage) && B.band.y + B.band.h === (B.zones ? B.safe.y + B.safe.h : B.H), `${shape}: burned-in captions get their own band under the picture (${B.band?.h} px${B.zones ? ", at the safe rectangle's bottom" : ""})`); }
+ // the 9:16 platform safe zones: every rectangle that holds text sits inside the safe rectangle; other shapes have none
+ if (shape !== "9x16") { ok(!L.zones && JSON.stringify(L.safe) === JSON.stringify(frame), `${shape}: no safe zones (the whole frame is free for text)`); continue; }
+ const S = L.safe, E = L.end, pushed = (r: R, z: number) => ({ x: r.x + r.w / 2 - (r.w * z) / 2, y: r.y + r.h / 2 - (r.h * z) / 2, w: r.w * z, h: r.h * z });
+ ok(L.zones && Math.abs(S.y - L.H * PHONE_SAFE.top) < 1e-9 && Math.abs(S.x + S.w - L.W * (1 - PHONE_SAFE.right)) < 1e-9 && Math.abs(S.y + S.h - L.H * (1 - PHONE_SAFE.bottom)) < 1e-9, `9x16: the safe rectangle is the frame less the top ${Math.round(PHONE_SAFE.top * 100)} %, bottom ${Math.round(PHONE_SAFE.bottom * 100)} % and right ${Math.round(PHONE_SAFE.right * 100)} %`);
+ ok(inside(c.CHAT, S), `9x16: the chat window, and every line in it, sits inside the safe rectangle (${[c.CHAT.x, c.CHAT.y, c.CHAT.x + c.CHAT.w, c.CHAT.y + c.CHAT.h].map((v) => v.toFixed(0)).join(",")})`);
+ ok(inside(L.split.words, S) && inside(pushed(L.split.ui, 1.12), S), "9x16: the split beat's words and its live UI, pushed in to its fullest 12 %, sit inside the safe rectangle");
+ ok(inside(pushed(L.uiFull, 1.06), S), "9x16: a UI ask on its own leaves its camera room to creep without leaving the safe rectangle");
+ const bugW = estWidth("Your Product", L.bug.px) * 1.2;
+ ok(inside({ x: L.bug.x - bugW, y: L.bug.y - L.bug.px, w: bugW, h: L.bug.px * 1.3 }, S), "9x16: the corner mark sits inside the safe rectangle");
+ const at = L.type.at!; ok(!!at && inside({ x: at[0] - L.type.maxW / 2, y: at[1] - 10, w: L.type.maxW, h: 20 }, S), "9x16: a word page's lines are centred in the safe rectangle and no wider than it");
+ const pw0 = Math.max(...content.install.map((x) => monoWidth(x, E.monoPx))) + 2 * E.padX;
+ ok(inside({ x: E.cx - Math.max(E.titleW, pw0) / 2, y: E.titleY - E.titleMax, w: Math.max(E.titleW, pw0), h: E.footerY + E.footerPx - (E.titleY - E.titleMax) }, S), "9x16: the end card (name, line, install panel, footer) sits inside the safe rectangle");
}
- let err = ""; try { launchLayout("16x9", { ...content, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");
- err = ""; try { launchLayout("9x16", { ...content, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);
+ let err = ""; try { launchLayout("16x9", { ...content0, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");
+ err = ""; try { launchLayout("9x16", content0); } catch (e) { err = (e as Error).message; } ok(/install lines would be .*Shorten the install line/.test(err), `9x16 refuses an install line too long for the safe width at 32 px: ${err.slice(0, 80)}`);
+ err = ""; try { launchLayout("9x16", { ...content0, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);
ok(parseShapes("16x9, 9x16").join() === "16x9,9x16", "parseShapes reads a --shapes list");
err = ""; try { parseShapes("16x10"); } catch (e) { err = (e as Error).message; } ok(/not a shape/.test(err), "parseShapes refuses an unknown shape");
// one timeline, every shape: the same cut and length, a different composition
const plate: Film = { meta: { title: "plate", W: 1080, H: 1080, fps: 30, bpm: 90, durationFrames: 60 }, assets: { images: {} }, shots: [{ id: "p", start: 0, end: 60, draw: () => {} }] };
- const f = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content.prompts[0], plate, label: "l" }, { prompt: content.prompts[1], plate, label: "l" }], words: [[{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }]], tagline: content.tagline, install: ["npm i tally"], bpm: 90, claimBar: 4, score: null });
+ const f = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content0.prompts[0], plate, label: "l" }, { prompt: content0.prompts[1], plate, label: "l" }], words: [[{ text: "EVERY NUMBER, COUNTED.", style: "ink", color: "#000" }]], tagline: content0.tagline, install: ["npm i tally"], bpm: 90, claimBar: 4, score: null });
const shapes = (Object.keys(SHAPES) as Shape[]).map((s) => f.reshape(s));
ok(shapes.every((x) => x.meta.durationFrames === f.meta.durationFrames && JSON.stringify(x.cut.STARTS) === JSON.stringify(f.cut.STARTS)), `every shape is the same cut (${f.meta.durationFrames} frames, cuts at ${f.cut.STARTS.join(", ")})`);
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 });
+ const fa = makeLaunchFilm({ title: "Tally", asks: [{ prompt: content0.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");
// the hook: the first prompt is the hero, large enough to read muted in the first 2 s, in every shape
ok((Object.keys(SHAPES) as Shape[]).every((sh) => { const x = f.reshape(sh); return (x.heroPx ?? 0) >= (x.layout.phone ? 64 : 56); }), `the first prompt is the hero: ${(Object.keys(SHAPES) as Shape[]).map((sh) => `${sh} ${f.reshape(sh).heroPx} px`).join(", ")} (>= 64 on a phone frame, 56 on 16x9)`);
diff --git a/skills/anidoodle/engine/test/textrules.test.ts b/skills/anidoodle/engine/test/textrules.test.ts
index 0e30534..310f139 100644
--- a/skills/anidoodle/engine/test/textrules.test.ts
+++ b/skills/anidoodle/engine/test/textrules.test.ts
@@ -2,9 +2,12 @@
// including the failing cases: a cue that is too short, text under the platforms' buttons.
// @ts-ignore: a plain ES module shared with the tools
import { SAFE_ZONES, isPortrait916, readingNeed, readingTime, safeZoneHits, zoneRects } from "../tools/textrules.mjs";
+import { PHONE_SAFE } from "../src/canvas-core/launchLayout";
export const name = "textrules";
export const run = (ok: (cond: boolean, label: string) => void) => {
+ // one set of numbers: the layout composes inside PHONE_SAFE, framecheck checks against SAFE_ZONES
+ ok(JSON.stringify(SAFE_ZONES) === JSON.stringify(PHONE_SAFE), `the checked safe zones are the ones the launch layout composes for (${JSON.stringify(SAFE_ZONES)})`);
// ---- reading time: max(0.7 s, 0.3 s per word)
ok(readingNeed("Hi") === 0.7 && readingNeed("one two") === 0.7, "one or two words need the 0.7 s floor");
ok(Math.abs(readingNeed("one two three four five six") - 1.8) < 1e-9, "six words need 1.8 s (0.3 s each)");
diff --git a/skills/anidoodle/engine/tools/framecheck.mjs b/skills/anidoodle/engine/tools/framecheck.mjs
index 09d963c..f4079b8 100644
--- a/skills/anidoodle/engine/tools/framecheck.mjs
+++ b/skills/anidoodle/engine/tools/framecheck.mjs
@@ -8,9 +8,8 @@
// button column the platforms cover with their own interface. Other shapes report N/A.
// The rules and their numbers are textrules.mjs.
// node tools/framecheck.mjs <film>[-<shape>] [--every 1] [--from F] [--to T] [--zones fail|warn]
-// --zones warn lists safe-zone text as FLAG and does not fail the run (launch.mjs ship uses it, because
-// the launch template's phone layouts are a chat window across the whole frame; --strict-zones there
-// makes it fail). Reading time and the edge cut always fail.
+// --zones warn lists safe-zone text as FLAG and does not fail the run (launch.mjs ship passes it on with
+// its own --zones warn; by default safe-zone text fails). Reading time and the edge cut always fail.
import { resolve } from "node:path";
import { buildPage } from "./build-page.mjs";
import { detect } from "./detect.mjs";
diff --git a/skills/anidoodle/engine/tools/launch.mjs b/skills/anidoodle/engine/tools/launch.mjs
index 92048f1..02e4ad4 100644
--- a/skills/anidoodle/engine/tools/launch.mjs
+++ b/skills/anidoodle/engine/tools/launch.mjs
@@ -7,7 +7,7 @@
// It renders as it is (placeholder plates and UI), so the pipeline can be proved before the art.
//
// node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180]
-// [--poster-frame N] [--gate] [--strict-zones]
+// [--poster-frame N] [--gate] [--zones warn]
// for each shape, from ONE timeline (launchLayout re-composes it, never a crop):
// 1 render out/<name>-<shape>.mp4 (render.mjs; --blur/--shutter/--poster-frame pass through)
// 2 poster out/<name>-<shape>.poster.png, the film's own legible frame (meta.poster: the end card)
@@ -16,7 +16,7 @@
// marker, the true peak after the encode, a legible frame 0
// 5 frame framecheck.mjs: no text and no card or window cut by the frame's edge, every frame;
// each text cue up for max(0.7 s, 0.3 s per word) (N/A without cues); on 9:16 no text in
-// the platforms' top, bottom or right-hand zones (FLAG only; --strict-zones makes it fail)
+// the platforms' top, bottom or right-hand zones (it fails the shape; --zones warn only flags it)
// 6 gate with --gate: gate.mjs (determinism, contract, dead air) on the rendered file
// and once for the film, before the shapes: facts.mjs, every claim it makes is listed in facts.json
// with its source (a film that makes no claims is N/A). Then one table. Exit 1 if anything fails.
@@ -31,7 +31,7 @@ import { initFacts, readFacts } from "./facts.mjs";
const [cmd, name, ...rest] = process.argv.slice(2);
const arg = (k, d) => { const i = rest.indexOf(`--${k}`); return i >= 0 ? rest[i + 1] : d; };
const die = (m) => { console.error(`launch: ${m}`); process.exit(2); };
-const USAGE = "node tools/launch.mjs new <name> [--preset drawn|clean]\n node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180] [--poster-frame N] [--gate] [--strict-zones]";
+const USAGE = "node tools/launch.mjs new <name> [--preset drawn|clean]\n node tools/launch.mjs ship <name> [--shapes 16x9,1x1,4x5,9x16] [--blur auto] [--shutter 180] [--poster-frame N] [--gate] [--zones warn]";
const DRAWN = (n) => `// ${n}: a launch film on the template (references/workflows/launch-video-kit.md).
// Fill every TODO from the sourced brief (references/workflows/launch-video.md, "Ground it in the real
@@ -113,7 +113,8 @@ const pass = ["blur", "shutter", "poster-frame", "blur-max", "blur-px"].flatMap(
const node = (args) => spawnSync(process.execPath, args, { stdio: "inherit" }).status === 0;
const quiet = (args) => { const r = spawnSync(process.execPath, args, { encoding: "utf8", maxBuffer: 1 << 26 }); return { ok: r.status === 0, out: (r.stdout ?? "") + (r.stderr ?? "") }; };
mkdirSync(resolve("out"), { recursive: true });
-const rows = [], zoneMode = rest.includes("--strict-zones") ? "fail" : "warn";
+const zoneMode = arg("zones", "fail"); if (!["fail", "warn"].includes(zoneMode)) die(`--zones is fail or warn, got '${zoneMode}'\nusage: ${USAGE}`);
+const rows = [];
const fx = readFacts(resolve("facts.json")), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);
console.log(`\nFACTS ${film}: ${factsRes.status}${factsRes.status === "N/A" ? ` ${factsRes.reason}` : ` ${factsRes.checked} claim(s)`}`);
for (const p of factsRes.problems) console.log(` FAIL "${p.claim.slice(0, 60)}" ${p.why}`);
diff --git a/skills/anidoodle/references/formats.md b/skills/anidoodle/references/formats.md
index 7a0a984..a619741 100644
--- a/skills/anidoodle/references/formats.md
+++ b/skills/anidoodle/references/formats.md
@@ -97,10 +97,11 @@ Words on screen, wherever the shape:
of the height, and the right 14 % of the width (the button column) between them. The shares are
the cautious end of the creator safe-area guidance those apps publish for vertical video,
rounded up; their layouts change, so re-check before a campaign. `framecheck.mjs` finds text in
- those zones on any 9:16 frame (`SAFE-ZONES`); on `launch.mjs ship` it is a FLAG that does not
- fail the shape, because the launch template's phone layouts are a chat window across the whole
- frame; `--strict-zones` makes it fail. Other shapes report N/A. Burned-in captions
- (`captions: "burn"`) sit in the bottom zone by design: for those feeds, ship the sidecar.
+ those zones on any 9:16 frame (`SAFE-ZONES`) and `launch.mjs ship` fails the shape for it
+ (`--zones warn` only flags it). The launch template composes its 9:16 layout inside the safe
+ rectangle: the chat, the words, the split beat, the end card and the corner mark, with burned-in
+ captions (`captions: "burn"`) in a band at the safe rectangle's bottom. The background still fills
+ the frame. Other shapes report N/A.
- **Claims** in a film, on screen or spoken, are listed with their sources in `facts.json`
(`workflows/facts.md`).
diff --git a/skills/anidoodle/references/workflows/launch-video-kit.md b/skills/anidoodle/references/workflows/launch-video-kit.md
index 3d0fd27..8cd32c5 100644
--- a/skills/anidoodle/references/workflows/launch-video-kit.md
+++ b/skills/anidoodle/references/workflows/launch-video-kit.md
@@ -35,8 +35,8 @@ contact sheet of EVERY shape against this list, and fix, never waive:
- **Time to read.** Each text up at least `max(0.7 s, 0.3 s per word)`, and never over a busy picture
without a plate (`craft-bar.md`). `framecheck.mjs` fails a declared cue held too briefly.
- **Phone safe zones on 9:16.** No text in the top 14 %, the bottom 25 % or the right 14 % of the
- frame, where the platforms put their own interface (`formats.md`). `ship` flags it per shape;
- `--strict-zones` fails it.
+ frame, where the platforms put their own interface (`formats.md`). `ship` fails the shape for it;
+ `--zones warn` only flags it. The template's 9:16 layout already keeps every line inside.
- **Every claim sourced.** The words, the tagline and any extra `claims` in the spec are listed in
`facts.json` with their source sentence and URL or file (`workflows/facts.md`); `ship` checks it.
- **No edge-cropped content.** A card, a product window, a film's card sits whole in the frame
diff --git a/skills/anidoodle/references/workflows/launch-video.md b/skills/anidoodle/references/workflows/launch-video.md
index 277a173..4e9847a 100644
--- a/skills/anidoodle/references/workflows/launch-video.md
+++ b/skills/anidoodle/references/workflows/launch-video.md
@@ -144,10 +144,11 @@ into place), round iris seams, the product's own UI. Pick one per film; never mi
- **Shapes**: `16x9` for YouTube and the site, `1x1` or `4x5` for feeds, `9x16` for Reels and
Shorts. Re-compose per shape from one timeline; never crop a wide render. The template does it
through `launchLayout.ts` (`launch.mjs ship <film> --shapes 16x9,1x1,9x16`), with phone-safe type:
- every line a viewer reads at least 32 px at 1080 across on the phone shapes.
+ every line a viewer reads at least 32 px at 1080 across on the phone shapes, and on 9x16 inside the
+ platforms' safe zones (`formats.md`).
- **Captions**: feeds autoplay muted. Ship `.srt`/`.vtt` for players that take a sidecar (YouTube,
LinkedIn, the site); burn them into their OWN band under the picture for feeds that do not
- (`captions: "burn"`), never over the art.
+ (`captions: "burn"`), never over the art; on 9x16 the band sits at the bottom of the safe zones.
- **Sync and peak are checked on the file you ship**, not the master: the sound at every sync
marker within 1 ms of the mix, the true peak at or under -1 dBTP after the AAC encode
(`verify-export --delivery`).