Whiteboard Teacher Video
Turns a script into a video that "draws itself." The visuals are not generated images — they are code that draws line by line — so they can be re-rendered, fine-tuned, and have zero image generation cost.
Engine Contract (Understand This First)
The entire video is a pure function of time. ENGINE.renderAt(t) renders the frame at second t, independent of what played before.
This enables four capabilities, which are also the fundamental reason you must follow the discipline:
| Capability | Relies On |
|---|---|
| Changing one page only re-renders affected segments | Segment cache key = sha1(engine + that page code) |
| 12 browsers render in parallel | Each segment is independent |
| Preview can jump to any point | No need to play from start |
| Deterministic validation | Same frame rendered twice, compare pixels |
Red line: Page code must NOT use Math.random() / Date.now() / CSS transitions / rAF. Random must use PV.rng(seed), time must use P.c(i) / P.cw(i,'word'). Violating this breaks all four capabilities above.
Workflow (Follow Steps, Don't Skip)
User: "Make a 90-second video about relativity"
↓
① Read references/storyboard-method.md → write storyboard.json
② ★★★ STOP, read the storyboard to the user for confirmation ★★★ ← only mandatory human gate
③ Write script.js (voiceover, fill cues per storyboard)
④ python scripts/ftnew.py <project> --title "..." --style whiteboard
⑤ python scripts/ftvoice.py <project> → voice.js + subtitles.srt
⑥ Write pages/pNN.js one by one ← main creative work
⑦ python scripts/ftcheck.py <project> → lint + snapshot per page
⑧ Open out/snap/pNN.jpg in Read, review page by page → fix targeted issues, **no more than 2 rounds**
⑨ python scripts/ftrender.py --fps 24 --skip-subs → **first rough cut**
⑩ ★ Deliver rough cut to user ★ ← don't hoard it
⑪ Do one round of fixes from feedback → ftrender.py → deliver final version
Step ② is NOT optional. If the storyboard is wrong, everything that follows is just a pretty slideshow. The original project made this a promise gate for a reason.
★★ Step ⑩ is equally important: ship first, polish later
The user wants a video, not a perfect video. Delivery cadence matters more than final polish.
- In step ⑧, quality-check only until there are no obvious errors (lint errors gone, text not hidden, NaN resolved to 0). Don't chase perfect composition.
- First render with
--fps 24 --skip-subs(40% faster), give the user a watchable version first. - Don't finish all rounds of fixes before delivering. The user can only give real feedback on a rough cut.
- Want to change style, add pages, adjust content? Just edit and re-render – segment caching makes the second round fast (1 minute per changed page in practice).
Real-world lesson: When making that 95-second, 8-page video, I agonized over whether lint-reported issues were worth fixing, did two rounds before delivering, and the user got impatient. Correct approach: Fix lint errors and obvious bugs, ship the rough cut, then fix the rest in one round.
★ Lint all green ≠ frame is correct
lint is a machine check; it only catches hard errors like off-canvas, overlap, or font size. Whether the composition looks good, elements are cramped, or text is hidden by a color block — you can only tell by looking at the snapshot.
Real-world lesson: Page 07 had 0 lint errors and all-green quality check, but the snapshot revealed that the word "microseconds" was completely hidden by a highlighter, leaving only the red "7" — the viewer couldn't read the unit.
Hard Rules
★ Cadence (Most Important)
- The user wants a video, not a perfect video. A rough cut is still a video; hoarding it is the same as not having done anything.
- Quality-check only until there are no obvious errors, don't chase perfect composition.
- First render with
--fps 24 --skip-subs(40% faster), ship the watchable version first. - Then do one round of fixes and deliver the final version. Segment caching makes the second round fast (1 minute per changed page in practice).
Visuals
- Content area: x 140–1780, y 180–880. y > 900 is the subtitle strip, never place content there.
- ★ Centered text must use
w+align:'c'— withoutw,xis the left edge not the center. This is the most frequent mistake. - ★ On pages with
P.push(), place elements toward the center of the frame — after zoom-in, edge text will overflow the canvas (lint reports off-canvas). - Body text font size ≥ 32px (< 24px fails lint).
- At most 8 Chinese characters per screen.
- Use only semantic color names:
inksoftmutedfaintblueorangeredgreenpurpleyellow; appendFfor light fill (blueF). NEVER hardcode hex — wrong names are logged by the engine and reported in the quality check. - One idea per page, 2–3 spoken sentences, with something new appearing every 2–4 seconds.
Animation
P.c(i, dt)= start of sentence i + dt seconds.P.cw(i, 'word', dt)= when speaker reaches a specific word in sentence i + dt seconds (use for key numbers: the number appears exactly when spoken).P.ce(i)= end of that sentence;P.endT= end of this page.- Use pen techniques for emphasis (
ring,underline,markhighlighter,cross,check), NOT special effects. - At page transitions, there must be something on the page — never a blank frame.
Iteration
- Change one page → only re-render that page (
ftcheck.py --only pNN), not the whole thing. - If lint reports errors, don't render — fix them first.
- Even if lint passes, still review the snapshot — lint only checks hard errors; it doesn't judge composition or occlusion.
ftcheck.pywill report NaN — this is a fatal issue that lint can't always catch (the graphic silently disappears).- If you can't fix everything, mark it as "needs attention" and move on. Don't stall (max 2 rounds before shipping a video).
Reference Timings (local test, 8 pages, 87-second video)
| Stage | Time |
|---|---|
| Create project + write 8 page drawing code | ~10 min (human creative time) |
| Voiceover for 26 sentences | ~1.5 min |
| Quality check (lint + 8 page snapshots) | ~1 min |
| Render (first time, 12 workers) | ~2 min 45 sec |
| Render (after changing one page, cache hit) | ~1 min |
Render (--fps 24 --skip-subs fast mode) | ~1 min 40 sec |
So from project creation to first rough cut: about 15 minutes total. Iteration on a single page takes one minute — so don't hoard all changes before delivering.
Three High-Frequency Pitfalls in the Engine API
// ① Centering text: without `w`, `x` is the left edge, not the center
P.text('Platform', { x: 420, y: 640, w: 280, align: 'c', size: 46 }); // ✓ center is at 420
// ② The third argument of check/cross is "size", not a config object (passing wrong type gives NaN without an error)
P.cross(970, 716, 64, { color: 'red', at: t }); // ✓
P.cross(970, 716, { color: 'red', at: t }); // ✗ sz = [object Object]
// ③ Don't name the callback parameter of liveRough 'R'; also R only has four methods: box/circle/line/path
const R = 1400; // ← will be shadowed by callback parameter
P.liveRough((lt, R) => (xL + R) / 2); // ✗ NaN
P.liveRough((lt, rough) => [rough.box(x, y, w, h, { color: 'ink' })]); // ✓
Watch the console for NaN during rendering — it doesn't throw an exception, lint may not report it, but the corresponding graphic simply won't draw.
Full reference: references/page-api.md.
Can Do / Cannot Do
Can do: knowledge explanations, concept introductions, process walkthroughs, data charts & graphs, product demos (with real screenshots embedded), GitHub project walkthroughs; five visual styles; landscape/portrait; Chinese/English voiceover; auto-generated subtitles; videos from 20 seconds to 10 minutes.
Cannot do:
- Photorealistic / 3D live-action style (for that quality, use a generative image tool)
- Automatic background music and sound effects (
page.sfxexists, but you must supply your own audio files) - Generative-style hand-drawn illustrations (all components are code-drawn vector graphics)
- Generate dozens of pages at once (each page requires code; ≤ 12 pages recommended)
Difference from whiteboard-explainer
| whiteboard-explainer | frametell-video (this skill) | |
|---|---|---|
| Visuals | Pixel-level stroke growth | rough.js stylized drawing |
| Style | Single (whiteboard, hardcoded background color) | Five styles, including dark |
| Components | All hand-written | 29 pre-built |
| Quality check | Ownership check only | lint + snapshot + deterministic |
| Best for | Math derivation, strong hand-drawn feel | Science explainers, chart-heavy, multiple styles |
Need "true hand-drawn feel / element-by-element growth" → use whiteboard-explainer. Need "multiple styles / complex charts / component reuse / strong quality checks" → use this skill.
Documentation Index
| When to read | Which doc |
|---|---|
| First time using this skill | assets/example-relativity/ (complete source of a real finished video: 8 pages, read it and you'll understand) |
| Before drawing any page | references/page-api.md (drawing API quick reference + three high-frequency pitfalls) |
| When writing storyboard / voiceover | references/storyboard-method.md (five-act structure + taboos) |
| When choosing style / unsure about colors | references/style-packs.md (five styles + syntax card summary) |
When script.js fields are unclear | references/script-format.md |
| When voiceover fails / want to change TTS | references/tts-backends.md (includes note that edge-tts is blocked) |
| When you don't understand engine errors | references/troubleshooting.md (indexed by symptom) |
First Time Use
If scripts/ reports "engine not ready" or missing dependencies, run setup first:
python scripts/setup.py # cross-platform
powershell -ExecutionPolicy Bypass -File scripts/setup.ps1 # Windows
Requirements: Node.js ≥ 22.19, Git, local Chrome/Edge, Python 3.9+
First time takes about 2–4 minutes: pulls the engine from GitHub (approx 16MB, sparse checkout only packages/engine) + npm install dependencies (approx 130MB).
If Git is not installed: manually download https://github.com/sitor-ai/frametell, copy packages/engine into the skill root as engine/, then run setup again.
Dependency list and sizes are in README.md; licensing info is in vendor/ATTRIBUTION.md.