@anime-studio/cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/bin.js +20 -0
  2. package/dist/bin.js.map +1 -1
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +3 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/skills.d.ts +28 -0
  8. package/dist/skills.d.ts.map +1 -0
  9. package/dist/skills.js +56 -0
  10. package/dist/skills.js.map +1 -0
  11. package/package.json +6 -5
  12. package/skills/animestudio/SKILL.md +165 -0
  13. package/skills/animestudio/examples/first-frame.ts +54 -0
  14. package/skills/animestudio/examples/hello.scene.json +50 -0
  15. package/skills/animestudio/examples/hello.sequence.json +13 -0
  16. package/skills/animestudio/examples/remotion/Root.tsx +25 -0
  17. package/skills/animestudio/examples/remotion/index.ts +5 -0
  18. package/skills/animestudio/examples/render-video.ts +110 -0
  19. package/skills/animestudio/references/packages.md +54 -0
  20. package/skills/animestudio/references/rendering.md +127 -0
  21. package/skills/animestudio/references/scene-format.md +101 -0
  22. package/skills/animestudio/references/validation-and-debugging.md +67 -0
  23. package/skills/animestudio-animation/SKILL.md +176 -0
  24. package/skills/animestudio-animation/examples/gestures.ts +55 -0
  25. package/skills/animestudio-animation/examples/hold.ts +82 -0
  26. package/skills/animestudio-animation/examples/knockdown.ts +68 -0
  27. package/skills/animestudio-animation/examples/sheet.ts +80 -0
  28. package/skills/animestudio-animation/examples/walk-wave-run.ts +59 -0
  29. package/skills/animestudio-animation/references/clips.md +103 -0
  30. package/skills/animestudio-animation/references/director-beats.md +48 -0
  31. package/skills/animestudio-animation/references/holding.md +106 -0
  32. package/skills/animestudio-animation/references/locomotion.md +86 -0
  33. package/skills/animestudio-animation/references/timing.md +89 -0
  34. package/skills/animestudio-characters/SKILL.md +211 -0
  35. package/skills/animestudio-characters/examples/cast.ts +63 -0
  36. package/skills/animestudio-characters/examples/human.ts +52 -0
  37. package/skills/animestudio-characters/examples/import-svg.ts +68 -0
  38. package/skills/animestudio-characters/examples/lumo.svg +36 -0
  39. package/skills/animestudio-characters/examples/sprout.toon.json +116 -0
  40. package/skills/animestudio-characters/examples/sprout.ts +48 -0
  41. package/skills/animestudio-characters/examples/turnaround.ts +91 -0
  42. package/skills/animestudio-characters/references/custom-rig.md +139 -0
  43. package/skills/animestudio-characters/references/import-svg.md +59 -0
  44. package/skills/animestudio-characters/references/look-options.md +143 -0
  45. package/skills/animestudio-characters/references/rig-surface.md +62 -0
  46. package/skills/animestudio-script/SKILL.md +164 -0
  47. package/skills/animestudio-script/examples/director.ts +143 -0
  48. package/skills/animestudio-script/examples/sheet.ts +58 -0
  49. package/skills/animestudio-script/examples/short.ts +193 -0
  50. package/skills/animestudio-script/references/actions.md +84 -0
  51. package/skills/animestudio-script/references/dialogue-lipsync.md +87 -0
  52. package/skills/animestudio-script/references/director.md +110 -0
  53. package/skills/animestudio-script/references/shots-and-editing.md +79 -0
  54. package/skills/animestudio-script/references/writing-for-animation.md +84 -0
  55. package/skills/animestudio-sets/SKILL.md +232 -0
  56. package/skills/animestudio-sets/examples/hillside.scene.json +93 -0
  57. package/skills/animestudio-sets/examples/render-scene.ts +35 -0
  58. package/skills/animestudio-sets/examples/sets.ts +257 -0
  59. package/skills/animestudio-sets/references/drawing-sets.md +119 -0
  60. package/skills/animestudio-sets/references/fx.md +92 -0
  61. package/skills/animestudio-sets/references/lighting-camera.md +93 -0
  62. package/skills/animestudio-sets/references/scene-fields.md +132 -0
@@ -0,0 +1,84 @@
1
+ # Scene script actions and tracks (exact vocabulary)
2
+
3
+ Read this when you write or edit a scene's `script` or `tracks` by hand. Everything here is taken
4
+ from `packages/core/src/format/schema.ts` (`ActionSchema`). Objects are **strict**: an unknown or
5
+ misspelt field is a validation error. Full prose: [FORMAT.md §3](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#3-scene-document-scenejson).
6
+
7
+ Every action has `at` (seconds from the scene's start, ≥ 0) and `action`. Actor actions also have
8
+ `actor` (an id from the scene's `actors`). Order in the array does not matter; times do.
9
+
10
+ ## Actor actions
11
+
12
+ | `action` | Fields (`?` = optional) | Use it for |
13
+ |---|---|---|
14
+ | `play` | `clip`, `duration?`, `loop?`, `speed?` (1), `fadeIn?` (0.2), `fadeOut?` (0.2), `layer?` (0), `blend?` (`override` \| `additive`), `weight?` (0–1) | Gestures and loops. Base loop: `{ clip: "idle", loop: true, layer: -1 }` at 0 for every actor |
15
+ | `set` | `channel`, `value`, `duration?` (0), `ease?` | Any character channel (`controls.x`, `bones.b.rotation`, `parts.p.variant`, `ik.handF.x`) or placement (`x`, `y`, `flip`…). Takes over a change under way, never jumps |
16
+ | `pose` | `control`, `value` (pose name, `null`, or `{ pose: weight }`), `duration?` (0.3), `ease?` | Emotions (`control: "emotion"`), views (`"view"`), wardrobe, `jaw` gape |
17
+ | `walkTo` | `x`, `y?`, `duration?` or `speed?` (px/s, 220), `clip?` (`"walk"`), `ease?` | Moving: stride-matched feet, faces the way it goes. `clip: "run"`, `"sneak"`, `"strut"`, `"tired"`, `"march"`, `"scaredRun"` on kit rigs |
18
+ | `face` | `direction` (`left` \| `right`) | Turning round in place |
19
+ | `lookAt` | `target` (actor id, prop id, `[x, y]`, or `null`), `control?` | Gaze; held until the next `lookAt`; follows moving targets |
20
+ | `say` | `audio?`, `lipsync?` (cues id), `cues?` (inline), `text?` + `duration?`, `control?`, `volume?` | Dialogue. Needs one of `cues`, `lipsync`, `text` (see dialogue-lipsync.md) |
21
+ | `fall` | `side?` (`back` \| `front`), `from?` (hitter id), `distance?`, `height?`, `duration?`, `spin?`, `clip?`, `pose?`, `squash?` | Knock-downs and trips. Lying until `getUp`; no `face`/`walkTo` while down |
22
+ | `getUp` | `duration?` (1.2), `clip?` (`"rise"`) | Back on the feet after `fall` |
23
+ | `mount` | `on` (actor id or `null`), `anchor?` (`"seat"`), `point?`, `duration?` (0.3), `behind?` (part ids), `facing?` (`ridden` \| `own`) | Riding or sitting on another actor (bike, horse, chair rig) |
24
+ | `reach` | `chain` (IK id), `target` (`{ actor, anchor }`, `{ prop, point, from? }`, `[x, y]`, or `null`), `duration?` (0.3) | A hand or foot held on something (pedals, handlebar, a table top) |
25
+ | `grab` | `prop`, `anchor`, `also?` (anchors), `fit?` (1–2 points), `hang?` | Taking a prop in a hand (see the `animestudio-animation` skill for fitting) |
26
+ | `release` | `prop`, `velocity?`, `keep?` | Letting go (thrown with `velocity`, left in place with `keep`) |
27
+
28
+ ## Scene actions (no `actor`)
29
+
30
+ | `action` | Fields | Use it for |
31
+ |---|---|---|
32
+ | `camera` | `x?`, `y?`, `zoom?`, `rotation?`, `duration?` (1; **0 = a cut**), `ease?` | Moves and cuts |
33
+ | `camera` (rigs) | `follow` (id/`null`), `offset`, `lag`, `axes` (`x` \| `xy`), `deadZone`, `lookAhead`, `blend`; `frame` (ids/`null`), `padding`, `on` (`body` \| `face`), `minZoom`, `maxZoom`, `band`; `path` (`[[x,y]…]`); `punch`; `handheld`; `dolly`; `focus`, `blur`, `focusRange`; `motionBlur` | Tracking, two-shots that keep everyone in frame, curved moves, punch-ins, handheld drift, depth of field |
34
+ | `transition` | `type` (`fade` \| `iris` \| `wipe` \| `flash`), `duration?`, `mode?` (`outIn` default, `out`, `in`), `color?`, `direction?` (wipe), `target?` (iris centre: id or `[x, y]`) | Inside a scene: an iris out on the last beat, a wipe in at the start |
35
+ | `fx` | `type`, `actor?`, `anchor?` (`head` default, `origin` = feet), `offset?`, `prop?`, `x?`, `y?`, `duration?`, `scale?`, `color?`, `fill?`, `text?` + `style?` (captions), `angle?` (speedLines) | Cartoon accents (list below) |
36
+ | `shake` | `duration?` (0.5), `amount?` (10 px), `frequency?` (12 Hz) | Impacts |
37
+ | `sound` | `audio` (id in the scene's `audio`), `volume?` | Sound effects |
38
+ | `light` | `channel` (lighting channel), `value`, `duration?`, `ease?` | Lamps on, sunrise (`lights.<id>.intensity`, `lighting.ambient.opacity`) |
39
+ | `impulse` | `prop`, `vector` (`[vx, vy]` px/s) | Kicking a physics prop |
40
+ | `put` | `prop`, `on` (prop id or `null`) | A prop resting on another (a cup on a tray) |
41
+
42
+ **`fx` types:** `surprise`, `exclaim`, `question`, `sweat`, `sparkle`, `dust`, `hearts`, `zzz`,
43
+ `anger`, `impact`, `gloom`, `notes`, `stars`, `lightbulb`, `birds`, `burst`, `aura` (behind the
44
+ actor), `ghost`, and the screen-space `focusLines`, `speedLines`, `impactFrame`, `caption`
45
+ (`text`, `style`: `title` \| `impact` \| `ko` \| `place`). Start a reaction's fx ~0.05 s before
46
+ the reaction.
47
+
48
+ ## Not scene actions
49
+
50
+ `sit`, `lie`, `sleep`, `ride`, `wear`, `hide`, `peek`, `hug`, `give`, `hit`, `enter`, `exit`,
51
+ `gesture`, `emotion`, `view`… are **director beats** (`do: "…"` in a staging, see director.md),
52
+ not scene actions. The director turns them into the actions above (`mount`, `reach`, `pose`,
53
+ `set`, `play`…). In a hand-written scene, stage them yourself with those primitives, or use the
54
+ director.
55
+
56
+ ## Tracks (keyed channels)
57
+
58
+ `tracks` maps a channel to keys `[time, value, ease?]`. Use tracks for things that are not
59
+ actions: props sliding in, title cards popping, layers drifting, a door opening by hand.
60
+
61
+ ```jsonc
62
+ "tracks": {
63
+ "camera.zoom": [[0, 1], [6, 1.2, "sineInOut"]],
64
+ "props.sign.scale": [[0, 0], [0.4, 1.15, "easeOut"], [0.6, 1]],
65
+ "actors.mia.opacity": [[0, 0], [2.0, 0], [2.3, 1]],
66
+ "actors.rex.controls.emotion": [[0, "happy"]]
67
+ }
68
+ ```
69
+
70
+ Channels: `camera.(x|y|zoom|rotation|handheld|dolly|focus|blur|focusRange|motionBlur)`;
71
+ `actors.<id>.(x|y|rotation|scale|opacity|flip|z)` and `actors.<id>.<character channel>`;
72
+ `props.<id>.(x|y|rotation|scale|opacity|z)`; `layers.<id>.(x|y|rotation|scale|opacity|z)`;
73
+ `lights.<id>.<prop>`, `lighting.<section>.<prop>`. Hex colours interpolate.
74
+
75
+ **A track holds its first key before it.** A key at t = 40 also applies at t = 0, so give every
76
+ channel that changes an explicit value at t = 0. The same holds for `pose`/`set` actions: set the
77
+ starting emotion and view at `at: 0`.
78
+
79
+ ## Which channels does my character have?
80
+
81
+ Run `npx tsx packages/cli/src/bin.ts describe <file.toon.json>` (or `toon describe`): it lists the
82
+ controls (emotions, views, viseme, aim), clips with durations and strides, anchors and every
83
+ channel. Never guess a clip or emotion name: the validator rejects unknown ids and lists the valid
84
+ ones.
@@ -0,0 +1,87 @@
1
+ # Dialogue and lip sync
2
+
3
+ Read this when a scene has spoken lines: choosing a lip sync source, timing lines, and staging the
4
+ acting around them (emotion, gaze, gestures, listeners).
5
+
6
+ ## How a line reaches the mouth
7
+
8
+ A `say` action writes viseme keys on the character's viseme control (`controls.mouth` on kit rigs)
9
+ from **mouth cues** in the Rhubarb JSON shape:
10
+
11
+ ```json
12
+ { "mouthCues": [ { "start": 0.0, "end": 0.12, "value": "X" }, { "start": 0.12, "end": 0.3, "value": "D" } ] }
13
+ ```
14
+
15
+ Visemes (Preston Blair): `A` closed (M B P), `B` slightly open (most consonants, EE), `C` open (EH
16
+ AE), `D` wide (AA), `E` rounded (AO ER), `F` puckered (OO W), `G` teeth on lip (F V), `H` tongue
17
+ (L), `X` rest. Cue times are relative to the `say`'s `at`.
18
+
19
+ `say` takes exactly one cue source:
20
+
21
+ | Field | Source | When |
22
+ |---|---|---|
23
+ | `lipsync: "<id>"` + scene `"lipsync": { "<id>": "./l1.cues.json" }` | A cues file | Recorded or TTS audio processed offline (best) |
24
+ | `cues: [...]` | Inline cues | Generated in code (TTS timestamps, the director) |
25
+ | `text` + `duration` | Text spread over the duration | No audio yet: animatics, tests, silent shorts |
26
+
27
+ Add `audio: "<id>"` (declared in the scene's `audio`) to play the voice with it, `volume` to mix.
28
+
29
+ ## Cue sources, best first
30
+
31
+ 1. **Rhubarb** on the recorded/TTS WAV — real phonemes. CLI:
32
+ `npx tsx packages/cli/src/bin.ts lipsync line.wav --text "Oh! Hi, Rex!" -o line.cues.json`
33
+ (`toon lipsync` once installed; `--lang pt` for non-English uses the phonetic recognizer).
34
+ Install Rhubarb on PATH, `~/.local/bin`, or set `RHUBARB_PATH`.
35
+ 2. **TTS character timestamps** (ElevenLabs `with-timestamps` shape) →
36
+ `cuesFromAlignment(alignment, offset?)` from `@anime-studio/lipsync`.
37
+ 3. **Known text + audio, no tools**: `--engine align` (or `alignTextToAudio(text, samples, rate)`):
38
+ words spread over the voiced segments, mouth at rest in the silences.
39
+ 4. **Audio only**: `--engine amplitude` (`cuesFromAmplitude`): loudness → mouth size. Good for
40
+ gibberish, singing, creatures.
41
+ 5. **Text only**: `say` with `text` + `duration` (`cuesFromText`). No audio needed. Rough: it
42
+ spreads letters over the duration and puts long rests at punctuation, so short exclamations
43
+ ("Oh! Hi!") open the mouth only briefly. Give it the real spoken duration and check a frame on
44
+ an open vowel.
45
+
46
+ `--engine auto` (default) picks rhubarb if installed, else align (with `--text`), else amplitude.
47
+ In code: `lipsyncFile(path, { text, language, engine })` from `@anime-studio/lipsync/node`;
48
+ `wavDuration(path)` gives the line's length for timing the scene.
49
+
50
+ ## Timing lines in a scene
51
+
52
+ - Measure each line (audio length, or ~0.3 s per word + 0.2 s per pause when there is no audio)
53
+ and lay the scene out **from the dialogue**: put the line times in named constants and key
54
+ everything to them (`T.line`, `T.line + word offset`). A re-record then moves one number.
55
+ - Leave 0.2–0.4 s of air between lines; more before a punchline (the pause sells it).
56
+ - A reaction to a line starts on the key word or just after the line, not at the next line.
57
+ - Key motion described by narration to the narration's words, so it lasts as long as the words.
58
+ - Word times (from TTS timestamps or the director's `words`) let you hit a gesture on a word:
59
+ see `examples/promo/shots.ts` (`word("maya", "made")`) in the repo.
60
+
61
+ ## Acting a line
62
+
63
+ Per line, decide: **who speaks, to whom, with what emotion, and what the body does**.
64
+
65
+ - **Emotion first**: `pose` `emotion` 0.05–0.3 s *before* the line (`duration` 0.2–0.4), so the face
66
+ is set when the mouth opens. Change it mid-line on the turn of the thought, not every word.
67
+ Kit emotions: `neutral sleep happy joy surprised sad smug scared angry dead determined calm
68
+ excited annoyed gape` (run `describe` for your rig). No `say` on top of a big `gape`.
69
+ - **Gaze**: `lookAt` the listener before the line starts and keep it. Listeners `lookAt` the
70
+ speaker (and `face` them when they would otherwise show their back). Looking away mid-line reads
71
+ as evasive — use it on purpose.
72
+ - **Gesture while talking**: one `play` per thought, starting ~0.1–0.2 s *before* the stressed word
73
+ (`fadeIn` 0.15–0.25, `fadeOut` 0.2–0.4): `wave`, `point`, `present`, `shrug`, `cheer`, `laugh`,
74
+ `think`, `facepalm`, the looping `talk`. Not one per word: busy hands kill the line.
75
+ - **Front view** (`pose view front`) = speaking to the audience; clear the gaze with
76
+ `lookAt: null`. A three-quarter view reads as talking to someone in the scene.
77
+ - **Readable mouths**: lip sync needs a face of ~80+ px on screen. Cut or push in (`camera` medium /
78
+ two-shot) for lines that matter; a wide shot hides the mouth.
79
+ - **Accents**: `fx` `exclaim`/`surprise` at a shouted word, `sweat` on an awkward line, a small
80
+ camera `punch` (0.1–0.2) on the punchline.
81
+
82
+ ## The director does this for you
83
+
84
+ With `@anime-studio/director`, each line's word timings drive the lip sync automatically
85
+ (`lineCues(line)`), listeners turn to and look at the speaker, the speaker turns to whoever is
86
+ named, talking gestures play, and `animation.life` adds blinks on head turns, saccades and head
87
+ nods on stressed words. You only write emotions and the deliberate beats (director.md).
@@ -0,0 +1,110 @@
1
+ # The director: staging whole episodes
2
+
3
+ Read this before staging anything longer than a minute or more than a few lines, or when the user
4
+ mentions "director", "staging", "beats", "blocks" or an episode. Exhaustive reference:
5
+ [DIRECTOR.md](https://github.com/denerFernandes/animeStudio/blob/master/docs/DIRECTOR.md).
6
+
7
+ ## Director or hand-written scenes?
8
+
9
+ | Use the **director** (`@anime-studio/director`) | Write **scenes by hand** (`*.scene.json`) |
10
+ |---|---|
11
+ | Episodes, conversations, many lines | A short gag, a title card, a promo shot, an insert |
12
+ | A kit exists (cast with `RigInfo`, sets with marks) | One-off art, motion graphics, physics showpieces |
13
+ | You want continuity for free: listeners turn, speakers face whoever is named, lip sync per word, walks at the cast's speed, no overlapping bodies | You need frame-exact control of every channel |
14
+ | sit / lie / ride / hug / give / hide / hit / enter / exit / wardrobe | Only the scene actions in actions.md |
15
+
16
+ Both end in the same documents (`toon-scene` + `toon-sequence`), so mix them: direct the episode,
17
+ then hand-write a cold open or an end card and add it as a shot.
18
+
19
+ ## Inputs
20
+
21
+ ```ts
22
+ import { check, describeKit, direct, type Kit, type Line, type Staging } from "@anime-studio/director";
23
+
24
+ const issues = check(staging, lines, kit); // always first
25
+ const strict = check(staging, lines, kit, { strict: true }); // every frame: before a final render
26
+ const { sequence, scenes, overlays, music, issues: notes } = direct(staging, lines, kit);
27
+ const catalogue = describeKit(kit); // what a staging may use (put it in prompts)
28
+ ```
29
+
30
+ **Lines** — the soundtrack, timed in episode seconds:
31
+ `{ i, speaker, text, s, e, words?: [{ w, s, e }], voiceEnd?, song? }`. `speaker` is a cast id, name
32
+ or alias (case/accents ignored), a narrator, `"sfx"` or `"song"`. Lip sync comes from `words`.
33
+ **No audio is required**: estimate word timings from the text (~0.12 s + 0.045 s per letter, a
34
+ pause after punctuation) to stage an animatic, then replace them with real TTS/aligner timings.
35
+
36
+ **Kit** — `characters` (every rig), `cast` (`{ name, aliases?, scale, rig: RigInfo, speed? }`;
37
+ `rig` from `cartoonInfo(doc, look)` / `rigInfo(doc)` in `@anime-studio/kit`), `sets` (`layers`,
38
+ `ground: { near, far? }`, `marks`, `bounds`, optional `fixtures`, `furniture`, `lighting`, `mood`),
39
+ `props` (by kind: `art`, `radius`, `points?`), optional `vehicles`, `furniture`, `sounds`,
40
+ `width`/`height`/`fps`. Building kits: see the `animestudio-characters` and `animestudio-sets`
41
+ skills.
42
+
43
+ ## Staging
44
+
45
+ ```jsonc
46
+ {
47
+ "animation": { "anticipation": 1, "life": 1 }, // leans, squashes, blinks, saccades, head nods
48
+ "camera": { "style": "conversation" }, // stable framing of whoever talks (or "dynamic")
49
+ "blocks": [{
50
+ "id": "park", "set": "park", "from": 0, "to": 3, // lines [from, to): one continuous scene
51
+ "mood": "day", "transition": "fade", // how this block comes in
52
+ "cast": [ // left → right
53
+ { "id": "rex", "at": "left", "facing": "right", "emotion": "happy" },
54
+ { "id": "mia", "enter": { "line": 1, "from": "right" } }
55
+ ],
56
+ "props": [{ "id": "ball", "kind": "ball", "heldBy": "rex" }],
57
+ "beats": [
58
+ { "line": 0, "word": "look", "do": "gesture", "who": "mia", "clip": "pointUp" },
59
+ { "line": 2, "end": true, "offset": 0.2, "do": "take", "who": "rex", "target": "sky", "double": true }
60
+ ]
61
+ }],
62
+ "cuts": [{ "line": 9, "replay": { "block": "park", "line": 1 } }],
63
+ "texts": [{ "line": 4, "text": "Later…" }]
64
+ }
65
+ ```
66
+
67
+ **Times are always relative to a line**: `{ line }` (start), `+ word`, `+ end: true`, `+ offset`.
68
+ **Places are marks or people**: `"bench"`, `{ "mark": "bench", "dx": -200 }`,
69
+ `{ "near": "mia", "side": "left" }` — never coordinates. That is what keeps a staging valid when
70
+ the audio is re-timed or the set redrawn.
71
+
72
+ ## Beats (`do`)
73
+
74
+ Movement: `walk`, `run`, `enter`, `exit`, `face`, `cross`, `fly`. Acting: `look`, `emotion`,
75
+ `gesture` (a clip; front-view face gestures are IK hand positions), `view`, `take` (a cartoon
76
+ take; `double: true`), `wear`. Bodies: `sit`, `lie`, `sleep`, `getUp`, `fall`, `hit`, `hide`,
77
+ `peek`, `hug`, `highFive`, `carry`, `cradle`, `hold`/`release` (hand in hand), `hands` (on a
78
+ table). Props: `pick`, `drop`, `throw`, `roll`, `dribble`, `give`, `use`, `take` (a prop), `hold`
79
+ (a prop), `putBack`, `press`, `snap`, `dropOn`, `fly` (a prop). Vehicles: `vehicle` (drive-by),
80
+ `mount`, `dismount`, `ride`. World: `fixture`, `light` (`mood`: `morning` `day` `afternoon`
81
+ `evening` `night`), `sound`, `fx`, `camera` (`wide` `group` `medium` `two-shot` `close` `crash`
82
+ `whip` `follow` `reveal` `push-in` `pull-out` `shake`). Fields per beat: DIRECTOR.md "Beats".
83
+ `describeKit(kit).actions` lists them for your installed version.
84
+
85
+ **Automatic — never write these:** idle loops, lip sync, listeners turning to and looking at the
86
+ speaker, talking gestures, spacing by head size, the initial `profile` view, group/wide framing,
87
+ blinks/saccades/head nods (with `life`), vehicles hidden outside their drive.
88
+
89
+ ## Checks: what they catch, how to react
90
+
91
+ `check()` returns `{ severity, where, message }`. Fix every **error** (unknown ids with a "did you
92
+ mean", someone acting in a block they are not in, a speaker missing from the block, overlapping
93
+ texts, blocks out of order, every scene/sequence validation issue). Read every **warning**: it says
94
+ what the director staged instead of what you asked (a walk that could not fit before the block
95
+ started, a view the rig does not draw, crossed legs). The picture checks report bodies outside
96
+ `SetDef.bounds`, faces covered by scenery for > 0.5 s, nose-to-nose standing, speakers out of
97
+ frame; `strict` adds the motion checks per frame (limbs spinning, held objects jumping, walking
98
+ backwards, hands over faces, a speaker still for > 2 s).
99
+
100
+ Common fixes: a beat needs the character there earlier → start them at the mark in the block's
101
+ `cast` (nothing moves before a block starts); two people at one mark → give each their own mark;
102
+ a speaker off frame → a `camera` beat or `camera.style: "conversation"`.
103
+
104
+ ## Output and files
105
+
106
+ `direct` returns `scenes` keyed by block id whose `characters` map ids to ids (placeholders):
107
+ compile them in memory with `{ characters: kit.characters }`, or, for the CLI, write each rig to a
108
+ file and rewrite the map to relative paths (see `examples/director.ts`). `sequence.shots` start
109
+ each block on its first line (`from` inside its scene) and carry the block `transition`s.
110
+ `overlays` are the `texts` with screen rows; `music` the ducked beds (`volumeAt`).
@@ -0,0 +1,79 @@
1
+ # Shots, cuts and sequences
2
+
3
+ Read this when you turn a shot list into documents: where cuts go (inside a scene or between
4
+ scenes), the camera per shot, transitions, and continuity across cuts. Reference:
5
+ [FORMAT.md §3.5 Camera and §4 Sequence](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#4-sequence-document-sequencejson),
6
+ [AI_GUIDE.md Continuity](https://github.com/denerFernandes/animeStudio/blob/master/docs/AI_GUIDE.md#continuity-staging-whole-episodes).
7
+
8
+ ## Scene = location + continuous action; shot = camera set-up
9
+
10
+ Do **not** make one scene per storyboard shot. Make one scene per location and stretch of
11
+ continuous action, and cut inside it with the camera:
12
+
13
+ ```jsonc
14
+ { "at": 4.4, "action": "camera", "x": 640, "y": 500, "zoom": 2.3, "duration": 0 }, // cut to a close-up
15
+ { "at": 5.6, "action": "camera", "x": 960, "y": 540, "zoom": 1, "duration": 0 } // cut back wide
16
+ ```
17
+
18
+ Why: characters, props and vehicles keep their positions across the cut, so nobody jumps sides,
19
+ vanishes or reappears elsewhere. `toon debug` reports these cuts as `info` "jump" findings — that is
20
+ expected for a cut and harmless.
21
+
22
+ New scene when: the place changes, time jumps (later that day), or a shot is a different world
23
+ (title card, insert, flashback, end card).
24
+
25
+ ## Camera per shot
26
+
27
+ | Shot | Scene camera |
28
+ |---|---|
29
+ | Wide / establishing | `x`, `y` at the set centre, `zoom` 1 |
30
+ | Medium / two-shot | `frame: ["a", "b"]`, `padding` 120–200 (keeps both in frame as they move); `on: "face"` for close two-shots |
31
+ | Close-up | `x`/`y` on the face, `zoom` 2–2.5; or `frame: ["a"], on: "face"` to follow a moving head |
32
+ | Tracking | `follow: "a"`, `lookAhead` 0.3, `deadZone` |
33
+ | Reveal | a slow move (`duration` ≥ 1, `sineInOut`) from what the character sees to what it hasn't seen |
34
+ | Accent | `punch` 0.1–0.2 on a reaction; `shake` on impacts; `handheld` 3–6 for life |
35
+
36
+ Prefer `frame` over hand-computed coordinates for two-shots. Keep moves slow (≥ 1 s); a cut is
37
+ `duration: 0`. Lines that matter get a shot where the mouth is readable.
38
+
39
+ ## The sequence document
40
+
41
+ ```json
42
+ {
43
+ "format": "toon-sequence", "version": 1, "width": 1920, "height": 1080, "fps": 30,
44
+ "scenes": { "title": "./title.scene.json", "street": "./street.scene.json" },
45
+ "shots": [
46
+ { "scene": "title" },
47
+ { "scene": "street", "transition": { "type": "wipe", "duration": 0.4, "color": "#ffd166" } },
48
+ { "scene": "street", "from": 1.0, "duration": 2.0, "muteSpeech": true }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ Shot fields: `scene`, `from` (start inside the scene, default 0), `duration` (default the rest),
54
+ `transition` (into this shot: `cut`, `crossfade` — overlaps the shots by `duration` —, `fade`,
55
+ `iris` (`target`: an actor id), `wipe` (`direction`), `flash`; with `duration`, `color`),
56
+ `muteSpeech` (replays under other audio: recaps, songs), `speed` (negative = rewind; not 1 =
57
+ silent), `overlay: "vhs"`. Scene paths are relative to the sequence file. Each shot's audio plays on
58
+ the global timeline and is cut at the shot's end.
59
+
60
+ In-scene `transition` actions (`fade`, `iris`, `wipe`, `flash`; `mode` `out`/`in`/`outIn`) are for
61
+ the first and last beats of a scene: an iris closing on whoever has the last beat is the classic
62
+ cartoon ending.
63
+
64
+ ## Editing rules that keep it readable
65
+
66
+ - **180° rule**: who stands left of whom never changes across a cut unless the audience sees
67
+ them move. Keep travel direction consistent (left → right = going forward).
68
+ - **Cut on action or on a reaction**, not in the middle of a held pose; hold a shot ≥ 1 s (the
69
+ director merges shots under 0.4 s; `check` flags blink-length shots and white flashes < 2 s apart).
70
+ - **Match the moment**: a cut back into a continuous scene uses the scene time that follows (no
71
+ `from` gymnastics needed when the cut is a camera action inside the scene).
72
+ - **Objects keep their history**: a ball that rolled away stays where it stopped; vehicles drive
73
+ through and leave; a held prop is grabbed from the first frame of the scene.
74
+ - **Time of day** is one `light` change (director `light` beat with a `mood`; in a hand scene,
75
+ `light` actions / lighting tracks), never a different set.
76
+ - **Captions** belong to the screen: `fx caption`, or a `parallax: 0` prop, only while their line
77
+ plays.
78
+ - **Recaps and songs** reuse footage: a shot with `from` + `duration` + `muteSpeech` shows any
79
+ window of an earlier scene; pick windows where nobody speaks.
@@ -0,0 +1,84 @@
1
+ # Writing a script for animation
2
+
3
+ Read this when the user gives an idea (or a prose story) rather than a finished script, or when a
4
+ script exists but does not read as cartoon yet. Write the script **before** any JSON: the JSON is
5
+ only as good as the beats.
6
+
7
+ ## The documents, in order
8
+
9
+ 1. **Logline** — one sentence: who wants what, what goes wrong. "A guy tries three times to get
10
+ his friend's attention; the third time he gets it — face down."
11
+ 2. **Beat sheet** — 5–12 numbered beats, one action or reaction each, with an approximate length.
12
+ 3. **Scene list** — one row per location/continuous stretch: place, time of day, who is there,
13
+ which beats.
14
+ 4. **Shot list** — one row per camera set-up: scene, start–end time, framing (wide / medium /
15
+ two-shot / close), what happens, the line if any.
16
+ 5. **Dialogue** — speaker, line, emotion, addressee, the word the gesture hits.
17
+
18
+ Keep them as comments at the top of the example file or in a plain table the user can edit; the
19
+ scene times then come from the shot list.
20
+
21
+ ## Short-form vs episode
22
+
23
+ | | Short (5–60 s) | Episode (3–22 min) |
24
+ |---|---|---|
25
+ | Structure | Hook → escalation → payoff → button | Cold open, 2–3 acts, each with its own turn, tag |
26
+ | Locations | 1 (2 at most) | Several; a block per location stretch |
27
+ | Cast | 1–3 | Whole ensemble |
28
+ | Lines | 0–3, short | Dozens: use the director |
29
+ | Hook | Something happens in the first second (no establishing preamble) | The cold open's question |
30
+ | Tool | Hand-written scenes | `@anime-studio/director` staging |
31
+ | Vertical (9:16) | `width: 1080, height: 1920`; stack characters closer, frame faces larger | — |
32
+
33
+ A short ends on a **button**: a small extra beat after the payoff (stars over a head, an iris on
34
+ the loser, a last look to camera).
35
+
36
+ ## Staging for 2D
37
+
38
+ - **Silhouette first**: the pose must read as a black shape. Profiles and three-quarter views
39
+ (`profile` on kit rigs) read best; keep the front view for addressing the audience and the back
40
+ (`away`, `back`) for "not noticing" or walking away.
41
+ - **One action per beat**, one centre of attention at a time. If two things happen, stagger them
42
+ by ≥ 0.3 s so the eye can go from one to the other.
43
+ - **Clear screen direction**: entering left → right means going forward; keep it.
44
+ - **Leave room**: characters spaced by their head extents (snouts, hair, hats), not their feet;
45
+ never nose to nose unless they hug or fight.
46
+ - **Front of the camera stays open**: around a table, seat people behind it facing the camera.
47
+
48
+ ## Timing that reads (seconds, at 24–30 fps)
49
+
50
+ | Thing | Duration |
51
+ |---|---|
52
+ | A held reaction the audience must see | 0.8–1.5 |
53
+ | Anticipation before a fast move | 0.15–0.4 |
54
+ | A take (surprise) | 0.1 snap + 0.35 hold + 0.3 settle |
55
+ | Emotion change | 0.2–0.5 cross-fade, 0.05–0.3 before the line |
56
+ | Gesture | starts 0.1–0.2 before its word |
57
+ | Gap between lines | 0.2–0.4 (more before a punchline) |
58
+ | K.O. on the floor before `getUp` | ≥ 1.5 |
59
+ | Camera move | ≥ 1 (cuts are 0) |
60
+ | Title / caption on screen | ≥ 1.6 |
61
+
62
+ ## Comic timing
63
+
64
+ - **Anticipation → action → reaction.** Show what is about to happen (the wind-up, the look at
65
+ the banana skin), do it fast, then *hold on the reaction* — the laugh is in the reaction.
66
+ - **The rule of three.** Establish a pattern (1), confirm it (2), break it (3). The third beat is
67
+ the joke; make the first two quick and alike.
68
+ - **Escalate** each repetition (a wave → both arms → a run) so the break lands harder.
69
+ - **The pause.** A beat of nothing (0.5–1 s) before the payoff or after a stupid line.
70
+ - **The double take**: glance, look away, snap back bigger (director `take` with `double: true`;
71
+ by hand: `lookAt` away and back + `surprise` fx + a `pose` with `duration` 0.1).
72
+ - **Cut to the consequence**: skip the fall itself and cut to the character already on the floor
73
+ — cheaper and often funnier.
74
+ - **Accent, don't decorate**: one `fx` per beat (`surprise`, `sweat`, `stars`, `exclaim`); a
75
+ `shake` or `punch` only on impacts and punchlines.
76
+
77
+ ## Checklist before writing JSON
78
+
79
+ - Can every beat be said as "X does Y" in one line? Does every beat have a reaction?
80
+ - Is the longest beat the payoff's reaction, not the set-up?
81
+ - Is every action in the vocabulary (actions.md, or the director's beats)? If the story needs a
82
+ missing clip or prop, stage the nearest thing and list it (director `missing`), don't hack it.
83
+ - Does each spoken line have a speaker, addressee, emotion and length?
84
+ - Will the key frames read with the sound off? (Render a contact sheet and look.)