Film build
Start
sh ~/.claude/skills/film-build/kit/init.sh marketing/videos/<film> # refuses a non-empty folder
cd marketing/videos/<film> && npm i && npx playwright install chromium # if it says NEXT
The kit gives you:
| File | What it is |
|---|---|
film/core.js | the engine: scene({name, from, to, build, run, after}) (times in beats = s × 2), put(el, {o, css}), reg(el, base), C.W/C.H/C.FMT, C.start() |
film/film.js | a starter with every helper below and four example shots (line, prompt, split, persona card). Each helper's comment says which rejection it came from. Replace the shots, keep the helpers. |
film/mock.js | window.MOCK: HTML for real UI pieces (dashboards, windows, phone screens), in screen px |
film/index.html | loads fonts from assets/fonts/{display,ui}.woff2 (with local sans fallbacks) |
scripts/render.mjs | --sheet, --at t1,t2, --draft, --range a,b, --verify, final, --mux, --fmt 9x16, --all |
scripts/sync.mjs | copies timeline.json into the page |
scripts/review.py | critique kit from the rendered MP4: contact sheet, fastest-action strips, phone view, 9:16 safe zones, metrics |
tools/probe.mjs | cuts (every cut and each shot's midpoint, in video seconds) or any expression, e.g. "window.UNWARP(12.4)" |
tools/sheet.py | tile stills into one labelled sheet |
tools/pack_grid.py | cut a 4×3 character sheet (transparent or on white) into a 12-cell strip for sprite(); prints the cell size |
tools/cut_cast.py | cut a one-row lineup into single still characters |
assets/characters/ | four example characters (founder, dev, seller, student), 12-frame strips with 360 px cells |
tools/same.sh | save / check PSNR regression between before and after stills |
Helpers in the starter (use them, don't reinvent)
io(quintic in-out) for camera moves and morphs;oq(quint-out) for entrances;backfor a small overshoot.cam(e, s, fx, fy)puts focus point (fx, fy) of a 1920×1080 plane at the frame centre at scale s.camDdoes the same but never shows past the plane's edges (cover scale; essential in 9:16).posIn(e, root)reads an element's position inside the moving plane (for cursor targets, caret follow).typed()for words appearing letter by letter in a line;keyed()for a real keyboard: irregular per-character timing, longer pauses on spaces, a blinking caret after.wordsHTML()lays every word out at its final width from the first frame, transparent until its time, so the line never re-flows ("text transition is not at all smooth").cursor()/putCursor()/bump(): a real arrow cursor that glides, arrives early, dips 15 % on a click.pop()for small items landing.sprite(parent, src, cellW, cellH, h)/putSprite(e, t, a, z, loops)for a drawn character: steps through its 12 frames over a → z, with a small breath so it never sits still. It's an<img>, so the engine waits for it.shot(name, t0, t1, build, run)wrapsscenein seconds.- Pacing warp at the bottom:
SLOW(global stretch),EVholds (freeze a moment for reading) and inserts;window.CUTSandwindow.UNWARPgive video times for sound and voice placement. PT/pk(a16, a9)choose per-format values in one file.
Rules of the engine (determinism)
The film is a pure function of t. Any frame must paint the same whether rendered first or after any other frame.
- 2D transforms only: no
translate3d, nowill-change, no CSS transitions, noMath.random(use a hash of an index). - Hidden-at-start elements:
reg(el, {o: 0}), never inlineopacity:0. - Measure layout in
after()or once inbuild, never insiderun(it reads the previous frame). - 3D views: re-insert each frame with
insertBefore(v, firstChild)so no cached raster survives. - Embedded CSS animations (e.g. a product widget's own): pause them and set
animation-delay: calc(-1s * var(--t)). - Wait for images and fonts (
decode(),document.fonts.ready) before the first frame. - Scope product CSS under a unique root class; use unique class names in the film (
.wleaked once). classList.add, neverclassName =.node scripts/render.mjs --verifymust print 12/12 before any render you send.
Realism: read references/realism.md before building any screen
Short version: real apps at real density, real logos from brands' own sites, OS chrome with apps that exist on that OS, real wallpapers, phones on the real launcher grid at real dp sizes drawn by the product's own renderer, product UI richer than you think it needs to be, a nominative-use line whenever a brand mark shows.
Build loop (review-driven)
- Shot list from the approved storyboard into
film.js, oneshot()each, overlapping for hand-offs. - Stills first.
node tools/probe.mjs cuts→ render a still at every shot midpoint and every hand-off:node scripts/render.mjs --at …thenpython3 tools/sheet.py review/stills/16x9 review/sheet.jpg <times>. Read the sheet yourself. Fix. Repeat. (About 1–2 min a round, vs 25+ for a full render.) - QA pass before ANY review you send: step through the film at ≤ 1.5 s and at every hand-off (10–15 fps
contact sheet over each transition). Check
references/qa.mdline by line: overlaps, clipping, blank frames, reading time, text smoothness, typing, logo notice, OS realism, phone sizes. - Send stills (the sheet) to the owner for the first look. Wait.
- Draft:
node scripts/render.mjs --draft(30 fps, ~4 min),python3 scripts/review.py 1 --draft, read the strips. Send the draft MP4. Say clearly it's a 30 fps draft without blur (looks choppier than the final). - On "render final":
node scripts/render.mjsin the background (60 fps, motion blur; ~25–35 min for 60 s). Never editfilm.jswhile it renders: copy the project first if you need to keep working. - Commit film code and timeline after each approved round.
Pace
First cuts are almost always too fast. On-screen text needs about 0.3 s per word + 1 s at full opacity (never under
1.5 s). Prefer the warp (SLOW 1.1–1.25, EV holds on lines) to retiming every shot. After any pace change, re-run
probe.mjs cuts because sound and voice positions move.
9:16: read references/formats.md
Reframe the same film in one file with pk(); prove 16:9 unchanged with tools/same.sh (every still PSNR = inf);
--verify --fmt 9x16; stills sheet for the owner; then --fmt 9x16 final in the background, then --mux --fmt 9x16.