# what-if-animation

Adopt this skill: https://proskills.md/skills/other/kelano86-what-if-animation

Page: https://proskills.md/skills/other/kelano86-what-if-animation
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 10095
sha: 86a4616c385d530c2c150366a449bbb4c543f465
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/SKILL.md

````text
---
name: what-if-animation
description: Make a "What If" animated episode from one topic line ("What if you could rewind 10 seconds?"), in the dusk-lit stick-figure style of the What If channels that broke out on YouTube in October 2026. Writes the script on the seven-beat What If formula, voices it with ElevenLabs, lays out a shot list at the genre's pace, renders a storyboard of stills and self-checks it before animating, animates every frame in code (Remotion and SVG, with an original cast on one rig, rooms in perspective and light from lamps and windows), generates and syncs the sound, and masters a finished 15-25 s episode to -14 LUFS. Use when someone asks for a What If episode, animation or cartoon, "make a what if video about X", a stick-figure explainer in this style, or to run the free What If skill.
---

# What If animation

One topic line in, a finished 15-25 second episode out. Every frame is SVG that Claude writes (rendered by
Remotion); the voice and the sound come from ElevenLabs. Two examples ship in `studio/src/episodes/`, both ready to
render: `rewind` ("What if you could rewind 10 seconds?", the proof clip: shots played backwards as the power) and
`copy-paste` ("What if you could copy and paste anything?", the skill's first full run: a new kitchen set, a
schematic for the science beat, a cliffhanger blackout). Read the one closest to your topic before you start.

| File | What's in it |
|---|---|
| `references/formula.md` | The seven-beat What If formula, the 15-25 s shape, script rules, choosing a topic |
| `references/look.md` | The measured look, pace, shot vocabulary, and the storyboard and motion checklists |
| `references/kit.md` | The building blocks: engine, cast, sets, room kit, light, UI, looks, and how to add each |
| `references/sound.md` | Writing sound events, prompts, levels, costs |
| `references/traps.md` | Everything that cost time on the two example episodes |
| `studio/` | The Remotion project: copy it once, then every episode lives in it |
| `scripts/` | voice, plan, stills, board, sfx, mixcheck, motiongrid, master (Python 3.9+ and Node) |

## Rules

- **Original characters only.** Pip (the hero, look B) and Mo (his friend) are ours, and so are the sister, mum and
  the suit on the rig. Never a channel's own hero, and nothing that resembles a famous cartoon character: check every
  new look on the cast sheet (Mo's first hat was dropped for drifting toward one).
- **Original stories.** The formula is shared; the episode isn't anyone else's. Don't remake a channel's title.
- **Never claim the viral channels are made with Claude** or any other tool. Nobody has said how they're made.
- **Keys by name only.** `ELEVENLABS_API_KEY`, from the environment or a `.env`
  above the studio. Never print, paste or hardcode a key.
- **Report the ElevenLabs credits** of every run: the scripts log them to `out/<slug>/costs.json` and `master.py`
  totals them in `report.json`. The voice's cost is read from the account's history (exact); sound clips don't show
  there, so their cost comes from the account counter, which can lag: re-read it before you report. Say the number
  when you hand the episode over. The copy-paste run cost 152 credits (78 for the voice, 74 for 12 new clips).
- **Storyboard before animation.** No video render until the stills pass the self-check (step 5) and, when the person
  is in the loop, they've seen the board.
- **Every fact is real.** A number in the script is worked out and sourced in the episode's `science` field first.

## Setup (once per machine)

Needs Node 18+, ffmpeg and ffprobe on the PATH, Python 3.9+ with `numpy` and `Pillow`, and an ElevenLabs key.

```bash
cp -r <skill>/studio ./what-if-studio && cd what-if-studio && npm install
```

Everything below runs from that studio folder; `<skill>` is this skill's folder. To work offline or in your own
brand face, put a display font in `public/fonts/` and set `titleFont` in `src/studio.config.ts` (the default title
face, Bricolage Grotesque, and the UI faces load from Google Fonts at render time). To update an existing studio to
a newer engine, copy `<skill>/studio/src/engine` over its `src/engine`.

## The pipeline

Work through the steps in order. Each ends on something you look at before the next.

### 1. Script

Read `references/formula.md`. Search YouTube for the premise first: if a What If channel already has that exact
episode, change the power or the rule. From the topic line, decide the power's word, its rule, three escalating
demos and the turn (one real fact with a number). Write `src/episodes/<slug>/episode.json` with `id` (PascalCase,
the composition name), `slug`, `topic`, `title` (two lines), `script` (one entry per beat) and `science` (each fact:
the claim, the working, the source). 45 to 65 words. Read it aloud at pace: every line must be a picture.

### 2. Voice

```bash
python <skill>/scripts/voice.py <slug>
```

One ElevenLabs take with character timestamps (the 356-character copy-paste take cost 78 credits), then the pauses
cut to the genre's pace: `public/<slug>/voice.wav` and `src/episodes/<slug>/words.json`. Check the length (15-25 s)
and the word times it prints. Retune pauses with `gaps` in `episode.json` and re-run: the take is cached, so that's free. Change a word
and it calls the API again.

### 3. Shot list

Design one shot per picture in the script (usually 9 to 14), varying the size and angle every cut (wide, insert,
medium, close-up, over the shoulder, high, low; see `references/look.md`). Add to `episode.json`:

- `shots`: `{ "id": "S1", "size": "medium", "set": "kitchen", "key": 14, "note": "what we see" }` (`key` is the
  frame of the shot's own clock the storyboard shows)
- `edit`: `{ "shot": "S1", "at": "cookie" }` per cut, cued on the word it lands on (`plan.py` lists the cue forms;
  `reverse`, `from`, `to` and `look` for powers that bend a shot's clock)
- `fx`: one-frame flashes and shakes, `{ "at": "S3+2", "kind": "flash" }`

```bash
python <skill>/scripts/plan.py <slug>
```

It writes `timeline.json` and `out/<slug>/shotlist.md` and prints the pace. Aim for 27+ cuts a minute in the
opening and no static shot over about 3 s; fix what it flags before drawing anything.

### 4. Storyboard

Read `references/kit.md` for the building blocks. Write `src/episodes/<slug>/shots.tsx`, one component per shot,
each a pure function of its clock `t` (copy the patterns in the two examples' `shots.tsx`), and `index.tsx` (the
episode and its power look), then add the episode to `src/episodes/index.ts`. At this step each shot only needs to
be right at its `key` frame. When a topic needs a place the library lacks, build it with the room kit and add it to
`src/engine/sets/` (and to the skill's copy) so the next episode has it, as the copy-paste run did with the kitchen
and the schematic. A new character or costume: add the look, then check it on the cast sheet
(`npx remotion still src/index.ts Cast out/cast.png`).

```bash
npx tsc --noEmit
node <skill>/scripts/stills.mjs <slug>
python <skill>/scripts/board.py <slug>
```

`out/<slug>/storyboard.jpg`: one captioned still per shot.

### 5. Self-check the stills

Look at the storyboard, then open every still in `out/<slug>/board/` at full size, and run the storyboard checklist
in `references/look.md` honestly, shot by shot. Write down what fails, fix it, re-render just those shots
(`stills.mjs <slug> S3 S7`), rebuild the sheet and look again. Repeat until it passes. Check `references/traps.md`
for the failure you're seeing before inventing a fix. If the person is in the loop, show them the board now and
take their notes before animating.

### 6. Animate

Bring each shot to life from its key pose: `poseAt` keys with anticipation, holds and overshoot, `faceAt` for
expressions, camera moves with `kf`, the power's look, the `fx`. Then render a draft and check the motion:

```bash
python <skill>/scripts/master.py <slug>
python <skill>/scripts/motiongrid.py <slug> S2 S5
node <skill>/scripts/stills.mjs <slug> --frames 120 240
```

Read the grids like a flipbook against the motion checklist in `references/look.md`; fix and re-render until it
reads.

### 7. Sound

Read `references/sound.md`. Add `sound` to `episode.json`: the clips (prompt and length), one event per visible
action cued to its shot, ambiences per location, the music bed and the levels. Check what the library already has,
then generate:

```bash
python <skill>/scripts/sfx.py <slug> --dry
python <skill>/scripts/sfx.py <slug>
```

It prints the credits it used and sets the stem volumes in `timeline.json`. Then check that every word stays clear:

```bash
python <skill>/scripts/mixcheck.py <slug>
```

It lists the moments, while a word is being spoken, where effects or music come within 3 dB of the voice. A hit that
illustrates a word lands in the pause just after it, never on it; a bed (a hum, a drone) under a key line comes down;
if most of the stem crowds the voice, lower `sfx_lu`. Re-run sfx.py and the check until only deliberate overlaps
remain (a title boom, a turn).

### 8. Master and hand over

```bash
python <skill>/scripts/master.py <slug>
```

Renders, brings the mix to -14 LUFS with peaks under -1 dBTP, and writes `out/<slug>/report.json` (length, loudness,
pace, credits). Watch the final file once through with sound. Hand over `out/<slug>/<slug>-final.mp4` and
`out/<slug>/storyboard.jpg`, with the length, the ElevenLabs credits used, and anything you'd still improve.

## Where an episode lives

| Path | What |
|---|---|
| `src/episodes/<slug>/episode.json` | Everything you write: script, science, shots, edit, fx, sound |
| `src/episodes/<slug>/shots.tsx`, `index.tsx` | The drawing: one component per shot, the power's look |
| `src/episodes/<slug>/words.json`, `timeline.json` | Written by voice.py and plan.py (sfx.py adds the volumes) |
| `public/<slug>/` | voice.wav, sfx.wav, music.wav |
| `out/<slug>/` | board stills, storyboard.jpg, shotlist.md, motion grids, renders, costs.json, report.json |
| `library/sfx/` | Every generated sound clip, shared by all episodes |
````

## File: README.md
size: 7604
sha: e6c197522e42f6782aec772cdc25e557c11895d2
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/README.md

````text
# What If animation: a free skill for Claude Code and OpenCode

Type one line, "What if you could rewind 10 seconds?", and get a finished 15-25 second animated episode in the
dusk-lit stick-figure style of the "What If" channels that took off on YouTube in October 2026.

Every frame is drawn in code: the AI writes the scenes as SVG and Remotion renders them. The voice and the sound
effects come from ElevenLabs. No image model, no video model, no drawing. It runs in Claude Code, or for free in
OpenCode with a free model. Made by [FreshStack](https://freshstack.ai).

## What it does

1. **Writes the script** on the seven-beat What If formula (decoded from five scripts across four channels): a cold
   open of quick demos, the premise as a title card, the fun, and a turn built on one real, checked fact.
2. **Voices it** with ElevenLabs, with word timings, and tightens the pauses to the genre's pace.
3. **Lays out a shot list** on the words, at the genre's pace (about 27 cuts a minute in the opening and up).
4. **Renders a storyboard** of one still per shot, before any animation.
5. **Checks its own stills** against an 11-point checklist and fixes what reads wrong.
6. **Animates** an original cast on one rig, in rooms drawn in real perspective, lit by their own lamps and windows.
7. **Generates and syncs the sound:** an effect on every action, lined up by its attack, ambience per place, a
   music bed, levels set against the voice.
8. **Masters** the episode to -14 LUFS and reports what it cost.

Why the character never changes: it isn't generated, it's a rig in code. The same function draws Pip in every
shot, so there is nothing to drift.

## What you need

- [Claude Code](https://claude.com/claude-code), or [OpenCode](https://opencode.ai) with a free model (see
  [Use it in OpenCode](#use-it-in-opencode-with-a-free-model))
- Node 18 or newer, ffmpeg (with ffprobe), Python 3.9+ with `numpy` and `Pillow`
- An [ElevenLabs](https://elevenlabs.io) API key in your environment or a `.env` file as `ELEVENLABS_API_KEY`.
  The copy-paste episode cost 152 credits: 78 for the voice and 74 for 12 new sound effects. It reused 9 clips from
  the starter library that ships in `studio/library/sfx/`, and every clip you generate joins it for the next
  episode. Later runs cost 170 to 242 credits. ElevenLabs' free plan (10,000 credits a month when we checked, in
  October 2026) covers about 40 episodes, but it's for non-commercial use and asks you to credit ElevenLabs, so
  check its terms before you monetise.

## Install in Claude Code

Clone it into your skills folder, then set up the studio once:

```bash
git clone https://github.com/kelano86/what-if-animation ~/.claude/skills/what-if-animation
cp -r ~/.claude/skills/what-if-animation/studio ./what-if-studio
cd what-if-studio && npm install
```

Then, in Claude Code, from that folder:

> Make a What If episode: what if you could pause everyone but you?

Claude follows `SKILL.md`: script, voice, shot list, storyboard (you'll see it before anything is animated), self-
check, animation, sound, master. You get `out/<slug>/<slug>-final.mp4` and `out/<slug>/storyboard.jpg`.

To see the examples first: `npx remotion studio src/index.ts` and open `Rewind` (the proof clip: three demos, each
undone by playing the shot backwards) or `CopyPaste` (the skill's first full run). Both render straight away.

## Use it in OpenCode, with a free model

[OpenCode](https://opencode.ai) is a free, open-source coding agent. In October 2026 it offers GLM-5.3-Flash Free at
no cost, for a limited time, with no account or key. With this skill, that model made a full episode from one line:
28 minutes, one render, nothing typed in between, and $0 for the model (the voice and sound still use your
ElevenLabs credits).

1. Install the tools above, then OpenCode: `npm install -g opencode-ai`
2. Make a folder for your episodes, put the skill in it under `.claude/skills/`, and add the `/what-if` command
   (OpenCode doesn't list skills when you type `/`, so the command loads it for you).

   Windows (PowerShell):

   ```powershell
   mkdir what-if; cd what-if
   git clone https://github.com/kelano86/what-if-animation .claude/skills/what-if-animation
   mkdir .opencode/commands
   copy .claude/skills/what-if-animation/opencode/commands/what-if.md .opencode/commands/
   ```

   Mac or Linux:

   ```bash
   mkdir what-if && cd what-if
   git clone https://github.com/kelano86/what-if-animation .claude/skills/what-if-animation
   mkdir -p .opencode/commands && cp .claude/skills/what-if-animation/opencode/commands/what-if.md .opencode/commands/
   ```

   No git? Download the ZIP from GitHub and unzip it into `.claude/skills/` (the folder's name doesn't matter), then
   copy `opencode/commands/what-if.md` from it into `.opencode/commands/`.
3. Put your key in a file called `.env` in the same folder, one line: `ELEVENLABS_API_KEY=your-key`
4. Start OpenCode **from inside that folder**: `cd` into it (on Windows you can right-click the folder and choose
   Open in Terminal), then type `opencode`. Started anywhere else, it won't find the skill or the command.
5. Type `/models`, choose GLM-5.3-Flash Free, and press Ctrl+T until the reasoning level reads high.
6. Type `/what-if What if you could pause everyone but you?` and leave it running. The first run copies the studio
   into `what-if-studio/` and installs it, which adds a few minutes.

Tips for the free model:

- One session per episode. An episode can fill most of its 200K context; start fresh for the next one.
- Search YouTube for your premise yourself. The free model's search can miss episodes that already exist, and the
  skill wants an original title.
- Open the source of the episode's fact (`science` in its `episode.json`) before you post.

## What's in the folder

| Path | What |
|---|---|
| `SKILL.md` | The pipeline the AI follows |
| `references/` | The formula, the measured look and checklists, the building-block catalogue, sound, traps |
| `studio/` | The Remotion project: the engine (rig, sets, light, UI, the episode engine) and two example episodes |
| `scripts/` | voice, plan, stills, board, sfx, mixcheck, motiongrid, master |
| `opencode/commands/what-if.md` | The `/what-if` command for OpenCode |

## The rules it follows

- Original characters only: never a channel's hero, nothing that resembles a famous cartoon character.
- Original stories: the formula is shared, the episodes aren't anyone's.
- It never claims the viral channels are made with Claude or any other tool; nobody has said how they're made.
- Every fact in a script is worked out and sourced before it's voiced.

## Honest limits

- Walk cycles and acting are simple next to a hand-animated channel; the look carries it.
- Painted, textured styles (the ink-and-paper explainers) aren't realistic in pure code; they need an image model.
- It's not one prompt: the storyboard step is where the episode gets good. Look at it.

## Licences

- Fonts load from Google Fonts at render time (Bricolage Grotesque, Fragment Mono, Kalam: SIL Open Font License).
  To use your own title face, put it in `studio/public/fonts/` and set `titleFont` in `src/studio.config.ts`.
- [Remotion](https://www.remotion.dev/license) is free for individuals and for companies of up to three people;
  larger companies need a Remotion company licence.
- Voices and sound effects are generated by your ElevenLabs account under its terms. The example episodes' audio
  and the starter clips in `studio/library/sfx/` were generated on a paid plan.
- The code is free to use, change and share.
````

## File: scripts/board.py
size: 3703
sha: 5105ffe19f3b1a5069b69547000e5b556c510ebf
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/board.py

```text
"""Step 4: the storyboard sheet. Lays the board stills out as one captioned contact sheet: shot number and size, start
time, the words over it, and the note. This is what gets reviewed (by you, then by the person) before any animation.

python <skill>/scripts/board.py <slug> [--cols 3]
Reads  out/<slug>/board/<shot>.png (from stills.mjs) and src/episodes/<slug>/timeline.json
Writes out/<slug>/storyboard.jpg
"""
import json, pathlib, sys

from PIL import Image, ImageDraw, ImageFont

from wi import STUDIO, ep_dir, out_dir

slug = sys.argv[1]
cols = int(sys.argv[sys.argv.index('--cols') + 1]) if '--cols' in sys.argv else 3
tl = json.loads((ep_dir(slug) / 'timeline.json').read_text(encoding='utf-8'))
ep = json.loads((ep_dir(slug) / 'episode.json').read_text(encoding='utf-8'))
src = out_dir(slug) / 'board'

def font(size, bold=True):
    """The first face that exists: your own (fonts/ in the studio), then common system faces, then Pillow's default."""
    cands = [STUDIO / 'public' / 'fonts' / 'board.ttf', STUDIO / 'public' / 'fonts' / 'board.otf']
    cands += [pathlib.Path(p) for p in ['C:/Windows/Fonts/segoeuib.ttf' if bold else 'C:/Windows/Fonts/segoeui.ttf', 'C:/Windows/Fonts/arialbd.ttf',
                                         '/System/Library/Fonts/Supplemental/Arial Bold.ttf', '/System/Library/Fonts/Helvetica.ttc',
                                         '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf']]
    for c in cands:
        if c.exists():
            return ImageFont.truetype(str(c), size)
    return ImageFont.load_default(size)

head, body, note = font(34), font(28), font(23, False)
W, H, CAP, PAD = 960, 540, 160, 24
n = len(tl['shots'])
rows = (n + cols - 1) // cols
sheet = Image.new('RGB', (cols * W + (cols + 1) * PAD, rows * (H + CAP + PAD) + PAD + 90), (20, 17, 26))
d = ImageDraw.Draw(sheet)
title = ' '.join(ep['title']) if isinstance(ep.get('title'), list) else ep.get('topic', slug)
d.text((PAD, 26), f'{title}  ·  storyboard, one key frame per shot  ·  {tl["total"] / tl["fps"]:.1f} s', font=head, fill=(246, 239, 227))

def fit(text, f, width):
    """Wrap text into at most two lines that fit the caption."""
    words, lines, cur = text.split(), [], ''
    for w in words:
        t = (cur + ' ' + w).strip()
        if d.textlength(t, font=f) <= width:
            cur = t
        else:
            lines.append(cur)
            cur = w
    lines.append(cur)
    if len(lines) > 2:
        lines = lines[:2]
        lines[1] = lines[1][: max(0, len(lines[1]) - 2)] + '…'
    return lines

for i, s in enumerate(tl['shots']):
    x = PAD + (i % cols) * (W + PAD)
    y = 90 + PAD + (i // cols) * (H + CAP + PAD)
    p = src / f'{s["id"]}.png'
    if p.exists():
        sheet.paste(Image.open(p).convert('RGB').resize((W, H)), (x, y))
    else:
        d.rectangle([x, y, x + W, y + H], fill=(60, 30, 40))
        d.text((x + 20, y + 20), f'missing {p.name}', font=body, fill=(255, 120, 120))
    d.rectangle([x, y + H, x + W, y + H + CAP], fill=(32, 27, 40))
    d.text((x + 18, y + H + 12), f'{i + 1}  {s["id"]}  {s["size"].upper()}', font=head, fill=(255, 177, 90))
    at = f'{s["first"] / tl["fps"]:.1f} s'
    d.text((x + W - 18 - d.textlength(at, font=note), y + H + 20), at, font=note, fill=(170, 160, 185))
    line = f'"{s["line"]}"' if s.get('line') else '(no words)'
    yy = y + H + 58
    for ln in fit(line, body, W - 36):
        d.text((x + 18, yy), ln, font=body, fill=(246, 239, 227))
        yy += 34
    if s.get('note'):
        d.text((x + 18, yy + 2), fit(s['note'], note, W - 36)[0], font=note, fill=(170, 160, 185))
out = out_dir(slug) / 'storyboard.jpg'
sheet.save(out, quality=88)
print(out, sheet.size)
```

## File: scripts/master.py
size: 3030
sha: e0e009b294d76a37c17876ee2457e32e1f3642ec
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/master.py

```text
"""Step 8: the master. Renders the episode, then brings the mix to -14 LUFS with true peaks under -1 dBTP (two-pass
loudnorm, video copied untouched), measures the result and writes the report.

python <skill>/scripts/master.py <slug> [--skip-render] [--concurrency 6]
Writes out/<slug>/<slug>-raw.mp4, out/<slug>/<slug>-final.mp4 and out/<slug>/report.json
"""
import json, re, subprocess, sys, time

from wi import STUDIO, ep_dir, load_episode, load_json, loudness, out_dir, save_json

slug = sys.argv[1]
args = sys.argv[2:]
conc = args[args.index('--concurrency') + 1] if '--concurrency' in args else None
ep = load_episode(slug)
od = out_dir(slug)
raw = od / f'{slug}-raw.mp4'
final = od / f'{slug}-final.mp4'
npx = 'npx.cmd' if sys.platform == 'win32' else 'npx'

if '--skip-render' not in args:
    t0 = time.time()
    cmd = [npx, 'remotion', 'render', 'src/index.ts', ep['id'], str(raw), '--log', 'error']
    if conc:
        cmd += ['--concurrency', conc]
    print(' '.join(cmd))
    subprocess.run(cmd, cwd=STUDIO, check=True)
    print(f'rendered in {time.time() - t0:.0f} s')

I, TP, LRA = -14.0, -1.5, 11
first = subprocess.run(['ffmpeg', '-hide_banner', '-nostats', '-i', str(raw), '-af', f'loudnorm=I={I}:TP={TP}:LRA={LRA}:print_format=json', '-f', 'null', '-'],
                       capture_output=True, text=True, encoding='utf-8', errors='ignore').stderr
m = json.loads(first[first.rfind('{'):first.rfind('}') + 1])
filt = (f"loudnorm=I={I}:TP={TP}:LRA={LRA}:measured_I={m['input_i']}:measured_TP={m['input_tp']}:measured_LRA={m['input_lra']}"
        f":measured_thresh={m['input_thresh']}:offset={m['target_offset']}:linear=true")
subprocess.run(['ffmpeg', '-y', '-v', 'error', '-i', str(raw), '-c:v', 'copy', '-af', filt, '-ar', '48000', '-c:a', 'aac', '-b:a', '256k', '-movflags', '+faststart', str(final)], check=True)
lufs, peak = loudness(final)
tp = subprocess.run(['ffmpeg', '-hide_banner', '-nostats', '-i', str(final), '-af', f'loudnorm=I={I}:TP={TP}:print_format=json', '-f', 'null', '-'],
                    capture_output=True, text=True, encoding='utf-8', errors='ignore').stderr
true_peak = float(json.loads(tp[tp.rfind('{'):tp.rfind('}') + 1])['input_tp'])
dur = float(subprocess.run(['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of', 'csv=p=0', str(final)], capture_output=True, text=True).stdout.strip())
tl = load_json(ep_dir(slug) / 'timeline.json')
costs = load_json(od / 'costs.json', [])
report = {
    'episode': ep['id'], 'file': str(final), 'seconds': round(dur, 2), 'lufs': lufs, 'true_peak_dbtp': true_peak,
    'segments': len(tl['segments']), 'cuts_per_min': round((len(tl['segments']) - 1) / (tl['total'] / tl['fps']) * 60, 1),
    'elevenlabs_credits': sum(c['credits'] for c in costs), 'cost_lines': costs,
}
save_json(od / 'report.json', report)
print(json.dumps({k: v for k, v in report.items() if k != 'cost_lines'}, indent=1))
ok = abs(lufs + 14) <= 0.5 and true_peak <= -1.0
print('loudness OK' if ok else '! loudness off target: check the report')
```

## File: scripts/mixcheck.py
size: 1833
sha: 4259fbb2b1f8a3c587fd81954117312727438900
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/mixcheck.py

```text
"""Step 7 check: is the voice clear of the effects and the music? Measures the three stems at their mix volumes in
0.4 s windows and lists the moments, while someone is speaking, where effects or music come within `margin` dB of the
voice. Fix a flagged moment by lowering that event's gain in episode.json, then re-run sfx.py.

python <skill>/scripts/mixcheck.py <slug> [--margin 3]
"""
import json, sys

import numpy as np

from wi import SR, decode, ep_dir, stem

slug = sys.argv[1]
margin = float(sys.argv[sys.argv.index('--margin') + 1]) if '--margin' in sys.argv else 3.0
tl = json.loads((ep_dir(slug) / 'timeline.json').read_text(encoding='utf-8'))
A = tl['audio']
stems = {k: decode(stem(slug, k)) * A.get(f'{k}Vol', 1) for k in ['voice', 'sfx', 'music'] if stem(slug, k)}
n = min(len(x) for x in stems.values())
W = int(0.4 * SR)

def db(x):
    return 20 * np.log10(np.sqrt(np.mean(x ** 2)) + 1e-9)

segs = tl['segments']
starts = range(0, n - W, W // 2)
levels = [db(stems['voice'][i:i + W]) for i in starts]
speaking = float(np.percentile([v for v in levels if v > -60], 70)) - 8  # windows this loud are words, not pauses
flags = []
for i, v in zip(starts, levels):
    if v < speaking:
        continue
    for k in ['sfx', 'music']:
        if k in stems:
            o = db(stems[k][i:i + W])
            if o > v - margin:
                fr = int(i / SR * tl['fps'])
                shot = next((s['shot'] for s in segs if s['a'] <= fr < s['b']), '?')
                flags.append((round(i / SR, 1), shot, k, round(o - v, 1)))
mix = sum(x[:n] for x in stems.values())
print(f'{len(flags)} moments where the effects or music come within {margin:g} dB of the voice (time s, shot, stem, dB over the voice):')
for f in flags:
    print('  ', f)
print('mix peak before mastering:', round(float(np.abs(mix).max()), 3))
```

## File: scripts/motiongrid.py
size: 2431
sha: 17466c9b26f2d19a9b625726eb27222d7e7be505
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/motiongrid.py

```text
"""Step 6: the motion check. Pulls frame grids from a render, one sheet per shot (or per frame range), each frame
labelled, so a walk, a fall, a catch or a reversal can be read at a glance without scrubbing.

python <skill>/scripts/motiongrid.py <slug> [S3 S5 ...] [--video out/<slug>/<slug>-raw.mp4] [--step 2]
python <skill>/scripts/motiongrid.py <slug> --range 120:180
Writes out/<slug>/motion/<shot>.jpg (every segment of that shot, in order) or out/<slug>/motion/range-<a>-<b>.jpg
"""
import json, subprocess, sys

from PIL import Image, ImageDraw, ImageFont

from wi import ep_dir, out_dir

slug = sys.argv[1]
args = sys.argv[2:]

def opt(name, default=None):
    return args[args.index(name) + 1] if name in args else default

video = opt('--video', str(out_dir(slug) / f'{slug}-raw.mp4'))
step = int(opt('--step', 2))
tl = json.loads((ep_dir(slug) / 'timeline.json').read_text(encoding='utf-8'))
out = out_dir(slug) / 'motion'
out.mkdir(exist_ok=True)
skip = {opt('--video'), opt('--step'), opt('--range')}
want = [a for a in args if not a.startswith('--') and a not in skip]
jobs = []
if opt('--range'):
    a, b = map(int, opt('--range').split(':'))
    jobs.append((f'range-{a}-{b}', list(range(a, b + 1, step))))
else:
    for s in tl['shots']:
        if want and s['id'] not in want:
            continue
        frames = []
        for g in tl['segments']:
            if g['shot'] == s['id']:
                frames += list(range(g['a'], g['b'], step))
        jobs.append((s['id'], frames))
try:
    font = ImageFont.truetype('arial.ttf', 22)
except OSError:
    font = ImageFont.load_default(22)
W, H, cols = 480, 270, 6
for name, frames in jobs:
    rows = (len(frames) + cols - 1) // cols
    sheet = Image.new('RGB', (cols * W, rows * H))
    for i, f in enumerate(frames):
        raw = subprocess.run(['ffmpeg', '-v', 'error', '-i', video, '-vf', f'select=eq(n\\,{f}),scale={W}:{H}', '-vframes', '1', '-f', 'image2pipe', '-vcodec', 'png', '-'], capture_output=True, check=True).stdout
        tmp = out / '_f.png'
        tmp.write_bytes(raw)
        im = Image.open(tmp).convert('RGB')
        dr = ImageDraw.Draw(im)
        dr.rectangle([0, 0, 64, 28], fill=(0, 0, 0))
        dr.text((5, 2), str(f), fill=(255, 255, 0), font=font)
        sheet.paste(im, ((i % cols) * W, (i // cols) * H))
    p = out / f'{name}.jpg'
    sheet.save(p, quality=85)
    print(p)
(out / '_f.png').unlink(missing_ok=True)
```

## File: scripts/plan.py
size: 6239
sha: 31abaa1253c98eeedf19d36a6d369bba81dd16e5
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/plan.py

```text
"""Step 3: the shot list on the voice. Resolves the edit's cues against the word timings and writes the timeline.

python <skill>/scripts/plan.py <slug>
Reads  src/episodes/<slug>/episode.json (shots, edit, fx) and words.json (from voice.py)
Writes src/episodes/<slug>/timeline.json (the engine reads it) and out/<slug>/shotlist.md, and prints the pace.

An edit entry:  {"shot": "S4", "at": "homework", "look": "copy"}
  at       when the cut lands: a word ("homework", "paste#2" = its 2nd occurrence after the previous cut), "+18" (frames
           after the previous cut), "s:4.2", "f:126". A word cut lands `lead` frames (default 2) before the word.
  reverse  true plays the shot's clock backwards, from where it was last seen ("from") to "to" (default 0)
  from     the shot's clock at the cut (default 0 forward)
  look     a power look the episode defines (rewind, copy...): grade and overlay while it runs
The episode ends `tail` seconds (default 0.9) after the last word, or at "end": "<cue>".
"""
import statistics, sys

from wi import ep_dir, load_episode, load_json, out_dir, resolve, save_json, find_word, stem

slug = sys.argv[1]
ep = load_episode(slug)
FPS = ep.get('fps', 30)
LEAD = ep.get('lead', 2)
words = load_json(ep_dir(slug) / 'words.json', [])
if not words and any(not str(e['at']).startswith(('f:', 's:', '+')) for e in ep['edit']):
    raise SystemExit('No words.json yet: run voice.py first (or use f:/s: cues).')
shots = {s['id']: s for s in ep['shots']}

# ---------------------------------------------------------------- cut points
starts, wi_prev, prev = [], 0, 0
for k, e in enumerate(ep['edit']):
    if e['shot'] not in shots:
        raise SystemExit(f'Edit entry {k} uses unknown shot {e["shot"]}')
    at = str(e['at'])
    if at.startswith(('f:', 's:')):
        a = resolve(at, words, FPS)
    elif at.startswith('+'):
        a = prev + int(at[1:])
    else:
        base, _, off = at.partition('+') if '+' in at else (at, '', '0')
        if '#' in base:
            w, n = base.split('#')
            i = find_word(words, w, wi_prev, int(n))
        else:
            i = find_word(words, base, wi_prev)
        wi_prev = i + 1
        a = max(0, round(words[i]['s'] * FPS) - LEAD + int(off or 0))
    if k == 0:
        a = 0
    if a <= prev and k > 0:
        raise SystemExit(f'Edit entry {k} ({e["shot"]} at {at}) starts at frame {a}, not after the previous cut ({prev})')
    starts.append(a)
    prev = a
end = resolve(ep['end'], words, FPS) if 'end' in ep else round((words[-1]['e'] + ep.get('tail', 0.9)) * FPS)
if end <= starts[-1]:
    raise SystemExit(f'The last shot starts at {starts[-1]} but the episode ends at {end}')

# ---------------------------------------------------------------- segments and shot clocks
segments, last_clock = [], {}
for k, e in enumerate(ep['edit']):
    a, b = starts[k], starts[k + 1] if k + 1 < len(starts) else end
    if e.get('reverse'):
        t0 = e.get('from', last_clock.get(e['shot'], b - a))
        t1 = e.get('to', 0)
    else:
        t0 = e.get('from', 0)
        t1 = t0 + (b - a)
    last_clock[e['shot']] = t1
    line = ' '.join(w['w'] + w.get('p', '').strip() for w in words if a <= round(w['s'] * FPS) + LEAD < b)
    seg = {'shot': e['shot'], 'a': a, 'b': b, 't0': t0, 't1': t1, 'line': line}
    if e.get('look'):
        seg['look'] = e['look']
    segments.append(seg)

ids = list(dict.fromkeys(s['shot'] for s in segments))
for sid in shots:
    if sid not in ids:
        print(f'note: shot {sid} is defined but not in the edit')
info = []
for sid in ids:
    segs = [s for s in segments if s['shot'] == sid]
    fwd = [s for s in segs if s['t1'] >= s['t0']]
    length = max([s['t1'] for s in fwd] + [s['t0'] for s in segs])
    d = shots[sid]
    first = segs[0]
    info.append({
        'id': sid, 'size': d.get('size', ''), 'key': d.get('key', (first['b'] - first['a']) // 2), 'len': length, 'first': first['a'],
        'line': first['line'], 'note': d.get('note', ''),
    })

# ---------------------------------------------------------------- fx, audio
fx = []
for e in ep.get('fx', []):
    item = {k: v for k, v in e.items() if k != 'at'}
    item['f'] = resolve(e['at'], words, FPS, segments, ids)
    fx.append(item)
old = load_json(ep_dir(slug) / 'timeline.json', {}) or {}
audio = {k: v for k, v in old.get('audio', {}).items() if k.endswith('Vol')}
for k in ['voice', 'sfx', 'music']:
    f = stem(slug, k)
    if f:
        audio[k] = f'{slug}/{f.name}'
title = ep.get('title', ['', ''])
tl = {'slug': slug, 'title': ' '.join(title) if isinstance(title, list) else title, 'fps': FPS, 'total': end, 'segments': segments, 'shots': info, 'fx': fx, 'audio': audio}
save_json(ep_dir(slug) / 'timeline.json', tl)

# ---------------------------------------------------------------- the pace report and the shot list
cuts = [s['a'] for s in segments[1:]]
lens = [(s['b'] - s['a']) / FPS for s in segments]
dur = end / FPS
first10 = len([c for c in cuts if c < 10 * FPS])
per_min = len(cuts) / dur * 60
print(f'{len(segments)} segments, {len(ids)} shots, {dur:.1f} s ({end} frames)')
print(f'pace: {per_min:.0f} cuts/min overall, {first10 / min(10, dur) * 60:.0f} cuts/min in the first 10 s; median shot {statistics.median(lens):.1f} s, longest {max(lens):.1f} s')
if per_min < 24:
    print('  ! slower than the genre opening (about 27 cuts a minute): split long shots or cut on more words')
for s in segments:
    if (s['b'] - s['a']) / FPS > 4:
        print(f'  ! {s["shot"]} holds {(s["b"] - s["a"]) / FPS:.1f} s: give it action inside (a move, a light change, a push in) or split it')
rows = ['| # | Shot | Size | In | Length | Clock | Look | Words |', '|---|---|---|---|---|---|---|---|']
for k, s in enumerate(segments):
    d = shots[s['shot']]
    clock = f"{s['t0']:.0f}→{s['t1']:.0f}" + (' (back)' if s['t1'] < s['t0'] else '')
    rows.append(f"| {k + 1} | {s['shot']} | {d.get('size', '')} | {s['a'] / FPS:.2f} s | {(s['b'] - s['a']) / FPS:.2f} s | {clock} | {s.get('look', '')} | {s['line']} |")
md = f"# {tl['title']}: shot list\n\n{dur:.1f} s, {len(segments)} segments, {per_min:.0f} cuts/min\n\n" + '\n'.join(rows) + '\n'
(out_dir(slug) / 'shotlist.md').write_text(md, encoding='utf-8')
print(md)
```

## File: scripts/sfx.py
size: 7287
sha: 782c33866522e62c48461e8666815421afee91a8
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/sfx.py

```text
"""Step 7: sound. Generates the episode's sound effects and music bed with ElevenLabs, lines each hit up on its frame,
mixes the effects and music stems, and sets their levels against the voice.

python <skill>/scripts/sfx.py <slug> [--dry]
Reads  src/episodes/<slug>/episode.json "sound", timeline.json and words.json
Writes public/<slug>/sfx.wav and music.wav, sets their volumes in timeline.json, prints the credits it used.
--dry lists the clips it would generate (and what is already in the library) without calling the API.

"sound": {
  "clips":   {"name": ["prompt", seconds], ...}       generated once, cached in library/sfx/ by name + prompt + length
  "events":  [[cue, clip, gain, align, until], ...]   align "onset" (default: the attack lands on the cue) or "peak"
                                                        (the loudest moment does, for whooshes and booms); until = a cue
                                                        where the clip is cut with a short fade
  "repeats": [{"at": cue, "clip": name, "n": 15, "every": 2, "gain": [lo, hi], "pitch": [lo, hi]}]
                                                        one clip many times, each pitched a little differently
  "music":   {"clip": name, "until": cue, "reverse_looks": ["rewind"], "from": cue}
                                                        the bed starts at "from" (default 0), cut at "until"; during a look
                                                        listed in reverse_looks it plays what just played, backwards
  "levels":  {"sfx_lu": 1.5, "music_lu": -9.5}         integrated loudness of each stem against the voice's
}
Cues are the same as in plan.py: "S3+2", "f:46", "s:1.5", "paste+3".
"""
import sys, time

import numpy as np

from wi import SR, api, clip_path, credits_used, spent_since, decode, ep_dir, load_episode, load_json, log_cost, loudness, pub_dir, resolve, save_json, stem, write_wav

slug = sys.argv[1]
dry = '--dry' in sys.argv
ep = load_episode(slug)
S = ep.get('sound')
if not S:
    raise SystemExit('episode.json has no "sound" section')
tl = load_json(ep_dir(slug) / 'timeline.json')
if not tl:
    raise SystemExit('No timeline.json: run plan.py first')
words = load_json(ep_dir(slug) / 'words.json', [])
FPS = tl['fps']
ids = [s['id'] for s in tl['shots']]
cue = lambda c: resolve(c, words, FPS, tl['segments'], ids)
DUR = tl['total'] / FPS + 0.4

# ---------------------------------------------------------------- the clips
need = {}
for name, (prompt, secs) in S['clips'].items():
    need[name] = (prompt, secs, clip_path(name, prompt, secs))
missing = [n for n, (_, _, p) in need.items() if not p.exists()]
print(f'{len(need)} clips, {len(need) - len(missing)} already in the library, {len(missing)} to generate: {", ".join(missing) or "none"}')
if dry:
    sys.exit(0)
if missing:
    before, _ = credits_used()
    t0 = time.time()
    for n in missing:
        prompt, secs, p = need[n]
        p.write_bytes(api('/v1/sound-generation?output_format=mp3_44100_128', {'text': prompt, 'duration_seconds': secs, 'prompt_influence': 0.45}))
        print('  generated', n)
    used, items = spent_since(t0, expect=len(missing))
    after, _ = credits_used()
    used = max(used, after - before)
    note = f'{len(missing)} clips, {sum(need[n][1] for n in missing):.1f} s'
    if items < len(missing) and after == before:
        note += '; not all in the history or the counter yet, check the usage page'
    log_cost(slug, 'sound', used, note)

clips = {}
for n, (_, _, p) in need.items():
    x = decode(p)
    clips[n] = x / max(1e-9, np.abs(x).max())  # every clip at the same peak, so the gains mean something

def onset(x, mode):
    a = np.abs(x)
    win = int(0.01 * SR)
    sm = np.convolve(a, np.ones(win) / win, mode='same')
    return int(np.argmax(sm)) if mode == 'peak' else int(np.argmax(sm > 0.2 * sm.max()))

def put(buf, frame, x, gain, align='onset', cut=None):
    i = int(frame / FPS * SR) - onset(x, align)
    if i < 0:
        x, i = x[-i:], 0
    if cut is not None:
        n = max(0, int(cut / FPS * SR) - i)
        x = x[:n].copy()
        f = min(len(x), int(0.08 * SR))
        if f:
            x[-f:] *= np.linspace(1, 0, f)
    j = min(len(buf), i + len(x))
    if j > i:
        buf[i:j] += x[: j - i] * gain

# ---------------------------------------------------------------- effects
sfx = np.zeros(int(DUR * SR))
for ev in S.get('events', []):
    c, name, gain = ev[0], ev[1], ev[2]
    align = ev[3] if len(ev) > 3 else 'onset'
    until = cue(ev[4]) if len(ev) > 4 and ev[4] else None
    put(sfx, cue(c), clips[name], gain, align, until)
for r in S.get('repeats', []):
    base = clips[r['clip']]
    g0, g1 = r.get('gain', [0.3, 0.3])
    p0, p1 = r.get('pitch', [1, 1])
    start = cue(r['at'])
    for i in range(r['n']):
        k = p0 + (p1 - p0) * ((i * 37) % 11) / 10
        shifted = np.interp(np.arange(0, len(base), k), np.arange(len(base)), base)
        put(sfx, start + r.get('every', 2) * i, shifted, g0 + (g1 - g0) * ((i * 53) % 7) / 6)

# ---------------------------------------------------------------- music
music = np.zeros(int(DUR * SR))
M = S.get('music')
if M:
    m = clips[M['clip']]
    m0 = int(cue(M['from']) / FPS * SR) if M.get('from') else 0
    n = min(len(music) - m0, len(m))
    music[m0:m0 + n] = m[:n]
    for seg_look in M.get('reverse_looks', []):
        runs = []
        for s in tl['segments']:
            if s.get('look') == seg_look:
                if runs and runs[-1][1] == s['a']:
                    runs[-1][1] = s['b']
                else:
                    runs.append([s['a'], s['b']])
        for a, b in runs:
            i, j = int(a / FPS * SR), int(b / FPS * SR)
            seg = music[max(0, i - 2 * (j - i)): i][::-2][: j - i]  # what just played, backwards at double speed
            music[i: i + len(seg)] = seg * 0.55
    if M.get('until'):
        end = int(cue(M['until']) / FPS * SR)
        f = int(0.03 * SR)
        music[max(0, end - f): end] *= np.linspace(1, 0, min(f, end))
        music[end:] = 0

# ---------------------------------------------------------------- stems and levels against the voice
pub = pub_dir(slug)
write_wav(pub / 'sfx.wav', sfx, 0.98)
if M:
    write_wav(pub / 'music.wav', music, 0.98)
L = {'sfx_lu': 1.5, 'music_lu': -9.5}
L.update(S.get('levels', {}))
v_lufs, _ = loudness(stem(slug, 'voice'))
s_lufs, _ = loudness(pub / 'sfx.wav')
m_lufs, _ = loudness(pub / 'music.wav') if M else (float('-inf'), 0)
gain_db = {'voice': 0.0, 'sfx': v_lufs + L['sfx_lu'] - s_lufs}
if M:
    gain_db['music'] = v_lufs + L['music_lu'] - m_lufs
top = max(gain_db.values())
vols = {k: round(min(1.0, 0.8 * 10 ** ((g - top) / 20)), 4) for k, g in gain_db.items()}  # the loudest stem at 0.8
audio = tl.get('audio', {})
audio.update({'voice': f'{slug}/{stem(slug, "voice").name}', 'sfx': f'{slug}/sfx.wav', 'voiceVol': vols['voice'], 'sfxVol': vols['sfx']})
if M:
    audio.update({'music': f'{slug}/music.wav', 'musicVol': vols['music']})
tl['audio'] = audio
save_json(ep_dir(slug) / 'timeline.json', tl)
print(f'voice {v_lufs:.1f} LUFS, effects stem {s_lufs:.1f}, music stem {m_lufs:.1f}')
print(f'volumes in the mix: {vols} (effects {L["sfx_lu"]:+.1f} LU and music {L["music_lu"]:+.1f} LU against the voice)')
```

## File: scripts/stills.mjs
size: 2526
sha: bfdb7be31e661b6d0d239067f0ea03ed5bef73c6
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/stills.mjs

```text
// Step 4: the storyboard stills. Renders one still per shot at its key frame from the <Id>Board composition,
// bundling once. Run from the studio folder:
//   node <skill>/scripts/stills.mjs <slug> [S1 S4 ...] [--scale 0.5]
// Writes out/<slug>/board/<shot>.png. With shot ids, renders only those (after a fix).
// Also: node <skill>/scripts/stills.mjs <slug> --frames 120 300   renders frames of the main composition
// (out/<slug>/frames/f0120.png), for checking a moment inside a shot.
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';

// Remotion is installed in the studio, not next to this script: resolve it from the folder we run in.
const require = createRequire(path.resolve('package.json'));
const { bundle } = require('@remotion/bundler');
const { renderStill, selectComposition } = require('@remotion/renderer');

const args = process.argv.slice(2);
const slug = args[0];
const scaleAt = args.indexOf('--scale');
const scale = scaleAt >= 0 ? Number(args[scaleAt + 1]) : 0.5;
const framesAt = args.indexOf('--frames');
const rest = args.slice(1).filter((a, i, all) => !a.startsWith('--') && all[i - 1] !== '--scale');
const ep = JSON.parse(fs.readFileSync(path.resolve('src/episodes', slug, 'episode.json'), 'utf8'));
const tl = JSON.parse(fs.readFileSync(path.resolve('src/episodes', slug, 'timeline.json'), 'utf8'));

const serveUrl = await bundle({ entryPoint: path.resolve('src/index.ts'), publicDir: path.resolve('public') });
if (framesAt >= 0) {
  const outDir = path.resolve('out', slug, 'frames');
  fs.mkdirSync(outDir, { recursive: true });
  const composition = await selectComposition({ serveUrl, id: ep.id });
  for (const fr of rest.map(Number)) {
    const output = path.join(outDir, `f${String(fr).padStart(4, '0')}.png`);
    await renderStill({ serveUrl, composition, frame: fr, output, overwrite: true, scale });
    process.stdout.write(`${fr} `);
  }
} else {
  const outDir = path.resolve('out', slug, 'board');
  fs.mkdirSync(outDir, { recursive: true });
  const composition = await selectComposition({ serveUrl, id: `${ep.id}Board` });
  const want = rest.length ? rest : tl.shots.map((s) => s.id);
  for (const id of want) {
    const i = tl.shots.findIndex((s) => s.id === id);
    if (i < 0) throw new Error(`No shot ${id} in the timeline`);
    await renderStill({ serveUrl, composition, frame: i, output: path.join(outDir, `${id}.png`), overwrite: true, scale });
    process.stdout.write(`${id} `);
  }
}
console.log('\ndone');
```

## File: scripts/voice.py
size: 5090
sha: 57781fc6f66983e0732d1b5ab3e588986b7a63cf
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/voice.py

```text
"""Step 2: the voice. ElevenLabs text-to-speech with character timestamps, then the pauses tightened to the genre's pace.

python <skill>/scripts/voice.py <slug> [--force]
Reads  src/episodes/<slug>/episode.json  (script, voice, gaps)
Writes public/<slug>/voice_raw.mp3, public/<slug>/voice.wav (tightened), src/episodes/<slug>/words.json (word timings
       after tightening, used by plan.py) and out/<slug>/words_raw.json. Prints the credits it used.
The API is only called when the text or the voice settings change (cached by a hash), so re-running to retune the
gaps is free.

episode.json "voice" (all optional): {"id": "TX3LPaxmHKxFdv7VOQHJ", "model": "eleven_multilingual_v2",
  "settings": {"stability": 0.4, "similarity_boost": 0.8, "style": 0.35, "use_speaker_boost": true}}
episode.json "gaps" (seconds, all optional): {"word": 0.12, "comma": 0.2, "sentence": 0.3, "question": 0.45,
  "pairs": {"anything|One": 0.6}}  -> every pause longer than its limit is cut to the limit, from its middle.
"""
import base64, hashlib, json, re, sys, time

import numpy as np

from wi import SR, api, spent_since, decode, ep_dir, load_episode, load_json, log_cost, out_dir, pub_dir, save_json, write_wav

slug = sys.argv[1]
force = '--force' in sys.argv
ep = load_episode(slug)
V = {'id': 'TX3LPaxmHKxFdv7VOQHJ', 'model': 'eleven_multilingual_v2', 'settings': {'stability': 0.4, 'similarity_boost': 0.8, 'style': 0.35, 'use_speaker_boost': True}}
V.update(ep.get('voice', {}))
text = ' '.join(b['text'].strip() for b in ep['script'])
sig = hashlib.sha1(json.dumps([text, V], sort_keys=True).encode()).hexdigest()[:12]
raw_mp3 = pub_dir(slug) / 'voice_raw.mp3'
raw_words = out_dir(slug) / 'words_raw.json'
meta = load_json(out_dir(slug) / 'voice_meta.json', {})

if force or meta.get('sig') != sig or not raw_mp3.exists() or not raw_words.exists():
    print(f'{len(text)} characters to ElevenLabs (voice {V["id"]})')
    t0 = time.time()
    res = json.loads(api(f'/v1/text-to-speech/{V["id"]}/with-timestamps?output_format=mp3_44100_128', {'text': text, 'model_id': V['model'], 'voice_settings': V['settings']}))
    raw_mp3.write_bytes(base64.b64decode(res['audio_base64']))
    al = res['alignment']
    words, cur = [], None
    for ch, s, e in zip(al['characters'], al['character_start_times_seconds'], al['character_end_times_seconds']):
        if re.match(r"[\w'’]", ch):
            if cur is None:
                cur = {'w': '', 's': s, 'e': e, 'p': ''}
            cur['w'] += ch
            cur['e'] = e
        else:
            if cur is not None:
                words.append(cur)
                cur = None
            if words and ch.strip():
                words[-1]['p'] += ch  # punctuation after the word decides how long its pause may be
    if cur:
        words.append(cur)
    for w in words:
        w['s'], w['e'] = round(w['s'], 3), round(w['e'], 3)
    save_json(raw_words, words)
    save_json(out_dir(slug) / 'voice_meta.json', {'sig': sig, 'chars': len(text)})
    used, n = spent_since(t0, expect=1)
    log_cost(slug, 'voice', used, f'{len(text)} characters' + ('' if n else '; not in the history yet, check the usage page'))
else:
    print('Voice unchanged since the last call: reusing it (no credits).')

# ---------------------------------------------------------------- tighten the pauses
words = load_json(raw_words)
G = {'word': 0.12, 'comma': 0.2, 'sentence': 0.3, 'question': 0.45, 'pairs': {}}
G.update(ep.get('gaps', {}))
x = decode(raw_mp3)
cuts = []

def bare(w):
    return re.sub(r'[^\w]', '', w)

for a, b in zip(words, words[1:]):
    gap = b['s'] - a['e']
    key = bare(a['w']) + '|' + bare(b['w'])
    if key in G['pairs']:
        keep = G['pairs'][key]
    elif '?' in a['p'] or '!' in a['p']:
        keep = G['question']
    elif '.' in a['p'] or ':' in a['p'] or ';' in a['p'] or '…' in a['p']:
        keep = G['sentence']
    elif ',' in a['p'] or '—' in a['p'] or '-' in a['p']:
        keep = G['comma']
    else:
        keep = G['word']
    if gap > keep:
        mid = (a['e'] + b['s']) / 2
        rm = gap - keep
        cuts.append((mid - rm / 2, mid + rm / 2))
parts, last = [], 0.0
for s, e in cuts:
    parts.append(x[int(last * SR):int(s * SR)])
    last = e
parts.append(x[int(last * SR):])
fade = int(0.004 * SR)  # a 4 ms fade either side of each join, so no click
for i, part in enumerate(parts):
    part = part.copy()
    if i > 0 and len(part) > fade:
        part[:fade] *= np.linspace(0, 1, fade)
    if i < len(parts) - 1 and len(part) > fade:
        part[-fade:] *= np.linspace(1, 0, fade)
    parts[i] = part
y = np.concatenate(parts)
write_wav(pub_dir(slug) / 'voice.wav', y)

def shift(t):
    return t - sum(min(e, t) - s for s, e in cuts if t > s)

out = [{'w': w['w'], 's': round(shift(w['s']), 3), 'e': round(shift(w['e']), 3), 'p': w.get('p', '')} for w in words]
save_json(ep_dir(slug) / 'words.json', out)
print(f'Tightened {len(cuts)} pauses, removed {sum(e - s for s, e in cuts):.2f} s: {len(x) / SR:.2f} s -> {len(y) / SR:.2f} s')
print(' '.join(f"{w['w']}@{w['s']}" for w in out))
```

## File: scripts/wi.py
size: 8039
sha: f673a7d723430f42dd7b9ec3c2086337d9e666de
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/scripts/wi.py

```text
"""Shared helpers for the What If animation scripts: paths, the API key, credits, cues, audio files.

Every script runs from the studio folder (the copy of studio/ where you ran npm install) and takes the episode slug:
    python <skill>/scripts/plan.py copy-paste
Episode files:  src/episodes/<slug>/episode.json (you write it), words.json + timeline.json (the scripts write them)
Audio:          public/<slug>/voice.wav, sfx.wav, music.wav
Renders/review: out/<slug>/
Sound library:  library/sfx/ (generated clips, cached by name + prompt + length, shared by every episode)
"""
import hashlib, json, os, pathlib, re, subprocess, sys, time, urllib.request, wave

import numpy as np

SR = 44100
sys.stdout.reconfigure(encoding='utf-8')
STUDIO = pathlib.Path.cwd()
if not (STUDIO / 'src' / 'episodes').exists():
    raise SystemExit('Run this from the studio folder (the one with src/episodes and package.json).')
LIB = STUDIO / 'library' / 'sfx'

# ---------------------------------------------------------------- paths
def ep_dir(slug):
    return STUDIO / 'src' / 'episodes' / slug

def pub_dir(slug):
    d = STUDIO / 'public' / slug
    d.mkdir(parents=True, exist_ok=True)
    return d

def out_dir(slug):
    d = STUDIO / 'out' / slug
    d.mkdir(parents=True, exist_ok=True)
    return d

def stem(slug, name):
    """An audio stem in public/<slug>/: name.wav, or name.mp3 (the shipped examples), or None."""
    for ext in ('wav', 'mp3'):
        q = STUDIO / 'public' / slug / f'{name}.{ext}'
        if q.exists():
            return q
    return None

def load_episode(slug):
    p = ep_dir(slug) / 'episode.json'
    if not p.exists():
        raise SystemExit(f'No episode.json at {p}')
    return json.loads(p.read_text(encoding='utf-8'))

def load_json(p, default=None):
    p = pathlib.Path(p)
    return json.loads(p.read_text(encoding='utf-8')) if p.exists() else default

def save_json(p, data):
    pathlib.Path(p).write_text(json.dumps(data, indent=1, ensure_ascii=False) + '\n', encoding='utf-8')

# ---------------------------------------------------------------- the key and credits
KEY_NAMES = ['ELEVENLABS_API_KEY']

def read_env(p):
    """A .env as text, however it was saved: UTF-8 with or without a BOM, or UTF-16 (Windows PowerShell's `>`)."""
    raw = p.read_bytes()
    if raw[:2] in (b'\xff\xfe', b'\xfe\xff'):
        return raw.decode('utf-16', errors='ignore')
    return raw.decode('utf-8-sig', errors='ignore')

def api_key():
    """The ElevenLabs key, by name only: from the environment, or the nearest .env above the studio. Never printed."""
    for n in KEY_NAMES:
        if os.environ.get(n):
            return os.environ[n]
    for d in [STUDIO, *STUDIO.parents]:
        p = d / '.env'
        if p.exists():
            for line in read_env(p).splitlines():
                for n in KEY_NAMES:
                    if line.strip().startswith(n + '='):
                        return line.split('=', 1)[1].strip().strip('"').strip("'")
    raise SystemExit(f'No ElevenLabs key: set one of {KEY_NAMES} in the environment or a .env file.')

def api(path, body=None, timeout=180):
    req = urllib.request.Request('https://api.elevenlabs.io' + path, headers={'xi-api-key': api_key(), 'Content-Type': 'application/json'})
    if body is not None:
        req.data = json.dumps(body).encode()
    with urllib.request.urlopen(req, timeout=timeout) as r:
        return r.read()

def credits_used():
    """Characters/credits used so far this billing period (ElevenLabs' counter; it can lag by minutes)."""
    s = json.loads(api('/v1/user/subscription'))
    return s['character_count'], s['character_limit']

def spent_since(t0, expect=1, tries=6):
    """Credits spent since unix time t0, read from the account's generation history, which records each item's exact
    cost (the subscription counter lags). Waits a little for `expect` items to appear. Returns (credits, items)."""
    items = []
    for i in range(tries):
        h = json.loads(api('/v1/history?page_size=100'))
        items = [it for it in h.get('history', []) if it.get('date_unix', 0) >= int(t0) - 2]
        if len(items) >= expect:
            break
        time.sleep(2 + 2 * i)
    used = sum((it.get('character_count_change_to') or 0) - (it.get('character_count_change_from') or 0) for it in items)
    return used, len(items)

def log_cost(slug, step, used, note=''):
    """Append a cost line to out/<slug>/costs.json and print the running total for the episode."""
    p = out_dir(slug) / 'costs.json'
    rows = load_json(p, [])
    rows.append({'step': step, 'credits': used, 'note': note})
    save_json(p, rows)
    total = sum(r['credits'] for r in rows)
    print(f'ElevenLabs: {step} used {used} credits{f" ({note})" if note else ""}; this episode so far: {total}')

# ---------------------------------------------------------------- words and cues
def norm(w):
    return re.sub(r"[^\w']", '', w.lower().replace('’', "'"))

def word_frame(words, fps, i):
    return round(words[i]['s'] * fps)

def find_word(words, target, start=0, nth=1):
    t = norm(target)
    seen = 0
    for i in range(start, len(words)):
        if norm(words[i]['w']) == t:
            seen += 1
            if seen == nth:
                return i
    raise SystemExit(f'Cue word "{target}" (#{nth}) not found after word {start}. Words: ' + ' '.join(w['w'] for w in words))

CUE = re.compile(r'^(?P<base>[^+\-#]+?)(?:#(?P<nth>\d+))?(?P<off>[+-]\d+)?$')

def resolve(cue, words, fps, segments=None, shot_ids=()):
    """A cue to a global frame. Forms:
    f:123      an absolute frame          s:4.2     seconds
    S3+2       2 frames after the start of shot S3's first segment (S3#2+2: its second segment; S3-4 before it)
    word+3     3 frames after the word starts (word#2: its second occurrence)
    """
    cue = str(cue).strip()
    if cue.startswith('f:'):
        return int(round(float(cue[2:])))
    if cue.startswith('s:'):
        return int(round(float(cue[2:]) * fps))
    m = CUE.match(cue)
    if not m:
        raise SystemExit(f'Bad cue "{cue}"')
    base, nth, off = m['base'], int(m['nth'] or 1), int(m['off'] or 0)
    if segments is not None and base in shot_ids:
        segs = [s for s in segments if s['shot'] == base]
        if len(segs) < nth:
            raise SystemExit(f'Cue "{cue}": shot {base} has only {len(segs)} segment(s)')
        return segs[nth - 1]['a'] + off
    return word_frame(words, fps, find_word(words, base, 0, nth)) + off

# ---------------------------------------------------------------- audio
def decode(path):
    """Any audio file to mono float64 at 44.1 kHz."""
    raw = subprocess.run(['ffmpeg', '-v', 'error', '-i', str(path), '-f', 'f32le', '-ac', '1', '-ar', str(SR), '-'], capture_output=True, check=True).stdout
    return np.frombuffer(raw, dtype=np.float32).astype(np.float64)

def write_wav(path, x, peak=None):
    if peak is not None:
        x = x / max(1e-9, np.abs(x).max()) * peak
    with wave.open(str(path), 'wb') as w:
        w.setnchannels(1)
        w.setsampwidth(2)
        w.setframerate(SR)
        w.writeframes((np.clip(x, -1, 1) * 32767).astype(np.int16).tobytes())

def loudness(path_or_args):
    """Integrated loudness (LUFS) and true peak (dBTP) of a file, via ffmpeg's ebur128."""
    args = path_or_args if isinstance(path_or_args, list) else ['-i', str(path_or_args)]
    r = subprocess.run(['ffmpeg', '-hide_banner', '-nostats', *args, '-af', 'ebur128=peak=true', '-f', 'null', '-'], capture_output=True, text=True, encoding='utf-8', errors='ignore')
    txt = r.stderr
    summ = txt[txt.rfind('Summary:'):]
    i = re.search(r'I:\s+(-?[\d.]+|-inf) LUFS', summ)
    p = re.search(r'Peak:\s+(-?[\d.]+|-inf) dBFS', summ)
    f = lambda m: float(m.group(1)) if m and m.group(1) != '-inf' else float('-inf')
    return f(i), f(p)

def clip_path(name, prompt, secs):
    h = hashlib.sha1(f'{prompt}|{secs}'.encode()).hexdigest()[:8]
    LIB.mkdir(parents=True, exist_ok=True)
    return LIB / f'{name}-{h}.mp3'
```

## File: references/formula.md
size: 6110
sha: a2fd68e0bd815fd8454627dfdbe9c285d4108256
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/references/formula.md

````text
# The script: the seven-beat What If formula

Decoded on 21 Oct 2026 from five scripts across four channels that broke out with this format in October 2026
(Ifverse, FunNotSoFun, IFinity, Could've Been Tales). The full episodes run 7 to 10 minutes and hit all seven beats;
the skill makes a 15 to 25 second episode, which is the cold open of one: beats 1 to 4 in full, 5 to 7 folded into
the last line.

## The seven beats

1. **Cold open in the middle of the action.** A flash-forward to the climax, or three or four quick demos of the
   power.
2. **The premise and its rules.** What changed overnight, and the rules it comes with.
3. **The fun part.** Escalating wins in everyday life.
4. **The not-so-fun part.** The cost, with real science and real numbers woven into the story ("That's real.").
5. **Someone powerful notices.** A man in a suit, robbers, a government.
6. **A moral choice with family at stake,** usually a little sister.
7. **Cliffhanger.** "Part 1 of 2", a question for the comments, sometimes an "is any of this real?" section and
   sourced science notes in the description.

Recurring cast: you (second person), a best friend, a little sister, mum. In our cast: Pip is "you", Mo is the best
friend, and `sis`, `mom` and `suit` are on the rig for beats 5 and 6.

## The 15 to 25 second shape

| Beat | Seconds | What it does | Example (rewind) |
|---|---|---|---|
| 1. Cold open | 0 to 11 | Three quick demos: a small everyday problem, the power, the win. The power's word is said every time. | "You knock your coffee off the desk. Rewind. You catch it." x3 |
| 2. Premise | 11 to 15 | The title card says it: "What if you could ...?", plus one rule. | "What if you could rewind ten seconds, any time you want?" |
| 3. Fun | 1 to 2 s | One line, or one more escalation. | "Sounds amazing." |
| 4 to 7. The turn | last 2 to 6 s | The cost, ideally one real fact with a number and "That's real.", then a line that leaves a question open. | "It's about to ruin your life." |

A longer cut (40 to 60 s) adds beat 4 properly (the fact, then its consequence on screen), the suit noticing (5)
and the sister in danger (6), and ends on "Part 1".

## Writing rules

- **Second person, present tense, short sentences.** Three to eight words. "Copy a cookie. Paste." beats "Imagine if
  you were able to duplicate a cookie."
- **Every line is a picture.** Each demo has to read in one shot with no text on screen: a mug, a stair, a quiz, a
  cookie, a friend. If a line needs a caption to be understood, rewrite the line.
- **The power has a word, a sound and a look.** "Rewind" plus tape whirr plus a stopwatch counting back; "Copy...
  Paste" plus a selection box plus a pop. Say the word in every demo, so the viewer learns the grammar by the third.
- **Escalate the demos.** Small and selfish, then useful, then a little uncanny (a cookie, the homework, your best
  friend). The third demo should make the viewer slightly uneasy: it sets up the turn.
- **One real fact in the turn, with a number, checked.** Work the arithmetic, write it in the episode's `science`
  field with its source, and only then put it in the script. "That's real." goes straight after it. Never invent a
  number, never round one into a different claim.
- **End on a question or a threat,** never a resolution: "So where are yours coming from?", "It's about to ruin
  your life."
- **Length:** 45 to 65 words lands at 15 to 25 seconds after voice.py tightens the pauses (about 2.7 words a
  second). Count before you call the voice: every character costs credits.
- **The title card** is the premise, in capitals: line 1 `WHAT IF YOU COULD`, line 2 the power in four words or
  fewer with a question mark. One word of line 2 can pulse as the accent (`10`, `ANYTHING`).

## Choosing a topic

- An everyday power with clear rules and a hidden cost works best: time (rewind, pause, skip), copies, senses (hear
  thoughts, see an hour ahead), body (never sleep, 10x reaction), money, luck.
- The cost should come from real science (energy, biology, physics, economics), so beat 4 can teach something true.
- Don't remake a channel's episode: search YouTube for the premise first, and if a What If channel already has that
  exact title, pick a different power or a different rule. Most everyday powers have been done somewhere (copy-paste
  turned up a comedy short and a "Copy Powers" episode); the story, the rule and the turn are what make it ours.
  The formula is shared; the stories are ours.
- No real people, no brands, no famous characters, nothing that resembles one.

## episode.json: the script part

The copy-paste example (`studio/src/episodes/copy-paste/episode.json`), 61 words, 23 s:

```json
"topic": "What if you could copy and paste anything?",
"title": ["WHAT IF YOU COULD", "COPY AND PASTE ANYTHING?"],
"script": [
  {"beat": "1 cold open, demo 1 (small and selfish)", "text": "Copy a cookie. Paste. Free cookies, forever."},
  {"beat": "1 cold open, demo 2 (useful)", "text": "Copy your homework. Paste. Done."},
  {"beat": "1 cold open, demo 3 (a little uncanny)", "text": "Copy your best friend. Paste. Okay, that's weird."},
  {"beat": "2 the premise (title card)", "text": "What if you could copy and paste anything?"},
  {"beat": "4 the turn: the cost, one real fact", "text": "One catch: a copy can't come from nothing. One cookie, made from pure energy, needs every power plant on Earth running for over ten minutes. That's real."},
  {"beat": "5-7 folded into a question", "text": "So where are yours coming from?"}
],
"science": [
  {"claim": "One cookie made from pure energy needs every power plant on Earth running for over ten minutes.",
   "working": "A 30 g cookie: E = mc^2 = 2.70e15 J. World electricity, 29,925 TWh in 2023 = 3.4e12 W on average. 2.70e15 / 3.4e12 = about 13 minutes. Over ten minutes holds above about 24 g; the schematic states the 30 g.",
   "source": "mass-energy equivalence; Ember, Global Electricity Review 2024"}
]
```

`voice.py` joins the beats' text with spaces and sends it as one take, so the read flows; the beats are for you and
for the storyboard.
````

## File: references/kit.md
size: 13071
sha: d90445fd071b41de05564090702917bd925d5c80
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/references/kit.md

````text
# The kit: building blocks for shots

Everything imports from one place: `import { Study, Hero, poseAt, Marquee, ... } from '../../engine';`. The world is
1920 x 1080 units; a shot draws in world units and frames them with a camera.

## A shot

```tsx
export const S4: React.FC<ShotProps> = ({ t, len }) => {
  const pose = poseAt(t, [
    { f: 0, p: { x: 900, y: 712, yaw: 0.45, look: 0.6, armR: { a: 14, b: -6 } } },
    { f: 6, p: { armR: { a: 70, b: 0 } }, ease: easeOut }, // the reach
    { f: 9, p: { armR: { a: 62, b: -4 } } }, // overshoot, settle
  ]);
  const face = faceAt(t, [[0, 'neutral'], [8, 'smug']]); // swaps through a blink
  return (
    <g transform={camT(kf(t, [[0, 980], [len, 960]]), 580, kf(t, [[0, 1.75], [len, 1.9]]))}>
      {/* offset t so the set's dust and sways don't restart at every cut */}
      <Study t={t + 80} id="s4" />
      <Hero look={LOOKS.pipHood} pose={{ ...pose, ...face }} rimId="rimR" shadow={0} />
      <Desk x0={520} x1={1300} y={700} />
      <Foreground blur={10}>{/* a dark shape near camera */}</Foreground>
    </g>
  );
};
```

- `t` is the shot's own clock in frames, `len` how long it runs, `f` the global frame. Draw only from these, never
  from state or `Math.random` (scatter with `rnd(seed, i)`), so the engine can play a shot backwards or hold it.
- Draw order is depth: the set, things behind the character, the character, things in front, then `Foreground`.
- Camera: `camT(cx, cy, zoom)` centres the world point (cx, cy). Wides about 0.75 to 1.1, mediums 1.6 to 2,
  close-ups 3 to 4.5. Move it with `kf` for a push-in or a follow; shake inside a shot with `shake(t, from)`.

## The engine (`episode.tsx`)

- `defineEpisode(id, { timeline, shots, looks, grain, vignette })` makes the `<Id>` and `<Id>Board` compositions.
- A **look** is a power's visual while it runs: `{ grade: (lv) => cssFilter, jitter, Overlay: ({ f, lv, p, n }) => svg }`.
  `p` runs 0 to 1 through the look's run, `n` counts the runs. The rewind look: desaturate, jitter, tape lines, a
  REWIND chip and a stopwatch counting back (see `episodes/rewind/index.tsx`).
- `fx` in `episode.json`: `flash` (one frame, then 35% the next; `color`, `o`) and `shake` (`len`, `amp`).

## The cast (`rig.tsx`)

One rig, a costume per character (`LOOKS`): `pip` (A, mustard jacket), `pipHood` (B, the hero: dark hoodie, mustard
drawstrings), `pipInk` (C, dark head), `mo` (the friend: curls, olive jacket, headphones), `sis` (the little sister:
bunches with coral bands, teal; draw her at about 0.7 of Pip's scale), `mom` (a bob, a rose cardigan), `suit` (the
man in a suit: combed hair, charcoal suit, red tie). Render the cast sheet with
`npx remotion still src/index.ts Cast out/cast.png`.

`<Hero look pose rimId shadow />` (alias `Actor`). The **pose**:

| Field | What |
|---|---|
| `x, y, scale` | the hip point in world units; feet are `LEG_LEN * scale` below it |
| `yaw` | -1 profile facing left, 0 front, 1 profile facing right; the body narrows and the face slides |
| `facing` | 1 or -1: which way legs swing forward |
| `tilt`, `spin`, `headTilt` | lean at the hips, whole-body rotation about the chest (tumbles), head tilt |
| `armL, armR, legL, legR` | `{ a, b }`: upper segment angle from straight down, bend of the lower segment (degrees) |
| `handL, handR` | `'open'` (mitten with a thumb) or `'point'` |
| `expr` | neutral, happy, smug, shock, worried, oops, cool, dizzy, tired (heavy lids, dark rings) |
| `blink, look, glasses` | 0..1 eyelids (1 draws a shut lid's curve: blinks and sleep), -1..1 eye direction, 0..1 shades dropping on |
| `squash` | + squashes (landing), - stretches (jump), about the feet |
| `sway` | how far loose things (drawstrings, bunches) swing |
| `glint`, `glintColor` | 0..1 the eyes light up in the power's colour (default cyan); set it after `poseAt`, it isn't interpolated |

Helpers: `poseAt(t, keys)` (eased keys, faces hold until their key), `faceAt(t, [[f, expr]...])` (a blink at each
swap), `walkPose(x, phase, ground, scale, extra, facing)` (phase about 0.6 a frame; `ground` a number or a function
like `hipGround`), `joints(pose)` and `toWorld(pose, point)` (where a hand is, to attach a prop), `reachAngle(pose,
target)` (the arm angle that points at a world point).

## Props (`props.tsx`)

`Cat` (moods sleep, alert, peek; the tail never stops), `Mug` (with steam), `Cookie` (side view, `bite`),
`CookieTop` (from above), `CookieStack`, `Plate` and `PlateTop`, `Paper` (from above: `done` with ticks and a grade,
`fill` writes it in, or blank), `PaperStack`. For night episodes: `AlarmClock` (a digital bedside clock, `text` on its
display), `WallCalendar` (a month, `crossed` days with red crosses, the next one drawing on with `drawing`;
`calendarDay` gives a day's cell for a hand holding the marker), `OpenBook` (`turn` flips a page), `BookFlat`,
`BookTower`, `LaptopBack` (a lid from behind, its screen light spilling round it). From the preview run:
`PizzaSlice` (from above, x y the tip, `bite` eats back from the tip, `drip` hangs cheese; squash it in y for a
three-quarter view), `PizzaBox` (open and empty, `lid` stands the lid up), `Phone` (dark and glossy, or `on` with an
incoming call: `caller`, `buzz`), `PaperBall`. Add props here when an episode needs them, drawn in the same style:
flat fills, a darker shade on the side away from the light, a warm rim line on the lit edge, a contact shadow.

For inserts, `Tabletop` (`furnish.tsx`) fills the frame with a surface seen from high above (wood or stone), its lit
front edge at `edge` and the floor blurred below; push `edge` past 1080 for a straight top-down shot. Put props on it
in screen coordinates and bring a character's arm in from the side of frame where they are in the neighbouring shots
(the dark sleeve and the mitten, scaled up: see `S2` and `S4` in `episodes/copy-paste/shots.tsx`).

## Sets

Each set is a component taking the shot clock `t` (for dust, sways, flicker) and an `id`. Offset `t` per shot so
idle motion carries across cuts.

| Set | Coordinates and parts | Props |
|---|---|---|
| `Study` (`sets/study.tsx`) | `STUDY = makeRoom({980,500}, back 530-1430 x 335-740)`. `night` puts the moon in the window and turns the pendant off (the `Desk` lamp becomes the light); `shelf` (0..1) empties the bookcase, books flying from `STUDY_SHELF_V`. Window 782-1178 x 380-606 with the sun at (1085, 596); bookcase on the left wall, door and print on the right, pendant at u 0.32 w 0.42, wall light on the left. `Desk x0 x1 y` stands mid-room (the proof clip: x0 560, x1 1360, y 700, Pip behind it at hips (960, 712) scale 1). | `veil` (0.28 for a wide that must show the floor) |
| `Stairwell` (`sets/stairwell.tsx`) | Side-on: 7 steps of 150 x 70 down to the right from a landing at y 420 (`SW`). `stepTop(x)`, `hipGround(x)`. Lit doorway upper left, arched window lower right, lantern, sconces. `Banister` is the near layer, drawn after the characters. Walk at scale 0.9. | |
| `Classroom` (`sets/classroom.tsx`) | `CLS = makeRoom({900,470}, back 300-1500 x 130-720)`. Board 426-1054 x 196-524, windows on the left wall, two rows of desks with `Kid`s from behind. `SchoolDesk x` is the hero's desk (y 750); the proof clip's Pip stood at (1260, 760), yaw -0.35. `Kid` with `turn` and `laugh` works as a blurred foreground figure for over-the-shoulder shots. | `board` (your own chalk), `solved`, `wrong`, `laugh` |
| `Rooftop` (`sets/rooftop.tsx`) | Parapet at y 790, deck below (feet at about y 820). The sun at (`sunX`, `sunY`), r 170, optionally a clock (`clock`, `spin`, `crack`). City in three depths, string lights between poles at x 140 and 1780. | `red` (the turn's red sky), `lightsOut`, `blackout` (city windows go dark in a sweep from the left), `cityLit` (more lit windows: about 2.5 for a blackout), `low` (camera lower: the city and roof drop by `low`, so feet go lower too) |
| `Kitchen` (`sets/kitchen.tsx`) | Built with the room kit: `KITCHEN = makeRoom({960,500}, back 500-1420 x 330-745, 3.4)`. Counter run along the back wall with a sink under the window (sun at 860, 530), hob and kettle, splashback, open shelves with jars, fridge on the right, wall cabinets and a wall light on the left, two pendants. Characters stand behind the island at w 0.4 (`stand(KITCHEN, u, 0.4)`), then draw `KitchenIsland` (with two bar stools) so it hides their legs; `islandTop(u, d)` is a point on its top. | `veil`, `red` |
| `Bedroom` (`sets/bedroom.tsx`) | At night, built with the room kit: `BEDROOM = makeRoom({940,500}, back 480-1440 x 320-742, 3.4)`. Bed in the back left corner (headboard on the back wall, u 0.03-0.4, foot at w 0.47), nightstand with the lamp (`LAMP`) and the clock, `WINDOW` 1070-1330 x 374-600 onto the moon and the lit city, fairy lights and posters over the bed, `CAL` (the wall calendar), a dresser under the window, wardrobe on the right wall, door ajar on the left with the hall light, rug, beanbag, trainers. In bed: draw it with `duvet={false}`, then the character at `bedSit(u)`, then `BedDuvet` (with `knees`) over their legs. `bedTop(u, w)` is a point on the mattress. | `clock`, `lamp` (0..1: flicker it, kill it), `crossed` (the calendar), `veil` |
| `Schematic` (`sets/schematic.tsx`) | The science beat's ground: a dark blueprint grid with registration marks. On it: `DrawOn` (a path drawing on), `Arrow`, `SchLabel` (mono, pops on), `CountUp` (a number counting, with commas), `PlantIcon` (tower, wind, solar, dam, factory; lit orange when `on`). `SCH` holds its colours. | |

## The room kit (`room.tsx`, `furnish.tsx`)

For a new interior, in this order:

1. `const R = makeRoom(vp, { x0, x1, y0, y1 }, depth)`: the back wall's box on screen, the vanishing point, how deep
   the room is (3.2 to 3.5). A point in the room is `R.P(u, v, w)`: u across 0..1, v down 0..1, w toward camera
   0..1 (0 on the back wall). `R.Q([[u, v, w], ...])` gives polygon points.
2. `<RoomShell r={R} id floor="boards" | "tiles" wall side floorC />`: ceiling, walls, floor, texture, corners, trim.
3. Light sources: `<BackWindow r id t x0 x1 y0 y1 sun cols curtains />`, `<Pendant r u w t />`, `<WallLight r u v w />`.
4. Furniture: `<Box r u={[u0,u1]} v={[v0,v1]} w={[w0,w1]} front top side rim />` draws only the faces this camera
   sees; `<FloorShadow r u w />` under it. Small things go on top of boxes at `R.P(u, v0, w)`.
5. Dressing: `<FloorPlant r u w />`, `<WallFrame x y w h art />`, `<WallClock x y />`, books, jars, rugs.
6. Finish: `<LightVeil id lights={[[x, y, radius], ...]} o={0.42} />` with a hole at each light (`pendantLight(R, u,
   w)` gives a pendant's), then the glows again on top (`Glow`), then `Dust` in the brightest beam.
7. Characters: `stand(R, u, w)` gives the hip point and scale for someone standing at floor point (u, w).

## Light and atmosphere (`light.tsx`, `kit.tsx`)

`Glow` (screen-blended radial light: warm, cool, red), `Cone` (a lamp's soft cone), `LightVeil` (the contrast
pass), `Dust` (specks in a beam), `WallTexture`, `RoomCorners`, `SkyView` (a window onto the dusk: sky, sun, far
city; `night` for a deep blue sky, stars, the moon where the sun was, the city lit; `BackWindow` takes `night` too).
`DuskSky`, `Sun`, `Rays`, `Haze`, `Bokeh`, `Shaft`, `Skyline`, `Foreground` (blur 3, 6, 10 or 16), and for night
`NightSky`, `Moon`, `Stars`. Filters for characters: `rimR`, `rimL`, `rimRed`, and `rimBlue`, `rimBlueL` for
moonlight and screen light.

## UI and marks (`ui.tsx`)

All in the mono face on a dark translucent pill, cream text, orange for the live value.

| Block | Use |
|---|---|
| `TitleCard t lines accent accentT` | the premise over a wide, inside the camera group |
| `HudChip f label icon` | names the power while it runs (rewind, pause, copy, paste, skip, dot) |
| `Dial p readout` | a stopwatch, a countdown, a battery |
| `Gauge x y p label` | a level going up or down (energy, money, risk) |
| `Tag x y t text mark` | a short answer or value, with a cross or a tick drawn on |
| `Marquee x y w h t label` | a selection box with marching ants: picking a thing out of the world |
| `PasteIn x y t` | wraps anything that appears from nowhere: it pops in with an overshoot, a glow and an opening ring |
| `Toast x y t text` | a small notice that pops in and out (COPIED, SAVED) |
| `FloatLabel x y t text` | "x10", "+1" rising and fading |
| `FocusRings`, `DizzyStars`, `Sparkle` | a realisation, a daze, a glint |
| `TapeLines f` | VHS lines for time powers (full frame, in a look's overlay) |
| `FONT.title / ui / hand` | the three faces |

## Adding to the kit

- **A set:** build it with the room kit in `src/engine/sets/<name>.tsx`, export it from `engine/index.ts`, document
  its coordinates in the table above, and copy it into the skill's `studio/src/engine/sets/` so it ships.
- **A character:** a new `Look` in `LOOKS` (colours, plus an `extra` piece if it needs one, drawn in `Hero`), checked
  on the cast sheet for contrast on the dark sets and for resemblance to anything famous.
- **A power look:** in the episode's `index.tsx`; move it to `ui.tsx` once a second episode wants it.
````

## File: references/look.md
size: 5687
sha: 24ccbf48bb01b5b8e93bfb98b49caf8f5bdc980f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/references/look.md

```text
# The look: what the genre does, and the self-check

Measured on 21 Oct 2026, frame by frame, from the leading channel's most-viewed episode (4.2M views, 24 fps) with
ffmpeg scene detection. We learn the technique (timing, camera grammar, light); every character, set and story stays
our own. Nothing confirms how the viral channels make their videos, so never say or imply they're made with Claude
or any other tool.

## Pace

| | The genre | Our target for 15-25 s |
|---|---|---|
| Cuts per minute, opening | about 27 (first 90 s) | 27 or more; the cold open can run 40-70 with reversals |
| Median shot | 2.7 s in the opening | 0.7 to 3 s |
| Long holds | up to about 12 s, always with action inside | nothing static over about 3 s |

- Cuts come from **changing shot size**, not from motion: wide, then a macro insert, then a medium, then a close-up
  of a hand, then a reaction. No two neighbouring shots share a size and angle.
- The opening runs about twice as fast as the rest. Cut on the word: `plan.py` lands each cut 2 frames before its
  cue word.

## Light does most of the work

- A dusk palette: purple to orange sky, a low sun with soft rays behind the subject.
- **Every light comes from something you can see:** a window with the sun in it, a pendant, a wall light, a desk
  lamp, string lights, a lit doorway, city windows. Pools of light, dark corners.
- Muted, mid-dark walls (`S3` palette), so the practicals read; then `LightVeil` sinks the mid-tones further and
  leaves holes where the light falls.
- A warm rim light on every character edge, on the side facing the light (`rimId="rimR"` or `"rimL"`;
  `"rimRed"` for the turn).
- Haze, dust in the beams (`Dust`), soft bokeh. Depth of field: foreground objects blurred dark (`Foreground`),
  the middle sharp, the background soft on close-ups (`blur16` on a scaled-up set).
- Grain on twos and a soft vignette finish the frame (the engine's `Grade`).

## Shot vocabulary

- **Establishing wide:** the whole lit room, the character small in it.
- **Medium** (waist up, camera zoom about 1.6 to 2) and **close-up** (head; 3 to 4.5 for an extreme close-up).
- **Macro insert:** an object huge in frame, shallow focus (a mug, a cookie, a hand), often a high or top-down angle.
- **Over the shoulder:** a big, dark, blurred foreground figure filling a third of the frame.
- **High angle / top-down** (looking down at a desk, a landing) and **low angle** (looking up at a character against
  the sky: the rooftop's `low` prop).
- **Schematic** for the science beat: a dark grid, line icons, labels in the mono face, numbers counting.
- **Title card:** a wide establishing shot with the title over it, small first line, big second line.

## Characters

- Mostly three-quarter or profile (`yaw`), rarely face-on; the face slides toward the side they face.
- They animate very little: holds are near-still, with small hand changes. Expressions swap instantly through a
  blink (`faceAt`), never morph.
- Life comes from around them: a one-frame flash on an impact, focus rings, a timer, floating labels, dust, steam,
  a swaying lamp, a slow push-in.
- One hero who never changes. Every costume is a `Look` on the one rig, so it can't drift.

## On-screen text

Almost none. The title card, and small UI readouts in the mono face (a timer, a chip naming the power, a short
label). No speech bubbles, no "HA HA", no captions of the voice.

## The storyboard self-check (step 5)

Look at `storyboard.jpg`, then open every still at full size. Fix anything that fails, re-render those shots, look
again. Only a board that passes goes to animation.

1. **One read in a second.** At phone size the subject and the action are clear. If it needs the voice to make
   sense, reframe it.
2. **Sizes change.** No two neighbours share a size and angle; the board has wides, inserts, mediums, close-ups and
   at least one high or low angle.
3. **Light from a source.** Every shot has a visible practical or sunlight, and the subject sits in or against a
   pool of it. Mid-tones are dark; nothing is evenly lit.
4. **The character pops.** The face is the brightest, sharpest thing in its area; the rim light is on the lit side;
   no dark limb on a dark wall.
5. **Depth.** A blurred dark foreground in about a third of the shots; soft backgrounds on close-ups.
6. **The world is full.** Wides show 20 or more designed objects; no empty wall, no floating furniture. Everything
   that stands has legs and a contact shadow.
7. **Perspective holds.** Objects sit on their surfaces, at the right scale for the character, toward the room's
   vanishing point.
8. **Acting matches the line.** The expression and pose say the line without the voice; the hand that moves is the
   near one (with `yaw < 0` the far arm hides behind the body).
9. **Continuity.** Same costume, same set layout, same props in the same places across shots of one place.
10. **Only the title and readouts as text,** spelled right, inside the frame.
11. **Ours.** Nothing resembles a famous character, a channel's hero or a brand.

## The motion check (step 6)

Pull frame grids of every action shot with `motiongrid.py` and read them like a flipbook.

- Anticipation before a big move (a crouch before a step, a wind-up before a grab), a hold of 2 frames on the beat
  where the character realises, overshoot and settle on landings and catches.
- Nothing static for more than about a second: something always moves (dust, steam, a sway, a push-in).
- The action lands on its word, within about 3 frames.
- Reversals read backwards (every move derives from `t`, so it does).
- No pops: a prop never jumps between frames unless it's meant to (a paste, a flash).
```

## File: references/sound.md
size: 4668
sha: dc61930551b491934115e70c7d2b49c6cc051b0f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/references/sound.md

````text
# Sound

The genre is dense with sound: every visible action has its own effect, ambience fills every gap, a light music bed
runs under the cold open and cuts out at the turn. All of it comes from ElevenLabs' sound generation, cached in
`library/sfx/`, so a clip is paid for once and reused by every later episode.

## Writing the events

One event per visible action, cued to the shot it happens in, so retiming the voice never breaks the sync:

```json
"events": [
  ["S2+6", "glass_tink", 0.5],                    cue, clip, gain (0..1, clips are peak-levelled first)
  ["S3+2", "whoosh", 0.4, "peak"],                "peak": the clip's loudest moment lands on the cue (whooshes, booms)
  ["S1", "kitchen_tone", 0.12, "onset", "S6"],    an ambience from S1 cut (with a fade) where S6 starts
  ["paste+2", "pop", 0.5]                         or cue on a word
]
```

- **A hit that illustrates a word lands in the pause after it, never on it.** The copy-paste run first put each
  paste's pop on the word "Paste" and covered it; moved four to six frames later, into the gap, the word reads and
  the pop lands as the answer to it. Move the picture with it (the copy appears with its sound).
- **Align by the attack, not the file start:** `onset` (default) finds where the clip actually starts sounding. A hit
  on the frame of the visible impact; a whoosh with `peak` on the frame of the fastest movement.
- **Layers for each beat:** the action (a step, a catch), the power (its signature sound every time it's used), the
  reaction (a laugh, a gasp, a sparkle), and the room (an ambience per location, cut at the location change).
- **The power's sound** is the episode's signature: the same clip every time, so the viewer hears the rule.
- **The turn** gets a low hit (drone or boom) on its first frame, the music cut on the same frame, and one detail
  sound repeated (bulbs dying, lights switching off) through `repeats`.
- **Silence is a tool:** cut the music a beat before the title boom or the turn so the hit lands in a gap.

## Prompts that work

Describe the physical source, the material and the length: "a ceramic coffee mug smashing on a wooden floor, shards
scattering and liquid splash" beats "smash sound". Add "cartoon" for exaggerated comedy sounds (a tiptoe, dizzy
birds), "short" for one-shots, "no voices" for ambiences. Durations: 0.5 to 1.6 s for hits, 2 to 12 s for
ambiences, the episode's length for the music bed ("playful quirky cartoon background music, pizzicato strings,
glockenspiel and soft bass, light and curious, 110 bpm, no vocals").

Check the library first (`python <skill>/scripts/sfx.py <slug> --dry` lists what's cached): reuse a clip by giving
it the same name, prompt and length.

## Levels

`sfx.py` measures the voice and each stem and sets their volumes in the mix:

- effects stem: `sfx_lu` LU against the voice, integrated. The default, +1.5, is about where the approved proof clip
  sat (+1.9); the copy-paste run settled at -1.5 after the mix check. The stem is sparse, so its gated loudness reads
  high: these numbers sound denser than they look.
- music bed: `music_lu` (default -9.5) LU against the voice.
- The whole effects stem is levelled to `sfx_lu`, so lowering one event's gain makes the others louder. Lower events
  to change the balance inside the stem; lower `sfx_lu` to give the voice more room overall.
- The final mix is brought to -14 LUFS with true peaks under -1 dBTP by `master.py`.

Then run `mixcheck.py`: it lists the spoken moments where effects or music come within 3 dB of the voice. Fix the
words that matter (the fact, the last line) by moving a hit into the pause after the word or lowering it; a title
boom or a drone on the turn can stay. The proof clip had 30 such moments at 0 dB; copy-paste shipped with 14.

## Costs

The voice's exact cost is in the account's generation history, which `voice.py` reads: the 356-character copy-paste
take cost 78 credits (about 0.22 a character on this account; the proof clip's 280-character takes cost 61 and 62).
By 29 Oct 2026 the same voice and model cost about 0.44 a character (the 358-character preview-minute take: 158), so
count the characters and re-check the rate before the call.
Sound clips don't appear in the history, so `sfx.py` reads the account counter before and after, and the counter can
lag: re-read it before you report a number, or check the usage page. The copy-paste run's 12 new clips (13.5 s in
all) moved the counter by 74 credits. The proof clip's sound cost more (775 credits for five clips including 19 s of
ambience), so long ambiences are where the cost is: reuse `room_tone` and `roof_wind` from the library.
````

## File: references/traps.md
size: 6929
sha: 76c4ea7a0b809f89da15a63ca0c90f61e91e6714
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/references/traps.md

```text
# Traps

Every one of these cost real time on the proof clip or the copy-paste run. Check the list before building a set, a
shot or a character.

## Drawing

- **Dark limbs vanish on dark sets.** Navy limbs on a navy wall disappeared. Limbs are light with a dark outline, or
  the body is dark and catches a rim light (look B, the hoodie) with the head the brightest thing.
- **Stair sides are one continuous piece:** a sawtooth top and a stringer board along the underside. Alternating
  fills per step read as stacked boxes.
- **Wall texture stays faint.** The `g3wall` filter at its set strength; stronger reads as mould.
- **Furniture needs legs and contact shadows.** Desks without legs floated; every standing thing gets an ellipse of
  shadow where it meets the floor.
- **Mid-ground characters must sit inside the crop** of every shot that uses the set, not just the wide.
- **LightVeil strength:** about 0.28 in a wide that must show the floor, 0.42 to 0.5 elsewhere. At 0.52 the first
  wide went so dark the floor vanished.
- **The raised hand is the near one.** With `yaw < 0` the far arm hides behind the hood: raise `armL`.
- **Over-the-shoulder needs a big foreground figure,** about a third of the frame, dark and blurred (`blur16`). A
  small one reads as a mistake.
- **Characters must stay ours.** Mo's first hat (a teal beanie with a yellow pom-pom) drifted toward a famous
  cartoon's; it became curly hair and headphones. Check every new look's silhouette on the cast sheet.
- **Props near a hand get read as the hand.** In copy-paste's top-down desk shot a ruler sat where the arm came in
  and read as a thin beige arm. Keep a clear space round hands, and scale an arm that enters an insert up hard (a
  sleeve 100 to 130 wide, the mitten at 4.5 to 5).
- **Hands come from where the character is.** In an insert, the arm enters from the side of frame where that
  character stands in the neighbouring shots (the far side of the desk is the top of a top-down frame).
- **A big room's light holes must be small.** A LightVeil hole the size of the back wall lights it evenly and the
  room goes flat and grey; keep each hole about the size of its pool of light (the kitchen window: 430, not 720).
- **Nothing bright competes with the face.** A light-grey fridge was as bright as Pip's head; props sit a step
  darker than the character.
- **A blackout needs lights to switch off.** The rooftop's city has few lit windows by default; raise `cityLit`
  (about 2.5) or the sweep is invisible.
- **Long titles:** line 2 over about 20 characters needs `size` 88 to 100 to keep margins (more if you set a
  wider title face than the default).
- **Things that count must match the night.** A calendar's crosses, a clock, a pile that grows: the first demo of
  "skip sleep" showed nine crossed days on night one. Set the count per shot (`crossed={0}`).
- **Front-on sitting doesn't read.** Legs swing in the facing direction, so a seated figure facing camera looks like
  it's standing in front of the furniture. Seat characters in profile: thighs forward (`a` about 80), shins back
  down (`b` about -80), hips on the edge.
- **Focus rings scale with the camera.** At zoom 2 they fill the frame; wrap them in a `scale(0.4)` about the head.
- **Unique ids.** A set that draws gradients, masks or clip paths takes an `id` prop; give each shot its own (`sh4`),
  and a different one again if the same set renders twice in one frame (a blurred copy behind a close-up).
- **A hand can't touch the head.** The head is drawn after the arms, so a mitten raised to a temple or a mouth
  disappears behind it, and an arm raised beside the head reads as a wave. In a close-up, leave the rig's arms down
  and draw the arm yourself after the character: a sleeve path from off frame and a mitten at the prop, as the inserts
  in `episodes/copy-paste/shots.tsx` do (that's how the preview run fed Mo a slice and put a phone to Pip's ear). In a
  medium, act it with the head and a jolt instead.
- **A grade on a whole shot needs a screen-sized filter box.** Filter the outer group with `filterUnits="userSpaceOnUse"`
  and a 0..1920 x 0..1080 region: the default box is the content's, and sets draw far past the frame.
- **A colour grade lifts black.** The preview look's matrix turned a black screen navy; draw true black outside the
  graded group.

## Motion

- **Everything derives from the shot's clock `t`.** No `Math.random`, no state, no global frame inside a shot: a
  reversed or held segment must draw the same frame for the same `t`. Scatter with `rnd(seed, i)`.
- **Faces swap, they don't morph.** Use `faceAt` keys; `poseAt` holds the earlier face until its key lands.
- **A walk on stairs uses `hipGround`,** not `stepTop`, or the hips jump step by step.
- **Lands and catches** need the prop to follow the hand exactly: compute the hand with `toWorld(pose,
  joints(pose).armR.end)` and attach the prop there (the proof clip's catch).

## Sound

- **A pop on a word covers the word.** Land illustrative hits in the pause after their word (see `sound.md`).
- **Beds bury facts.** A rising hum under the science line masked it; beds under key lines stay low (0.1 to 0.15).
- **A hit's tail runs into the next word.** A 0.6 s beep after "Midnight" still sounded under "Skip": give short
  hits an `until` cue at the next shot. Time the picture's action into the pause too (the skip episode snaps awake
  about 10 frames into each skip shot, after the word).
- **Levelling is per stem.** `sfx.py` levels the whole effects stem, so lowering one event raises the rest.
- **mixcheck's windows are 0.4 s,** longer than most pauses, so a hit placed correctly in the 0.3 s after a word
  still gets flagged with it. When a flag sits on a word's last syllable, check that word in 0.1 s windows before
  moving anything: a fricative tail ("face", "catch") under a bed or a hit that follows it is not a covered word.

## Pipeline

- **Storyboard first.** A still renders in about two seconds, a full 23 s episode in about two and a half minutes.
  Iterate on stills.
- **Never cut to an empty frame.** Whatever a shot builds, something is already on at its first frame (start a pop at
  `t + 3`, not `t - 1`).
- **plan.py lists only audio that exists:** a missing `staticFile` fails the render.
- **Cue words can't contain a hyphen or a plus:** cue the next word, or use `s:` / `f:`.
- **Google Fonts need a connection** at render time. Set a local title face in `studio.config.ts` to work offline.
- **Windows:** `master.py` calls `npx.cmd`; Remotion downloads its own headless Chrome on the first render (about
  110 MB, once).
- **ElevenLabs costs:** the voice's exact cost is in the history; sound clips only move the account counter, which
  can lag. Re-read it before reporting.
- **Remotion Studio can't drag these shots around:** they're computed from the timeline, so retime in
  `episode.json` and re-run `plan.py`.
```

## File: .gitignore
size: 66
sha: 4b74df89afee9ce19ee63a9f207a040eb513e13c
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/.gitignore

```text
node_modules/
out/
__pycache__/
*.pyc
.env
.env.*
what-if-studio/
```

## File: LICENSE
size: 1067
sha: adcb8194c62cfff9057826f81ea13986dfebb644
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/LICENSE

```text
MIT License

Copyright (c) 2026 FreshStack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## File: opencode/commands/what-if.md
size: 137
sha: 74fa76bf5127a9fc6b140cfd9b785132ad9cad8d
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/opencode/commands/what-if.md

```text
---
description: Make a What If episode with the what-if-animation skill
---
Load the what-if-animation skill and follow it.

$ARGUMENTS
```

## File: studio/.gitignore
size: 19
sha: 72aae85fa8002e8d5aeadb101d00788c9e753cb8
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/.gitignore

```text
node_modules/
out/
```

## File: studio/library/sfx/big_step-3a4b1795.mp3
size: 12163
sha: eea11e010bc327464fea9a132a8e9284df945163
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/big_step-3a4b1795.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/big_step-3a4b1795.mp3

## File: studio/library/sfx/bulb_pop-2ea0e2d7.mp3
size: 8820
sha: e561339bfedfdf27a8cc8eec693810740fb24ae6
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/bulb_pop-2ea0e2d7.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/bulb_pop-2ea0e2d7.mp3

## File: studio/library/sfx/buzzer-0dc58156.mp3
size: 13835
sha: 6d451d0a08aa248ddd95a680c191c99e7272208c
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/buzzer-0dc58156.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/buzzer-0dc58156.mp3

## File: studio/library/sfx/cat_chirp-bb7d4731.mp3
size: 10492
sha: 37084574c3f438d55f2434bfe44715f8889b73c4
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cat_chirp-bb7d4731.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cat_chirp-bb7d4731.mp3

## File: studio/library/sfx/cat_yowl-7cf1658d.mp3
size: 15089
sha: b76cfc9a5b81b5fe57212f22d1651685ef59a7af
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cat_yowl-7cf1658d.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cat_yowl-7cf1658d.mp3

## File: studio/library/sfx/catch-ffb439cd.mp3
size: 8820
sha: 2e0a36f0d66c14dc3aaf2ed555306a3601a4f201
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/catch-ffb439cd.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/catch-ffb439cd.mp3

## File: studio/library/sfx/class_murmur-9d579e51.mp3
size: 33061
sha: 2a75f4bfe303d963a06894fe1ce1c7d6899d1fd1
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/class_murmur-9d579e51.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/class_murmur-9d579e51.mp3

## File: studio/library/sfx/clink-169430e3.mp3
size: 12163
sha: e8666aa37c5694a72564397630b7058ad0dc7eb3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/clink-169430e3.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/clink-169430e3.mp3

## File: studio/library/sfx/clock_back-d5e3cec1.mp3
size: 26792
sha: c05625d7ae18138b3f2be15f5c23fe7ea5a9e995
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/clock_back-d5e3cec1.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/clock_back-d5e3cec1.mp3

## File: studio/library/sfx/cookie_crunch-265c6a17.mp3
size: 10492
sha: 3a3f6d3fed5375e226e2fde8e47950d2f95df4e3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cookie_crunch-265c6a17.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/cookie_crunch-265c6a17.mp3

## File: studio/library/sfx/copy_click-6f20900a.mp3
size: 8820
sha: 53913193f7d5d7c1bea9f509f41a6701977390f2
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/copy_click-6f20900a.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/copy_click-6f20900a.mp3

## File: studio/library/sfx/counter_tick-37ca9370.mp3
size: 26792
sha: 20fe29ea643add5de1f2c9c6ebe3f984a847668b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/counter_tick-37ca9370.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/counter_tick-37ca9370.mp3

## File: studio/library/sfx/crack-3cbd3c57.mp3
size: 18433
sha: 3249ddbc7883b539f87117df9b5e52bcf3f62c8b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/crack-3cbd3c57.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/crack-3cbd3c57.mp3

## File: studio/library/sfx/ding-a322cf81.mp3
size: 13835
sha: 890d252d9b9965dc84c48df001796d01013fd45b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/ding-a322cf81.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/ding-a322cf81.mp3

## File: studio/library/sfx/dizzy-46ba6f40.mp3
size: 23030
sha: 25c8c258535419167fc60551bd82dc211fb65f23
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/dizzy-46ba6f40.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/dizzy-46ba6f40.mp3

## File: studio/library/sfx/drone_hit-75f05067.mp3
size: 41838
sha: 292aa920d4660b2d1b2aa12a948db5f707aa669b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/drone_hit-75f05067.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/drone_hit-75f05067.mp3

## File: studio/library/sfx/fall_whoosh-07978690.mp3
size: 10492
sha: c33bb520a7b2d6a2d3e43989d0405fa2b124d117
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/fall_whoosh-07978690.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/fall_whoosh-07978690.mp3

## File: studio/library/sfx/gasp-372b408b.mp3
size: 13835
sha: a5ff0cd641797737619047972b042e4e8a9f5307
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/gasp-372b408b.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/gasp-372b408b.mp3

## File: studio/library/sfx/glitch-4bc7163d.mp3
size: 24702
sha: 29093fb988722c42cf8db1828487c72b07bc607b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/glitch-4bc7163d.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/glitch-4bc7163d.mp3

## File: studio/library/sfx/gulp-c9154a14.mp3
size: 8820
sha: 14afff437d737e5176cd5d35f4fc5351462735da
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/gulp-c9154a14.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/gulp-c9154a14.mp3

## File: studio/library/sfx/land-c5089052.mp3
size: 10492
sha: d95f7a669db6467f0f7b725e7387de28146a81a3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/land-c5089052.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/land-c5089052.mp3

## File: studio/library/sfx/laugh-7d80a59f.mp3
size: 26792
sha: dac28d6864c3cf250c028897a3a79c9bf21762db
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/laugh-7d80a59f.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/laugh-7d80a59f.mp3

## File: studio/library/sfx/music-4cdabe20.mp3
size: 272970
sha: 4e016902b02238562b0d36e0cef7fc8f324f55b3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/music-4cdabe20.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/music-4cdabe20.mp3

## File: studio/library/sfx/paper_land-e0d75d32.mp3
size: 12163
sha: 36c5b02bf44918e6ddcdba8980ef41c19e901b99
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/paper_land-e0d75d32.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/paper_land-e0d75d32.mp3

## File: studio/library/sfx/paste_pop-0efc15e9.mp3
size: 12163
sha: 3ed1a2d6a88d69cbf2dee9275a36d24db7e7655f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/paste_pop-0efc15e9.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/paste_pop-0efc15e9.mp3

## File: studio/library/sfx/pop-99ba70e6.mp3
size: 8820
sha: e09af41841e55592626936c76115938e5fba678a
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/pop-99ba70e6.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/pop-99ba70e6.mp3

## File: studio/library/sfx/power_down-46ef6bed.mp3
size: 40585
sha: 7d17b4e73e1d7745c299e90d307ef491ad70c4d3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/power_down-46ef6bed.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/power_down-46ef6bed.mp3

## File: studio/library/sfx/power_hum-ae629acb.mp3
size: 48944
sha: 8bdd1601b0abce6fcd48b7bc0c2ba49ce097e8d6
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/power_hum-ae629acb.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/power_hum-ae629acb.mp3

## File: studio/library/sfx/rewind-d66d6ba6.mp3
size: 26792
sha: 0d015c733f6dca941da50a64a921699adf29395c
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/rewind-d66d6ba6.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/rewind-d66d6ba6.mp3

## File: studio/library/sfx/rewind_start-bbf777d9.mp3
size: 12163
sha: 8e6ec44fc749660f2c5d16fd1a19babe8f1462b6
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/rewind_start-bbf777d9.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/rewind_start-bbf777d9.mp3

## File: studio/library/sfx/roof_wind-cedc7edc.mp3
size: 112892
sha: 2fe0294e9f9f150f0f7a8db336fe5585ea6b49f3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/roof_wind-cedc7edc.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/roof_wind-cedc7edc.mp3

## File: studio/library/sfx/room_tone-e711a45f.mp3
size: 200663
sha: 0b227a45ad2cdeb41d36982b22d2777f19683f03
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/room_tone-e711a45f.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/room_tone-e711a45f.mp3

## File: studio/library/sfx/select_draw-234903d8.mp3
size: 10492
sha: b549081a918f714668eaedfaecc848697b59b9c1
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/select_draw-234903d8.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/select_draw-234903d8.mp3

## File: studio/library/sfx/shades-cdedb72d.mp3
size: 15089
sha: 7542984c52da56f731ca7780861b2ddf771d3468
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/shades-cdedb72d.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/shades-cdedb72d.mp3

## File: studio/library/sfx/shatter-cde6184c.mp3
size: 21358
sha: fb0e50de819cc281e5ddb5e8845542554e872b1e
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/shatter-cde6184c.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/shatter-cde6184c.mp3

## File: studio/library/sfx/sparkle-595dbfb7.mp3
size: 13835
sha: c14bb3edb7ebe71762dafe1f3d3cf9023fa9b0a3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/sparkle-595dbfb7.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/sparkle-595dbfb7.mp3

## File: studio/library/sfx/step-60144e17.mp3
size: 8820
sha: 02d7599f3600ade60bc6606e39ee3a9a6223975b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/step-60144e17.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/step-60144e17.mp3

## File: studio/library/sfx/switch_off-9588c15a.mp3
size: 8820
sha: 3713832683ad7490289a8ed9d46e3a34818bf115
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/switch_off-9588c15a.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/switch_off-9588c15a.mp3

## File: studio/library/sfx/title_boom-91f4f23e.mp3
size: 26792
sha: fb7cf94f9f6746c5629e3afe83bcbaf010f68d4e
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/title_boom-91f4f23e.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/title_boom-91f4f23e.mp3

## File: studio/library/sfx/tumble-d03ef997.mp3
size: 21358
sha: c446215626cdafddda8cfb12ff25ce68ff07c15f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/tumble-d03ef997.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/library/sfx/tumble-d03ef997.mp3

## File: studio/package-lock.json
size: 145816
sha: c9c63b0153495ec42cf9006e2fe59a0e45a6d8d2
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/package-lock.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/package-lock.json

## File: studio/package.json
size: 689
sha: c7d674488f3b13281c14a3f416218784f9fefb92
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/package.json

```text
{
  "name": "what-if-studio",
  "version": "1.0.0",
  "private": true,
  "description": "What If animation studio: one topic line in, a finished 15-25 s episode out. Every frame is SVG drawn in code (Remotion).",
  "scripts": {
    "studio": "remotion studio src/index.ts --port 3430",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@remotion/bundler": "4.0.530",
    "@remotion/cli": "4.0.530",
    "@remotion/fonts": "4.0.530",
    "@remotion/google-fonts": "4.0.530",
    "@remotion/renderer": "4.0.530",
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "remotion": "4.0.530"
  },
  "devDependencies": {
    "@types/react": "19.0.0",
    "typescript": "5.8.2"
  }
}
```

## File: studio/public/copy-paste/music.mp3
size: 377043
sha: b32d84ed7b4c3897f92e91e617b4fceecddc9c7f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/music.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/music.mp3

## File: studio/public/copy-paste/sfx.mp3
size: 377043
sha: f01c1c6df292dd9bd24c38afd91de54465c0d106
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/sfx.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/sfx.mp3

## File: studio/public/copy-paste/voice.mp3
size: 359906
sha: bc22cc2d1abf9dabf1ad8d0fd9d19370d2abb775
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/voice.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/copy-paste/voice.mp3

## File: studio/public/rewind/music.mp3
size: 305990
sha: b0545432b36eb414cc73239d4ec2311cbca79efc
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/music.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/music.mp3

## File: studio/public/rewind/sfx.mp3
size: 305990
sha: fe4e1e103ade395326e9d270aafe3e15ad6f7e9e
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/sfx.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/sfx.mp3

## File: studio/public/rewind/voice.mp3
size: 286764
sha: 09b928c094790c7270e26c7b152891571d1ddd26
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/voice.mp3

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/public/rewind/voice.mp3

## File: studio/remotion.config.ts
size: 154
sha: 75e113224893b4bb4be6412192709bf4869bfe01
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/remotion.config.ts

```text
import { Config } from '@remotion/cli/config';

Config.setVideoImageFormat('png');
Config.setOverwriteOutput(true);
Config.setEntryPoint('src/index.ts');
```

## File: studio/src/CastSheet.tsx
size: 2746
sha: a622579a17289cd14edc696233c2f4d559d0f1f6
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/CastSheet.tsx

```text
import React from 'react';
import { AbsoluteFill } from 'remotion';
import { Hero, basePose, Pose, LOOKS, CastName, KitDefs, SetDefs, Study, FONT } from './engine';

// The cast sheet: every costume on the one rig, front and three-quarter, over a soft set so contrast is judged in
// place, plus a row of acting poses. Render it after adding or changing a look:
//   npx remotion still src/index.ts Cast out/cast.png

const Label: React.FC<{ x: number; y: number; text: string }> = ({ x, y, text }) => (
  <text x={x} y={y} textAnchor="middle" fontFamily={FONT.ui} fontSize={24} fill="#F6EFE3" letterSpacing={2}>
    {text}
  </text>
);
const P = (o: Partial<Pose>): Pose => ({ ...basePose, ...o });
const NAMES: Record<CastName, string> = { pip: 'PIP A', pipHood: 'PIP B (HERO)', pipInk: 'PIP C', mo: 'MO, FRIEND', sis: 'SISTER', mom: 'MUM', suit: 'THE SUIT' };

export const CastSheet: React.FC = () => {
  const cast = Object.keys(LOOKS) as CastName[];
  const row1 = 430;
  const row2 = 900;
  const poses: { name: string; p: Partial<Pose> }[] = [
    { name: 'thinking', p: { armR: { a: 120, b: 110 }, armL: { a: -10, b: -70 }, headTilt: 8, expr: 'worried', yaw: 0.2 } },
    { name: 'shrug', p: { armL: { a: 40, b: 80 }, armR: { a: 40, b: 80 }, headTilt: -10, expr: 'oops' } },
    { name: 'point', p: { armR: { a: 95, b: -5 }, armL: { a: 10, b: -8 }, look: 1, yaw: 0.35, expr: 'smug', handR: 'point' } },
    { name: 'cheer', p: { armL: { a: 135, b: 20 }, armR: { a: 135, b: 20 }, expr: 'happy', squash: -0.05 } },
    { name: 'shock', p: { armL: { a: 60, b: 40 }, armR: { a: 60, b: 40 }, expr: 'shock', yaw: -0.3, look: -0.6 } },
  ];
  return (
    <AbsoluteFill style={{ backgroundColor: '#14101C' }}>
      <svg width={1920} height={1080} viewBox="0 0 1920 1080">
        <KitDefs />
        <SetDefs />
        <g filter="url(#blur10)">
          <Study t={0} id="cast" />
        </g>
        <rect width={1920} height={1080} fill="#0B0816" opacity={0.35} />
        {cast.map((c, i) => {
          const x = 150 + i * 270;
          const small = c === 'sis' ? 0.68 : 0.82;
          return (
            <g key={c}>
              <Hero look={LOOKS[c]} pose={P({ x, y: row1 + (0.82 - small) * 340, scale: small, yaw: i % 2 ? -0.35 : 0.35, look: i % 2 ? -0.5 : 0.5, expr: 'happy' })} shadow={0.6} />
              <Label x={x} y={row1 + 170} text={NAMES[c]} />
            </g>
          );
        })}
        {poses.map((q, i) => (
          <g key={q.name}>
            <Hero look={LOOKS.pipHood} pose={P({ x: 220 + i * 370, y: row2 - 40, scale: 0.72, ...q.p })} shadow={0.6} />
            <Label x={220 + i * 370} y={row2 + 110} text={q.name.toUpperCase()} />
          </g>
        ))}
      </svg>
    </AbsoluteFill>
  );
};
```

## File: studio/src/engine/anim.ts
size: 2183
sha: 20011128c8b949545b5da0becbe45fa85807ba1c
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/anim.ts

```text
// Tiny animation helpers shared by the whole engine. Every shot is a pure function of its own clock t
// (frames), so nothing here keeps state: the same t always draws the same frame, which is what lets the
// engine play any shot backwards.

export const clamp = (v: number, a = 0, b = 1) => Math.min(b, Math.max(a, v));
export const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
export const easeInOut = (t: number) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);
export const easeOut = (t: number) => 1 - Math.pow(1 - t, 3);
export const easeIn = (t: number) => t * t * t;
export const backOut = (t: number) => {
  const c1 = 1.70158;
  const c3 = c1 + 1;
  return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
};
/** Piecewise value from [frame, value] keys with an ease between neighbours. */
export const kf = (f: number, keys: [number, number][], ease = easeInOut) => {
  if (f <= keys[0][0]) return keys[0][1];
  for (let i = 0; i < keys.length - 1; i++) {
    const [f0, v0] = keys[i];
    const [f1, v1] = keys[i + 1];
    if (f <= f1) return lerp(v0, v1, ease((f - f0) / Math.max(1e-6, f1 - f0)));
  }
  return keys[keys.length - 1][1];
};
/** A repeatable pseudo-random number in 0..1 for (seed, i): sets scatter books, stars and dust with it. */
export const rnd = (seed: number, i: number) => Math.abs(Math.sin(seed * 31.7 + i * 12.9898) * 43758.5453) % 1;
/** A wobble that dies away: for things that land, get hit or get knocked. */
export const settle = (t: number, amp: number, speed = 1.4, decay = 8) => (t > 0 ? Math.sin(t * speed) * amp * Math.exp(-t / decay) : 0);

/** The camera: centre the world point (cx, cy) on screen at zoom s (1920 x 1080 frame). */
export const camT = (cx: number, cy: number, s: number) => `translate(960 540) scale(${s}) translate(${-cx} ${-cy})`;
/** A short, decaying camera shake for a hit inside a shot (the engine has its own for cue-driven shakes). */
export const shake = (t: number, from: number, len = 8, amp = 10) =>
  t >= from && t < from + len ? { x: Math.sin(t * 2.9) * amp * (1 - (t - from) / len), y: Math.cos(t * 3.7) * amp * 0.7 * (1 - (t - from) / len) } : { x: 0, y: 0 };
```

## File: studio/src/engine/episode.tsx
size: 7874
sha: 4069e141ab30a349c7381cbd5f3adc752636da1c
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/episode.tsx

```text
import React from 'react';
import { AbsoluteFill, Audio, staticFile, useCurrentFrame } from 'remotion';
import { clamp, lerp } from './anim';
import { KitDefs } from './kit';
import { SetDefs } from './light';

// The episode engine. An episode is a set of shots plus a timeline (written by scripts/plan.py from the voice's word
// timings). Each shot is a pure function of its own clock t, so the edit can cut back to a shot, hold it, or play it
// backwards: a segment just says which stretch of the shot's clock it shows.

export type Seg = {
  shot: string; // shot id (S1, S2...)
  a: number; // first global frame
  b: number; // first frame after it
  t0: number; // the shot's clock at a
  t1: number; // the shot's clock at b (smaller than t0 when the segment plays backwards)
  look?: string; // a named power look (rewind, freeze...) the episode defines: grade + overlay while it runs
  line?: string; // the words spoken over it (for the storyboard)
};
export type ShotInfo = { id: string; size: string; key: number; len: number; first: number; line?: string; note?: string };
export type Fx = { f: number; kind: 'flash' | 'shake'; color?: string; o?: number; len?: number; amp?: number };
export type Timeline = {
  slug: string;
  title: string;
  fps: number;
  total: number;
  segments: Seg[];
  shots: ShotInfo[];
  fx: Fx[];
  audio: { voice?: string; sfx?: string; music?: string; voiceVol?: number; sfxVol?: number; musicVol?: number };
};

/** What every shot receives: its own clock t, how long its clock runs (len), and the global frame f. */
export type ShotProps = { t: number; len: number; f: number };
export type ShotMap = Record<string, React.FC<ShotProps>>;

/** A power look: a CSS grade on the picture and an overlay on top while segments with this look run. */
export type LookDef = {
  grade?: (lv: number) => string;
  jitter?: number; // sideways picture jitter in px at full strength
  Overlay?: React.FC<{ f: number; lv: number; p: number; n: number }>; // p: progress through this run, n: which run (0, 1, 2...)
};

const segAt = (tl: Timeline, f: number) => tl.segments.find((s) => f >= s.a && f < s.b) ?? tl.segments[tl.segments.length - 1];
const clockAt = (s: Seg, f: number) => (s.t1 - s.t0 === s.b - s.a ? s.t0 + (f - s.a) : lerp(s.t0, s.t1, (f - s.a) / (s.b - s.a)));

/** Runs of neighbouring segments sharing a look, so a look spanning two shots doesn't blink at the cut. */
const lookRuns = (tl: Timeline) => {
  const runs: { look: string; a: number; b: number; n: number }[] = [];
  const count: Record<string, number> = {};
  for (const s of tl.segments) {
    if (!s.look) continue;
    const last = runs[runs.length - 1];
    if (last && last.look === s.look && last.b === s.a) last.b = s.b;
    else {
      runs.push({ look: s.look, a: s.a, b: s.b, n: count[s.look] ?? 0 });
      count[s.look] = (count[s.look] ?? 0) + 1;
    }
  }
  return runs;
};

const fxAt = (tl: Timeline, f: number) => {
  let flash: { color: string; o: number } | null = null;
  let x = 0;
  let y = 0;
  for (const e of tl.fx) {
    if (e.kind === 'flash') {
      if (f === e.f) flash = { color: e.color ?? '#FFFFFF', o: e.o ?? 0.85 };
      else if (f === e.f + 1) flash = { color: e.color ?? '#FFFFFF', o: (e.o ?? 0.85) * 0.35 };
    } else if (e.kind === 'shake') {
      const len = e.len ?? 8;
      const amp = e.amp ?? 12;
      if (f >= e.f && f < e.f + len) {
        const k = amp * (1 - (f - e.f) / len);
        x += Math.sin(f * 2.9) * k;
        y += Math.cos(f * 3.7) * k * 0.7;
      }
    }
  }
  return { flash, x, y };
};

/** Vignette and a fine grain that changes on twos, to take the vector edge off (the genre's finish). */
const Grade: React.FC<{ f: number; grain: boolean; vignette: boolean }> = ({ f, grain, vignette }) => (
  <svg width={1920} height={1080} viewBox="0 0 1920 1080" style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>
    <defs>
      <radialGradient id="epVig" cx="50%" cy="50%" r="75%">
        <stop offset="55%" stopColor="#000" stopOpacity={0} />
        <stop offset="100%" stopColor="#000" stopOpacity={0.55} />
      </radialGradient>
      <filter id="epGrain" x="0" y="0" width="100%" height="100%">
        <feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves={2} seed={Math.floor(f / 2) % 97} />
        <feColorMatrix type="matrix" values="0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.06 0" />
      </filter>
    </defs>
    {vignette ? <rect width="1920" height="1080" fill="url(#epVig)" /> : null}
    {grain ? <rect width="1920" height="1080" filter="url(#epGrain)" /> : null}
  </svg>
);

/** One shot drawn in the shared defs (filters, gradients), in a 1920 x 1080 world. */
export const ShotFrame: React.FC<{ children: React.ReactNode }> = ({ children }) => (
  <svg width={1920} height={1080} viewBox="0 0 1920 1080">
    <KitDefs />
    <SetDefs />
    {children}
  </svg>
);

export type EpisodeProps = { timeline: Timeline; shots: ShotMap; looks?: Record<string, LookDef>; grain?: boolean; vignette?: boolean; bg?: string };

export const Episode: React.FC<EpisodeProps> = ({ timeline: tl, shots, looks = {}, grain = true, vignette = true, bg = '#0E0C1E' }) => {
  const f = useCurrentFrame();
  const seg = segAt(tl, f);
  const Shot = shots[seg.shot];
  const info = tl.shots.find((s) => s.id === seg.shot);
  const run = lookRuns(tl).find((r) => f >= r.a && f < r.b);
  const def = run ? looks[run.look] : undefined;
  const lv = run ? Math.min(clamp((f - run.a + 1) / 2), clamp((run.b - f) / 2)) : 0;
  const jitter = def?.jitter && lv > 0 ? Math.sin(f * 13.7) * def.jitter * lv : 0;
  const { flash, x, y } = fxAt(tl, f);
  const A = tl.audio;
  return (
    <AbsoluteFill style={{ backgroundColor: bg }}>
      <AbsoluteFill style={{ transform: `translate(${x + jitter}px, ${y}px) scale(${x || y ? 1.02 : 1})`, filter: def?.grade && lv > 0 ? def.grade(lv) : undefined }}>
        <ShotFrame>{Shot ? <Shot t={clockAt(seg, f)} len={info?.len ?? seg.b - seg.a} f={f} /> : null}</ShotFrame>
      </AbsoluteFill>
      <Grade f={f} grain={grain} vignette={vignette} />
      {def?.Overlay && run ? (
        <svg width={1920} height={1080} viewBox="0 0 1920 1080" style={{ position: 'absolute', inset: 0, opacity: lv }}>
          <def.Overlay f={f} lv={lv} p={clamp((f - run.a) / (run.b - run.a))} n={run.n} />
        </svg>
      ) : null}
      {flash ? <AbsoluteFill style={{ backgroundColor: flash.color, opacity: flash.o }} /> : null}
      {A.voice ? <Audio src={staticFile(A.voice)} volume={A.voiceVol ?? 1} /> : null}
      {A.sfx ? <Audio src={staticFile(A.sfx)} volume={A.sfxVol ?? 1} /> : null}
      {A.music ? <Audio src={staticFile(A.music)} volume={A.musicVol ?? 1} /> : null}
    </AbsoluteFill>
  );
};

/** The storyboard: frame i is shot i at its key frame, no audio, no look. Render it with scripts/stills.mjs. */
export const Board: React.FC<{ timeline: Timeline; shots: ShotMap; grain?: boolean; vignette?: boolean; bg?: string }> = ({ timeline: tl, shots, grain = true, vignette = true, bg = '#0E0C1E' }) => {
  const f = useCurrentFrame();
  const info = tl.shots[Math.min(f, tl.shots.length - 1)];
  const Shot = shots[info.id];
  return (
    <AbsoluteFill style={{ backgroundColor: bg }}>
      <ShotFrame>{Shot ? <Shot t={info.key} len={info.len} f={info.first + info.key} /> : null}</ShotFrame>
      <Grade f={info.key} grain={grain} vignette={vignette} />
    </AbsoluteFill>
  );
};

/** Bundle an episode for the registry: the main composition and its storyboard. */
export const defineEpisode = (id: string, p: EpisodeProps) => ({
  id,
  total: p.timeline.total,
  shotCount: p.timeline.shots.length,
  Main: () => <Episode {...p} />,
  Board: () => <Board timeline={p.timeline} shots={p.shots} grain={p.grain} vignette={p.vignette} bg={p.bg} />,
});
export type EpisodeDef = ReturnType<typeof defineEpisode>;
```

## File: studio/src/engine/fonts.ts
size: 1161
sha: 75325f10aef5e5dc7c4631c19c4cbfe630eb8c56
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/fonts.ts

```text
import { loadFont } from '@remotion/fonts';
import { staticFile } from 'remotion';
import { loadFont as loadBricolage } from '@remotion/google-fonts/BricolageGrotesque';
import { loadFont as loadMono } from '@remotion/google-fonts/FragmentMono';
import { loadFont as loadHand } from '@remotion/google-fonts/Kalam';
import { STUDIO } from '../studio.config';

// Three faces: a heavy display face for the title card, a mono for on-screen readouts (timers, labels, chips),
// and a handwriting face for chalk and notes. The Google faces load at render time (they need a connection);
// a local title face from studio.config.ts loads from public/ and works offline.

loadBricolage('normal', { weights: ['600', '700', '800'], subsets: ['latin'] });
loadMono('normal', { weights: ['400'], subsets: ['latin'] });
loadHand('normal', { weights: ['400', '700'], subsets: ['latin'] });
if (STUDIO.titleFont) loadFont({ family: STUDIO.titleFont.family, url: staticFile(STUDIO.titleFont.file), weight: STUDIO.titleFont.weight });

export const FONT = {
  title: STUDIO.titleFont ? STUDIO.titleFont.family : 'Bricolage Grotesque',
  ui: 'Fragment Mono',
  hand: 'Kalam',
};
```

## File: studio/src/engine/furnish.tsx
size: 15473
sha: aa5eda4a7a1fd1429c6c1be7cb52696f1fb06149
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/furnish.tsx

```text
import React from 'react';
import { rnd } from './anim';
import { LEG_LEN } from './rig';
import { Room, S3, Pt } from './room';
import { WallTexture, RoomCorners, SkyView, Glow, Cone } from './light';

// The room kit: build a new interior in a few lines. makeRoom gives the perspective, RoomShell draws the room,
// BackWindow, Pendant, WallLight, FloorPlant and WallFrame furnish it, Box adds furniture, and stand() puts a
// character on the floor at the right size for its depth. Then finish the set with a LightVeil (holes at each light),
// the glows again on top, and Dust in the beams, as the study does.

const BODY_H = 378; // the rig's height at scale 1, from the top of the head to the soles

/** Where a character stands on the floor at (u, w): hip position and scale, so their height is k of the room's. */
export const stand = (r: Room, u: number, w: number, k = 0.62) => {
  const p = r.P(u, 1, w);
  const scale = (k * (r.back.y1 - r.back.y0) * r.s(w)) / BODY_H;
  return { x: p.x, y: p.y - LEG_LEN * scale, scale };
};

/** The room's walls, floor and ceiling. Floors: 'boards' (run toward the back wall) or 'tiles' (a grid). */
export const RoomShell: React.FC<{ r: Room; id: string; floor?: 'boards' | 'tiles'; wall?: string; side?: string; floorC?: string; ceiling?: string; lines?: string }> = ({
  r, id, floor = 'boards', wall = S3.wall, side = S3.wallSide, floorC = S3.floor, ceiling = S3.ceiling, lines = '#22181D',
}) => {
  const { P, Q, back: B } = r;
  const fl: React.ReactNode[] = [];
  if (floor === 'boards') {
    for (let i = 1; i < 14; i++) {
      const a = P(i / 14, 1, 0);
      const b = P(i / 14, 1, 1);
      fl.push(<path key={`fb${i}`} d={`M ${a.x} ${a.y} L ${b.x} ${b.y}`} stroke={lines} strokeWidth={2.5} />);
      for (let k = 0; k < 3; k++) {
        const w = 0.12 + rnd(i, k) * 0.8;
        const c = P(i / 14, 1, w);
        const d = P((i + 1) / 14, 1, w);
        fl.push(<path key={`fj${i}-${k}`} d={`M ${c.x} ${c.y} L ${d.x} ${d.y}`} stroke={lines} strokeWidth={1.6} />);
      }
    }
  } else {
    for (let i = 1; i < 12; i++) {
      const a = P(i / 12, 1, 0);
      const b = P(i / 12, 1, 1);
      fl.push(<path key={`ta${i}`} d={`M ${a.x} ${a.y} L ${b.x} ${b.y}`} stroke={lines} strokeWidth={2} />);
    }
    for (let j = 1; j < 14; j++) {
      const a = P(0, 1, j / 14);
      const b = P(1, 1, j / 14);
      fl.push(<path key={`tb${j}`} d={`M ${a.x} ${a.y} L ${b.x} ${b.y}`} stroke={lines} strokeWidth={2} />);
    }
  }
  return (
    <g>
      <defs>
        <linearGradient id={`${id}L`} gradientUnits="userSpaceOnUse" x1={B.x0} y1={0} x2={B.x0 - 730} y2={0}>
          <stop offset="0%" stopColor="#000" stopOpacity={0} />
          <stop offset="100%" stopColor="#000" stopOpacity={0.5} />
        </linearGradient>
        <linearGradient id={`${id}R`} gradientUnits="userSpaceOnUse" x1={B.x1} y1={0} x2={B.x1 + 730} y2={0}>
          <stop offset="0%" stopColor="#000" stopOpacity={0} />
          <stop offset="100%" stopColor="#000" stopOpacity={0.5} />
        </linearGradient>
        <linearGradient id={`${id}F`} gradientUnits="userSpaceOnUse" x1={0} y1={B.y1} x2={0} y2={B.y1 + 460}>
          <stop offset="0%" stopColor="#000" stopOpacity={0} />
          <stop offset="100%" stopColor="#000" stopOpacity={0.55} />
        </linearGradient>
      </defs>
      <rect x={-1500} y={-1500} width={5000} height={1500 + B.y0 + 60} fill={ceiling} />
      <polygon points={Q([[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1]])} fill={ceiling} />
      <polygon points={Q([[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0]])} fill={side} />
      <polygon points={Q([[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0]])} fill={`url(#${id}L)`} />
      <polygon points={Q([[1, 0, 0], [1, 0, 1], [1, 1, 1], [1, 1, 0]])} fill={side} />
      <polygon points={Q([[1, 0, 0], [1, 0, 1], [1, 1, 1], [1, 1, 0]])} fill={`url(#${id}R)`} />
      <polygon points={Q([[0, 1, 0], [1, 1, 0], [1, 1, 1], [0, 1, 1]])} fill={floorC} />
      {fl}
      <polygon points={Q([[0, 1, 0], [1, 1, 0], [1, 1, 1], [0, 1, 1]])} fill={`url(#${id}F)`} />
      <rect x={B.x0} y={B.y0} width={B.x1 - B.x0} height={B.y1 - B.y0} fill={wall} />
      <WallTexture rect={[B.x0, B.y0, B.x1 - B.x0, B.y1 - B.y0]} />
      <WallTexture points={Q([[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0]])} />
      <WallTexture points={Q([[1, 0, 0], [1, 0, 1], [1, 1, 1], [1, 1, 0]])} />
      <RoomCorners x0={B.x0} x1={B.x1} y0={B.y0} y1={B.y1} />
      <rect x={B.x0} y={B.y1 - 14} width={B.x1 - B.x0} height={14} fill={S3.trim} />
      <polygon points={Q([[0, 0.965, 0], [0, 0.965, 1], [0, 1, 1], [0, 1, 0]])} fill={S3.trim} />
      <polygon points={Q([[1, 0.965, 0], [1, 0.965, 1], [1, 1, 1], [1, 1, 0]])} fill={S3.trim} />
      <path d={`M ${B.x0} ${B.y0 + 2} L ${B.x1} ${B.y0 + 2}`} stroke="#2A2331" strokeWidth={5} />
    </g>
  );
};

/**
 * A window in the back wall onto the dusk (screen box x0..x1, y0..y1 on the back wall), with frame, mullions, sill,
 * the sun's bloom, optional curtains and its light falling on the floor. `sun` is where the sun sits in it.
 */
export const BackWindow: React.FC<{ r: Room; id: string; t: number; x0: number; x1: number; y0: number; y1: number; sun?: Pt; cols?: number; curtains?: boolean; red?: number; night?: boolean }> = ({
  r, id, t, x0, x1, y0, y1, sun, cols = 2, curtains = true, red = 0, night = false,
}) => {
  const B = r.back;
  const u0 = (x0 - B.x0) / (B.x1 - B.x0);
  const u1 = (x1 - B.x0) / (B.x1 - B.x0);
  const w = x1 - x0;
  const h = y1 - y0;
  const s = sun ?? { x: x0 + w * 0.7, y: y1 - 12 };
  return (
    <g>
      <SkyView id={`${id}win`} clip={`M ${x0} ${y0} L ${x1} ${y0} L ${x1} ${y1} L ${x0} ${y1} Z`} box={{ x: x0, y: y0, w, h }} t={t} sun={s} sunR={Math.min(40, w * 0.1) * (night ? 0.75 : 1)} red={red} night={night} />
      <g fill="#1E1824">
        <rect x={x0 - 12} y={y0 - 12} width={w + 24} height={14} />
        <rect x={x0 - 12} y={y1 - 2} width={w + 24} height={10} />
        <rect x={x0 - 12} y={y0 - 12} width={14} height={h + 20} />
        <rect x={x1 - 2} y={y0 - 12} width={14} height={h + 20} />
        {Array.from({ length: cols - 1 }).map((_, i) => (
          <rect key={i} x={x0 + (w * (i + 1)) / cols - 5} y={y0} width={10} height={h} />
        ))}
        <rect x={x0} y={y0 + h * 0.32} width={w} height={7} />
      </g>
      <polygon points={r.Q([[u0 - 0.02, (y1 + 4 - B.y0) / (B.y1 - B.y0), 0], [u1 + 0.02, (y1 + 4 - B.y0) / (B.y1 - B.y0), 0], [u1 + 0.02, (y1 + 4 - B.y0) / (B.y1 - B.y0), 0.03], [u0 - 0.02, (y1 + 4 - B.y0) / (B.y1 - B.y0), 0.03]])} fill="#6A5056" />
      <path d={`M ${x0 - 10} ${y1 + 8} L ${x1 + 10} ${y1 + 8}`} stroke={night ? '#A9C6FF' : S3.warm} strokeWidth={2} opacity={night ? 0.45 : 0.6} />
      <circle cx={s.x} cy={s.y} r={w * (night ? 0.9 : 1.3)} fill={night ? 'url(#kitMoonBloom)' : 'url(#kitBloom)'} opacity={(night ? 0.3 : 0.42) * (1 - red)} />
      {curtains
        ? [
            { x: x0 - 88, flip: 1 },
            { x: x1 - 6, flip: -1 },
          ].map((c, i) => (
            <g key={`cu${i}`}>
              <path d={`M ${c.x} ${y0 - 20} L ${c.x + 94} ${y0 - 20} L ${c.x + 94 - c.flip * 8} ${y1 + 110} Q ${c.x + 47} ${y1 + 118} ${c.x - c.flip * 6} ${y1 + 110} Z`} fill="#4E2F42" />
              {[0.22, 0.5, 0.78].map((k, j) => (
                <rect key={j} x={c.x + 94 * k - 6} y={y0 - 18} width={12} height={h + 126} fill={j % 2 ? '#40263A' : '#5E3A50'} opacity={0.8} />
              ))}
              <rect x={c.flip > 0 ? c.x + 90 : c.x} y={y0 - 18} width={4} height={h + 126} fill={night ? '#A9C6FF' : S3.warm} opacity={night ? 0.4 : 0.55} />
            </g>
          ))
        : null}
      {curtains ? <rect x={x0 - 100} y={y0 - 26} width={w + 200} height={8} rx={4} fill="#1A1420" /> : null}
      <polygon points={r.Q([[u0 + 0.02, 1, 0.02], [u1 - 0.02, 1, 0.02], [u1 + 0.08, 1, 0.55], [u0 - 0.08, 1, 0.55]])} fill={night ? '#9FC0FF' : '#FFB46A'} opacity={night ? 0.08 : 0.1} style={{ mixBlendMode: 'screen' }} />
    </g>
  );
};

/** A pendant lamp hanging from the ceiling over the floor point (u, w), swaying a touch, with its cone and glow. */
export const Pendant: React.FC<{ r: Room; u: number; w: number; v?: number; t: number; cone?: number; glow?: number }> = ({ r, u, w, v = 0.27, t, cone = 0.28, glow = 0.55 }) => {
  const top = r.P(u, 0, w);
  const sh = r.P(u, v, w);
  const k = r.s(w) / r.s(0.42);
  return (
    <g transform={`rotate(${Math.sin(t / 28) * 1.2} ${top.x} ${top.y})`}>
      <path d={`M ${top.x} ${top.y} L ${sh.x} ${sh.y - 30 * k}`} stroke="#120E16" strokeWidth={3} />
      <path d={`M ${sh.x - 16 * k} ${sh.y - 32 * k} L ${sh.x + 16 * k} ${sh.y - 32 * k} L ${sh.x + 44 * k} ${sh.y} L ${sh.x - 44 * k} ${sh.y} Z`} fill="#1C1620" />
      <ellipse cx={sh.x} cy={sh.y} rx={44 * k} ry={8 * k} fill="#FFE2B0" />
      <Cone d={`M ${sh.x - 40 * k} ${sh.y} L ${sh.x + 40 * k} ${sh.y} L ${sh.x + 240 * k} ${sh.y + 520 * k} L ${sh.x - 240 * k} ${sh.y + 520 * k} Z`} o={cone} />
      <Glow x={sh.x} y={sh.y + 6} r={220 * k} o={glow} />
    </g>
  );
};
/** Where a Pendant's light is, for the LightVeil and the glows on top: [x, y, radius]. */
export const pendantLight = (r: Room, u: number, w: number, v = 0.27): [number, number, number] => {
  const sh = r.P(u, v, w);
  return [sh.x, sh.y + 40, 460 * (r.s(w) / r.s(0.42))];
};

/** A wall light on a side wall (u 0 or 1) or the back wall (w 0), at height v. */
export const WallLight: React.FC<{ r: Room; u: number; v: number; w: number; o?: number }> = ({ r, u, v, w, o = 0.55 }) => {
  const p = r.P(u, v, w);
  const k = r.s(w) / r.s(0.66);
  return (
    <g>
      <rect x={p.x - 9 * k} y={p.y - 20 * k} width={18 * k} height={30 * k} rx={6 * k} fill="#2A2026" />
      <path d={`M ${p.x - 20 * k} ${p.y - 8 * k} L ${p.x + 20 * k} ${p.y - 8 * k} L ${p.x + 14 * k} ${p.y - 42 * k} L ${p.x - 14 * k} ${p.y - 42 * k} Z`} fill="#F2C08A" />
      <Glow x={p.x} y={p.y - 24 * k} r={230 * k} o={o} />
    </g>
  );
};

/** A potted plant on the floor at (u, w): a terracotta pot and five long leaves. */
export const FloorPlant: React.FC<{ r: Room; u: number; w: number; size?: number }> = ({ r, u, w, size = 1 }) => {
  const b = r.P(u, 1, w);
  const k = (r.s(w) / r.s(0.07)) * size;
  return (
    <g>
      <ellipse cx={b.x + 6 * k} cy={b.y + 2} rx={56 * k} ry={12 * k} fill="#000" opacity={0.35} />
      <path d={`M ${b.x - 40 * k} ${b.y - 74 * k} L ${b.x + 40 * k} ${b.y - 74 * k} L ${b.x + 30 * k} ${b.y} L ${b.x - 30 * k} ${b.y} Z`} fill="#8A5040" />
      <rect x={b.x - 44 * k} y={b.y - 84 * k} width={88 * k} height={14 * k} rx={4 * k} fill="#6A3C30" />
      {[[-60, -150], [-20, -190], [30, -170], [64, -120], [-80, -90]].map(([dx, dy], i) => {
        const o = { x: b.x, y: b.y - 80 * k };
        return <path key={i} d={`M ${o.x} ${o.y} Q ${o.x + dx * 0.3 * k} ${o.y + dy * 0.6 * k} ${o.x + dx * k} ${o.y + dy * k} Q ${o.x + dx * 0.7 * k} ${o.y + dy * 0.4 * k} ${o.x} ${o.y} Z`} fill={i % 2 ? '#3F5E44' : '#4E7350'} />;
      })}
    </g>
  );
};

/** A framed picture on the back wall: a dark frame, a mount, and a simple dusk landscape or an abstract. */
export const WallFrame: React.FC<{ x: number; y: number; w: number; h: number; art?: 0 | 1 | 2 }> = ({ x, y, w, h, art = 0 }) => (
  <g>
    <rect x={x} y={y} width={w} height={h} fill="#1E1824" />
    <rect x={x + 7} y={y + 7} width={w - 14} height={h - 14} fill="#E6D4B6" />
    {art === 0 ? (
      <g>
        <rect x={x + 14} y={y + 14} width={w - 28} height={h - 28} fill="#E4A27A" />
        <circle cx={x + w / 2} cy={y + h * 0.55} r={Math.min(w, h) * 0.12} fill="#FFE2B0" />
        <path d={`M ${x + 14} ${y + h - 14} L ${x + w * 0.35} ${y + h * 0.5} L ${x + w * 0.55} ${y + h - 26} L ${x + w * 0.7} ${y + h * 0.6} L ${x + w - 14} ${y + h - 14} Z`} fill="#6A3E5A" />
      </g>
    ) : art === 1 ? (
      <g>
        <rect x={x + 14} y={y + 14} width={w - 28} height={h - 28} fill="#4A5A7A" />
        <circle cx={x + w / 2 - w * 0.08} cy={y + h / 2 - h * 0.08} r={Math.min(w, h) * 0.16} fill="#E9C46A" />
        <circle cx={x + w / 2 + w * 0.12} cy={y + h / 2 + h * 0.12} r={Math.min(w, h) * 0.11} fill="#D9906A" />
      </g>
    ) : (
      <g>
        <rect x={x + 14} y={y + 14} width={w - 28} height={h - 28} fill="#9FC0D6" />
        <rect x={x + 14} y={y + h - 34} width={w - 28} height={20} fill="#4A6A8A" />
        <path d={`M ${x + w * 0.45} ${y + h - 34} L ${x + w * 0.45} ${y + 26} L ${x + w * 0.66} ${y + h - 38} Z`} fill="#F4EEE0" />
      </g>
    )}
  </g>
);

/** A round wall clock on the back wall. */
export const WallClock: React.FC<{ x: number; y: number; r?: number; t?: number }> = ({ x, y, r = 32, t = 0 }) => (
  <g>
    <circle cx={x} cy={y} r={r} fill="#EFE2CC" />
    <circle cx={x} cy={y} r={r} fill="none" stroke="#1E1824" strokeWidth={r * 0.19} />
    <path d={`M ${x} ${y} L ${x} ${y - r * 0.62} M ${x} ${y} L ${x + r * 0.44} ${y + r * 0.25}`} stroke="#1E1824" strokeWidth={r * 0.13} strokeLinecap="round" transform={`rotate(${t * 0.2} ${x} ${y})`} />
  </g>
);

/** A shadow on the floor under a box-shaped thing (a cabinet, a table): an offset dark quad. */
export const FloorShadow: React.FC<{ r: Room; u: [number, number]; w: [number, number]; o?: number }> = ({ r, u: [u0, u1], w: [w0, w1], o = 0.35 }) => (
  <polygon points={r.Q([[u0, 1, w0], [u1 + 0.02, 1, w0], [u1 + 0.02, 1, w1 + 0.02], [u0, 1, w1 + 0.02]])} fill="#000" opacity={o} />
);

/**
 * A table top seen from high above, filling the frame (a desk, a worktop): the surface with its grain running away
 * toward the top, its lit front edge at y `edge`, the floor far below past the edge, out of focus. Put props on it in
 * screen coordinates. For a pure top-down shot, push `edge` past the bottom of frame (1300).
 */
export const Tabletop: React.FC<{ edge?: number; wood?: string; grain?: string; lip?: string; floor?: string; floorLines?: string; kind?: 'wood' | 'stone' }> = ({
  edge = 640, wood = '#6B4B42', grain = '#5C4038', lip = '#7A5747', floor = '#2E2228', floorLines = '#22181D', kind = 'wood',
}) => {
  const gx = (x0: number, y: number) => x0 + (960 - x0) * ((edge - y) / (edge + 1600));
  return (
    <g>
      <g filter="url(#blur3)">
        <rect x={-400} y={edge} width={2720} height={900} fill={floor} />
        {Array.from({ length: 40 }).map((_, i) => {
          const x = -500 + i * 72;
          return <path key={i} d={`M ${x} ${edge + 90} L ${960 + (x - 960) * 1.5} 1400`} stroke={floorLines} strokeWidth={3} />;
        })}
      </g>
      <rect x={-400} y={-400} width={2720} height={edge + 400} fill={wood} />
      {kind === 'wood'
        ? Array.from({ length: 30 }).map((_, i) => {
            const x0 = -800 + i * 130;
            return <path key={i} d={`M ${x0} ${edge} L ${gx(x0, -400)} -400`} stroke={grain} strokeWidth={i % 3 ? 2 : 4} opacity={0.75} />;
          })
        : Array.from({ length: 14 }).map((_, i) => (
            <path
              key={i}
              d={`M ${-400 + rnd(41, i) * 2700} ${-400 + rnd(42, i) * 1000} q ${120 + rnd(43, i) * 200} ${40 + rnd(44, i) * 60} ${300 + rnd(45, i) * 300} ${-20 + rnd(46, i) * 80}`}
              stroke={grain}
              strokeWidth={2 + rnd(47, i) * 3}
              fill="none"
              opacity={0.5}
            />
          ))}
      <rect x={-400} y={edge} width={2720} height={24} fill={lip} />
      <rect x={-400} y={edge} width={2720} height={3} fill={S3.warm} opacity={0.7} />
    </g>
  );
};

```

## File: studio/src/engine/index.ts
size: 592
sha: 5c7b3f5a5359449e3a5c18b55cf61a9557dace56
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/index.ts

```text
// Everything an episode builds with, in one import: import { Study, Hero, poseAt, Marquee, ... } from '../../engine';
export * from './anim';
export * from './rig';
export * from './props';
export * from './kit';
export * from './light';
export * from './room';
export * from './furnish';
export * from './ui';
export * from './fonts';
export * from './episode';
export * from './sets/study';
export * from './sets/stairwell';
export * from './sets/classroom';
export * from './sets/rooftop';
export * from './sets/kitchen';
export * from './sets/schematic';
export * from './sets/bedroom';
```

## File: studio/src/engine/kit.tsx
size: 9720
sha: e2d7a871b0b353109c357ca0af99352bcb7dc3d7
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/kit.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/kit.tsx

## File: studio/src/engine/light.tsx
size: 8414
sha: aacda98dd9426e780a25351de23b19bf738e752b
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/light.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/light.tsx

## File: studio/src/engine/props.tsx
size: 27121
sha: bd6cfca51761214ee96b05a7bfc1c142fc0e9e3d
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/props.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/props.tsx

## File: studio/src/engine/rig.tsx
size: 26669
sha: 518c43e881b835e06d8b95190f13706a89fca620
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/rig.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/rig.tsx

## File: studio/src/engine/room.tsx
size: 3018
sha: 61c320b6e4c2ac51969efc33f900266adf457602
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/room.tsx

```text
import React from 'react';
import { lerp } from './anim';

// Rooms in one-point perspective. Measured against the genre, the gap was the world, not the animation: full sets in
// real perspective, 20-40 designed objects, light that comes from something (windows, lamps, sconces, string lights),
// muted walls so that light reads.
// Every room is a one-point perspective box: a point is (u across, v down, w toward camera), 0..1 on the
// back wall's box, w = 0 on the back wall and 1 at the near plane. Equal steps in w are equal steps in depth.

export type Pt = { x: number; y: number };
export type V3 = [number, number, number];
export const pts = (a: Pt[]) => a.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(' ');

/** The set palette: muted, mid-dark surfaces, so the practical lights read. */
export const S3 = {
  wall: '#443A4B',
  wallSide: '#362E3E',
  ceiling: '#211B28',
  floor: '#2E2228',
  board: '#253C35',
  wood: '#5B4038',
  woodLight: '#7A5747',
  woodDark: '#3A2826',
  trim: '#231C29',
  warm: '#FFB46A',
  glow: '#FFD39A',
  metal: '#5E5A6C',
};

export const makeRoom = (vp: Pt, back: { x0: number; x1: number; y0: number; y1: number }, S = 3.5) => {
  const s = (w: number) => 1 / lerp(1, 1 / S, w);
  const P = (u: number, v: number, w: number): Pt => {
    const k = s(w);
    return { x: vp.x + (lerp(back.x0, back.x1, u) - vp.x) * k, y: vp.y + (lerp(back.y0, back.y1, v) - vp.y) * k };
  };
  const Q = (a: V3[]) => pts(a.map(([u, v, w]) => P(u, v, w)));
  return { vp, back, s, P, Q };
};
export type Room = ReturnType<typeof makeRoom>;

/** A box in the room, drawn face by face: only the faces this camera can see, lighter on top, darker at the sides. */
export const Box: React.FC<{ r: Room; u: [number, number]; v: [number, number]; w: [number, number]; front: string; top?: string; side?: string; rim?: boolean }> = ({
  r, u: [u0, u1], v: [v0, v1], w: [w0, w1], front, top, side, rim,
}) => {
  const bx = (u: number) => lerp(r.back.x0, r.back.x1, u);
  const by = (v: number) => lerp(r.back.y0, r.back.y1, v);
  const faces: React.ReactNode[] = [];
  if (by(v0) > r.vp.y) faces.push(<polygon key="t" points={r.Q([[u0, v0, w0], [u1, v0, w0], [u1, v0, w1], [u0, v0, w1]])} fill={top ?? front} />);
  if (by(v1) < r.vp.y) faces.push(<polygon key="b" points={r.Q([[u0, v1, w0], [u1, v1, w0], [u1, v1, w1], [u0, v1, w1]])} fill={side ?? front} />);
  if (bx(u0) > r.vp.x) faces.push(<polygon key="l" points={r.Q([[u0, v0, w0], [u0, v0, w1], [u0, v1, w1], [u0, v1, w0]])} fill={side ?? front} />);
  if (bx(u1) < r.vp.x) faces.push(<polygon key="r" points={r.Q([[u1, v0, w0], [u1, v0, w1], [u1, v1, w1], [u1, v1, w0]])} fill={side ?? front} />);
  const a = r.P(u0, v0, w1);
  const b = r.P(u1, v0, w1);
  return (
    <g>
      {faces}
      <polygon points={r.Q([[u0, v0, w1], [u1, v0, w1], [u1, v1, w1], [u0, v1, w1]])} fill={front} />
      {rim ? <path d={`M ${a.x} ${a.y} L ${b.x} ${b.y}`} stroke={S3.warm} strokeWidth={2.5} opacity={0.55} /> : null}
    </g>
  );
};
```

## File: studio/src/engine/sets/bedroom.tsx
size: 16598
sha: 96755d79a72a508214e91529e7d7a80464cd4fb7
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/bedroom.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/bedroom.tsx

## File: studio/src/engine/sets/classroom.tsx
size: 14192
sha: 78a041605fdfe3ce71493bc3a2369e05b31cba7f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/classroom.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/classroom.tsx

## File: studio/src/engine/sets/kitchen.tsx
size: 12447
sha: f43fecd6304defa283ab71cd0adec1cf4aeea872
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/kitchen.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/kitchen.tsx

## File: studio/src/engine/sets/rooftop.tsx
size: 11194
sha: ad82e9e9a22045dac04fcef5e526f0bae93383d5
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/rooftop.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/rooftop.tsx

## File: studio/src/engine/sets/schematic.tsx
size: 6434
sha: 5837018633075f1402ad8c47e8528c99eeaeaa38
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/schematic.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/schematic.tsx

## File: studio/src/engine/sets/stairwell.tsx
size: 12725
sha: 3426793ee07810ca9a4af2861694fcb7e8d2ce3a
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/stairwell.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/stairwell.tsx

## File: studio/src/engine/sets/study.tsx
size: 18009
sha: 2b0f97e76970f4fc9bb0065da445a1039ecda070
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/study.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/sets/study.tsx

## File: studio/src/engine/ui.tsx
size: 13020
sha: e955938eb8015aa4246f570b898f9f0c355f8636
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/ui.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/engine/ui.tsx

## File: studio/src/episodes/copy-paste/episode.json
size: 10513
sha: 421f9ca6c5dbd1991ad9e0ad9e331f07c1a25180
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/episode.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/episode.json

## File: studio/src/episodes/copy-paste/index.tsx
size: 969
sha: c93502a20ef4ef193e5275f861e5c4a0b54652af
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/index.tsx

```text
import React from 'react';
import { defineEpisode, Timeline, LookDef, HudChip } from '../../engine';
import timeline from './timeline.json';
import { S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12, S13, S14, S15 } from './shots';

// The power's two looks. COPY: the picture cools a touch while the selection is live, a COPY chip blinks.
// PASTE: a PASTE chip; the copy's pop and cyan ring are drawn in the shot (PasteIn), the flash is an fx cue.
const copyLook: LookDef = {
  grade: (lv) => `saturate(${1 - 0.12 * lv}) hue-rotate(${-8 * lv}deg) brightness(${1 + 0.04 * lv})`,
  Overlay: ({ f }) => <HudChip f={f} label="COPY" icon="copy" />,
};
const pasteLook: LookDef = {
  Overlay: ({ f }) => <HudChip f={f} label="PASTE" icon="paste" />,
};

export const copyPaste = defineEpisode('CopyPaste', {
  timeline: timeline as Timeline,
  shots: { S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12, S13, S14, S15 },
  looks: { copy: copyLook, paste: pasteLook },
});
```

## File: studio/src/episodes/copy-paste/shots.tsx
size: 23351
sha: f0f25f33ddf31c5b882c5dff199103485108fc9f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/shots.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/shots.tsx

## File: studio/src/episodes/copy-paste/timeline.json
size: 5808
sha: 979eb7c141e0a3c8c3eae8902ac86b925a3fedfc
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/timeline.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/timeline.json

## File: studio/src/episodes/copy-paste/words.json
size: 3774
sha: 90551b1b523cb3930bbddfb663194a7c21961bd0
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/words.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/copy-paste/words.json

## File: studio/src/episodes/index.ts
size: 191
sha: fff9dfd5fc77f7b6ba1f678a68a93c3d18993131
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/index.ts

```text
// The registry: add each new episode here (one import, one entry).
import { rewind } from './rewind';
import { copyPaste } from './copy-paste';

export const EPISODES = [rewind, copyPaste];
```

## File: studio/src/episodes/rewind/episode.json
size: 7889
sha: 42a3a57dbbc2a73556e7e532975066a6155b0170
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/episode.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/episode.json

## File: studio/src/episodes/rewind/index.tsx
size: 1273
sha: 51ef5922430e65e6c09ec9cb4b025993a12514e0
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/index.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/index.tsx

## File: studio/src/episodes/rewind/shots.tsx
size: 25760
sha: 52abcee0f7dbcdf1cd85e3e0a5ef6f8bf638ec73
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/shots.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/shots.tsx

## File: studio/src/episodes/rewind/timeline.json
size: 4736
sha: 9728bdd68e6957a5c4b10b9ee418b5b94c896003
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/timeline.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/timeline.json

## File: studio/src/episodes/rewind/words.json
size: 2637
sha: c8c91ee098c599007e3e124ed1df67a55bca7f8f
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/words.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/episodes/rewind/words.json

## File: studio/src/index.ts
size: 93
sha: aa152d6e1cc4ca6ec10f52ca38b29bba50cdaffc
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/index.ts

```text
import { registerRoot } from 'remotion';
import { Root } from './Root';

registerRoot(Root);
```

## File: studio/src/Root.tsx
size: 999
sha: 1b8c42577e153c3db071c8bd604f760b888bae78
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/Root.tsx

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/Root.tsx

## File: studio/src/studio.config.ts
size: 462
sha: be8ab7506912ebc86a1f54e20171a97edcae1d87
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/studio.config.ts

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/src/studio.config.ts

## File: studio/tsconfig.json
size: 315
sha: 01f1d29427694a279eea0774d7cc734e27f37ac3
upstream: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/tsconfig.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/kelano86/what-if-animation/blob/HEAD/studio/tsconfig.json
