@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,119 @@
1
+ # Drawing cartoon sets as SVG
2
+
3
+ A set is a stage for acting, not an illustration. It must say *where we are* in one glance and
4
+ leave clean room for the characters. These rules come from TV-cartoon background practice and
5
+ from rendering and looking at the examples in this skill.
6
+
7
+ ## Style: match the characters
8
+
9
+ - **Flat colours**, at most a soft gradient on the sky or a back wall. No textures, no noise.
10
+ - **One ink, one weight.** Use the characters' ink colour and their line weight *as it appears on
11
+ screen*. The kit's default `modern` characters use ink `#2b2238` and line 2.4 at scale 1, so a
12
+ set for actors at scale 1 is inked at ~2.4–3 px; for actors at scale 1.4 use ~3.5–4 px.
13
+ (Painted-style characters ink in a dark tone of each fill: do the same in the set.)
14
+ - **Outline objects, not areas.** Furniture, props, doors and windows get the ink line; big walls,
15
+ sky and floors do not (one ink line where wall meets floor is enough).
16
+ - **Values:** the set is a little lighter and less saturated than the characters, so the cast
17
+ pops. Keep the most saturated colours for the cast and for the one object the story uses.
18
+ - **Far = low contrast, cool, no lines.** Distant hills and trees are flat silhouettes without
19
+ ink, closer to the sky colour. Near things get the ink and the strongest values.
20
+ - Original, generic places: invent the furniture and signage; never copy a show's set, logo or
21
+ layout.
22
+
23
+ ## The floor line
24
+
25
+ - Decide the y where feet stand first (16:9 at 1080 high: 900–960; 9:16 at 1920 high: ~1450–1550).
26
+ - Make it readable: a change of colour or an ink line where the ground starts.
27
+ - In rooms seen side-on, the **wall base** (where furniture stands) is higher than the
28
+ **feet line** (where people stand, in front of the furniture): e.g. base 790, feet 950. The
29
+ floor band between them is the room's depth.
30
+ - Slopes: the surface path, the ground art's top edge and the actors' `ground` all use the same
31
+ path string.
32
+
33
+ ## Scale: size the set from the cast
34
+
35
+ A kit adult is ~530 px tall at scale 1 (measure your own with `cartoonInfo(doc, look).height`;
36
+ children are smaller). With H = the person's height on screen:
37
+
38
+ | Thing | Height above its floor |
39
+ |---|---|
40
+ | Seat of a chair, bench, sofa | 0.25–0.3 H |
41
+ | Table, desk | 0.45 H |
42
+ | Kitchen counter | 0.5 H |
43
+ | Door | 1.35–1.4 H |
44
+ | Fridge | 1.1–1.25 H |
45
+ | Street lamp | 1.3–1.5 H |
46
+ | Window sill | 0.5–0.6 H; top ≈ door top |
47
+ | Ceiling (if shown) | ≥ 1.6 H |
48
+
49
+ How big the characters are in the frame:
50
+
51
+ | Shot | Person height / frame height |
52
+ |---|---|
53
+ | 16:9 wide (establishing) | 0.4–0.55 (kit adult scale ~0.8–1.1 at 1080 high) |
54
+ | 16:9 crowd / big exterior | 0.25–0.35 |
55
+ | 9:16 wide | 0.35–0.45 (scale ~1.3–1.6 at 1920 high) |
56
+ | Medium / close | use the camera (`zoom`, `frame`), not a bigger actor scale |
57
+
58
+ Keep one actor scale per set and change shot size with the camera: props, furniture and the cast
59
+ then always agree.
60
+
61
+ ## Composition
62
+
63
+ **16:9 (1920×1080)**
64
+
65
+ - Floor at the lower ~12–15% of the frame; actors' heads around the upper third line.
66
+ - Marks (actor x positions) on the thirds (≈ 640 and 1280) and the centre; leave the middle
67
+ third clear of tall busy shapes for a two-shot.
68
+ - Big shapes (cabinets, a chalkboard, trees) at the edges and the back; open floor in the middle.
69
+ - Foreground framing (a plant, a desk edge, a bush) only in the bottom corners, cut by the frame
70
+ edge, at `z` 50 with `parallax` 1.1–1.3. It must never cross a face.
71
+ - Top-left/top-right corners hold screen overlays (titles, a signature): keep them calm.
72
+
73
+ **9:16 (1080×1920)**
74
+
75
+ - One character (or two close together) is the subject; the set is mostly vertical: sky, tall
76
+ things (a lamp, a doorway, a tree), the ground.
77
+ - Floor at ~75–80% of the height: the bottom ~20% is ground, and also the zone where platform UI
78
+ and captions sit; keep it plain.
79
+ - Keep faces in the middle band (~25–60% of the height), away from the top ~12% (status bar, titles).
80
+ - Build vertical sets from the frame size (`parkAtNight(1080, 1920)` in `examples/sets.ts`)
81
+ instead of cropping a 16:9 set: things lay out for the tall frame, sizes still come from the cast.
82
+
83
+ **Both**
84
+
85
+ - Contrast behind heads: a plain, lighter or darker area than the hair and skin. A dark head on a
86
+ dark chalkboard, or a face over a window's mullion, loses its silhouette — move the mark.
87
+ - Avoid tangents: no horizon, counter top or shelf line exactly at a character's eye, chin or
88
+ neck, or exactly touching the top of the head; move it up or down by a clear margin.
89
+ - Lead the eye: the brightest value / the light source near where the action happens.
90
+ - Leave **head room** for profile heads and gestures (a raised arm, a jump) and **walk room** in
91
+ front of a character who will move.
92
+
93
+ ## Depth with layers
94
+
95
+ | Depth | z | parallax | Content |
96
+ |---|---|---|---|
97
+ | Sky | −100 | 0 | Gradient, sun/moon (or 0.05 so it drifts a hair) |
98
+ | Far | −95…−85 | 0.05–0.3 | Clouds, stars, skyline |
99
+ | Middle | −80…−70 | 0.3–0.6 | Hills, tree line, buildings across the street |
100
+ | Set | −60…−10 | 1 | Ground, walls, furniture behind people |
101
+ | Actors / props | 0…5 | 1 | |
102
+ | Foreground | 50 | 1.1–1.3 | Corner framing |
103
+ | Overlay | 150–200 | 0 | Titles, badges, captions as props |
104
+
105
+ Overscan every parallax ≥ 0.3 layer by the camera's travel × parallax (≥ 400–500 px each side for
106
+ follows and zoom-outs), and set `camera.bounds` to the drawn area.
107
+
108
+ ## SVG craft
109
+
110
+ - Write sets as TypeScript functions returning SVG strings (template literals, small helpers like
111
+ `rect(x, y, w, h, fill)`), so dimensions are computed from the floor line and the cast scale.
112
+ - Shared stroke attributes once per group: `<g stroke="#2b2238" stroke-width="3" stroke-linejoin="round">`.
113
+ - Unique gradient ids per set (`nightSky`, not `g`): every layer lands in one SVG document.
114
+ - Repetition (tiles, stars, trees) with `Array.from`, positions varied deterministically
115
+ (`(i * 263) % W`), never `Math.random()` (renders must be deterministic).
116
+ - Text in a set (chalkboard, shop sign): `<text>` with a font list ending in a generic family; the
117
+ renderer substitutes what is installed, so check the still.
118
+ - Light sources: draw the source (bulb, window, screen) in the art and put the point light's `x`,
119
+ `y` exactly on it; give a prop's light the prop's parallax.
@@ -0,0 +1,92 @@
1
+ # Cartoon effects, shake and transitions
2
+
3
+ From `FX_TYPES` / `CAPTION_STYLES` (`packages/core/src/fx.ts`) and the `fx`, `shake` and
4
+ `transition` actions in `packages/core/src/format/schema.ts`. Spec:
5
+ [FORMAT.md §3.4](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#34-cartoon-effects-fx).
6
+ These are the **only** valid `type` values.
7
+
8
+ ## The `fx` action
9
+
10
+ ```jsonc
11
+ { "at": 1.2, "action": "fx", "type": "surprise", "actor": "pip" }
12
+ { "at": 1.1, "action": "fx", "type": "dust", "actor": "pip", "anchor": "origin" }
13
+ { "at": 1.1, "action": "fx", "type": "dust", "prop": "crate" }
14
+ { "at": 2.3, "action": "fx", "type": "sparkle", "x": 1060, "y": 400 }
15
+ ```
16
+
17
+ | Field | Notes |
18
+ |---|---|
19
+ | `type` | One of the 22 below |
20
+ | `actor` | Attach to an actor: follows, flips and scales with it |
21
+ | `anchor` | Actor anchor (default `head` if the rig has it); `"origin"` = between the feet |
22
+ | `offset` | `[x, y]` from the anchor, character setup space |
23
+ | `prop` | At a prop, following it (unknown id = error) |
24
+ | `x`, `y` | Scene point when not attached (screen point for screen-space fx) |
25
+ | `duration` | Override the default below |
26
+ | `scale` | Size multiplier (1) |
27
+ | `color` | Ink colour (default `#1D2833`) |
28
+ | `fill` | Secondary colour (drops, hearts, sparkles, flames, speed lines) |
29
+ | `text`, `style` | `caption` only: `style` is `title` \| `impact` \| `ko` \| `place` |
30
+ | `angle` | `speedLines` only: direction of travel, degrees (0 = right) |
31
+
32
+ Start a reaction fx ~0.05 s before the reaction; time physics fx (`dust`, `impact`) from a rendered
33
+ still of the moment the body lands.
34
+
35
+ ### Emanata (in the scene, attached or at a point)
36
+
37
+ | `type` | Look | Use | Default s |
38
+ |---|---|---|---|
39
+ | `surprise` | Strokes shooting out above the head | Surprise, realization | 0.7 |
40
+ | `exclaim` | Wobbling "!" | Alarm, sudden idea | 0.9 |
41
+ | `question` | Bobbing "?" | Confusion | 1.2 |
42
+ | `sweat` | Drop sliding down the head | Nervousness | 1.4 |
43
+ | `sparkle` | Twinkling four-point stars | Admiration, magic, clean, a light coming on | 1.2 |
44
+ | `dust` | Puffs from the feet (`anchor: "origin"`) or a prop | Landing, braking, running off, a crate hitting the floor | 0.6 |
45
+ | `hearts` | Hearts floating up | Love, delight | 1.6 |
46
+ | `zzz` | Rising Z's | Sleep, boredom | 2.4 |
47
+ | `anger` | Pulsing cross vein | Annoyance | 1.0 |
48
+ | `impact` | Burst of rays | Hits, bumps | 0.35 |
49
+ | `gloom` | Wavy lines over the head | Exhaustion, sadness | 1.8 |
50
+ | `notes` | Music notes drifting up | Singing, a radio playing (at a prop) | 2.0 |
51
+ | `stars` | Stars circling the head | Dizziness | 1.6 |
52
+ | `lightbulb` | Glowing bulb popping up | An idea | 1.2 |
53
+ | `birds` | Little birds flying across, left → right | A sunny day, birdsong (set dressing!) | 3.2 |
54
+
55
+ Glyph fx (`question`, `exclaim`, `zzz`, `notes`) never mirror: on a flipped actor they move side
56
+ but stay readable.
57
+
58
+ ### Anime effects
59
+
60
+ | `type` | Space | Look | Use | Default s |
61
+ |---|---|---|---|---|
62
+ | `focusLines` | screen | Wedges converging on the centre, new pattern every 2 frames (`color`) | Shock, reveal, shout | 1.2 |
63
+ | `speedLines` | screen | Streaks across the frame (`angle`, `fill`) | A dash | 0.8 |
64
+ | `impactFrame` | screen | Whole frame white then black (`fill`, `color`) | The instant a hit lands | 0.14 |
65
+ | `caption` | screen | `text` in a `style`: `title` (big yellow), `impact` (red, shaking), `ko` (huge), `place` (italic name sliding in bottom left) | Title cards, place names | 2 |
66
+ | `burst` | scene | Jagged yellow star, red heart, white core | A punch landing | 0.35 |
67
+ | `aura` | behind actor | Three layers of flickering flames (`fill`; `anchor: "origin"`) | Powering up | 3 |
68
+ | `ghost` | scene | Little ghost floating up (`anchor: "origin"`) | Comic K.O. | 4 |
69
+
70
+ A `place` caption is the cheapest way to name a location when a set first appears.
71
+
72
+ ## `shake`
73
+
74
+ `{ "at": t, "action": "shake", "duration": 0.5, "amount": 10, "frequency": 12 }` — seeded camera
75
+ noise that fades out. 4–8 px for a thud, 15–20 for a punch.
76
+
77
+ ## In-scene `transition`
78
+
79
+ | Field | Values |
80
+ |---|---|
81
+ | `type` | `fade` \| `iris` \| `wipe` \| `flash` |
82
+ | `mode` | `outIn` (default: cover then uncover), `out` (cover), `in` (uncover) |
83
+ | `duration` | seconds |
84
+ | `color` | cover colour |
85
+ | `direction` | `wipe` only: `left` \| `right` (default) \| `up` \| `down` |
86
+ | `target` | `iris` centre: actor id (its posed head), prop id or `[x, y]` (default screen centre) |
87
+
88
+ Open a scene with `mode: "in"` at `at: 0`, close it with `mode: "out"` ending at `duration`
89
+ (`at = duration − transition duration`). End an episode beat with an `iris` out on the
90
+ character who has the last word. Between scenes of a `toon-sequence`, use the shot
91
+ `transition` instead (`cut`, `crossfade`, `fade`, `iris`, `wipe`, `flash`): see
92
+ [FORMAT.md §4](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#4-sequence-document-sequencejson).
@@ -0,0 +1,93 @@
1
+ # Lighting and camera
2
+
3
+ From `LightingSchema`, the `camera` action and the scene `camera` in
4
+ `packages/core/src/format/schema.ts`; defaults from `packages/core/src/lighting.ts` and
5
+ [FORMAT.md §3.0 and §3.5](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#30-lighting).
6
+
7
+ ## Lighting
8
+
9
+ All of it is plain SVG (masks, gradients, blend modes): deterministic, works in browsers,
10
+ Remotion and `rsvg-convert`.
11
+
12
+ | Block | Fields (default) | Effect |
13
+ |---|---|---|
14
+ | `ambient` | `color` (`#241A4D`), `opacity` (0) | Multiply layer over the whole frame. Point lights cut through it with a radial falloff |
15
+ | `lights[]` | `id`, `type` (`point` \| `directional`) | Up to you how many; ids are referenced by channels and `shading.light` |
16
+ | — point | `x`, `y` (0), `radius` (600 px), `glow` (0.6), `color` (`#FFE6B0`), `intensity` (1), `parallax` (1), `flicker?` | Additive radial glow (screen blend) of `glow × intensity`; opens the ambient |
17
+ | — directional | `angle` (90 = travelling down, from above), `glow` (0), `color`, `intensity` | No glow; the key light for character shading |
18
+ | — `flicker` | `amount` (0–1, intensity lost at most), `speed` (6 changes/s) | A TV, a candle, a fire; deterministic by time |
19
+ | `shading` | `light` (key id, default the first light), `color` (`#2A2152`), `opacity` (0.28), `rim` (key colour), `rimOpacity` (0.45), `offset` (9 px), `inset` (3.5 px), `crowd?`, `minHeight` (90 px) | Cel shading on actors: shadow crescent away from the key, rim light on the lit side. **Only when the block exists.** `crowd: n`: with more than n lit actors on screen, no rim (cheaper). Actors shorter than `minHeight` on screen get none |
20
+ | `grade` | `color`, `opacity` (0), `blend` (`soft-light`; also `normal`, `multiply`, `screen`, `overlay`, `color`, `color-dodge`) | Full-frame colour grade |
21
+ | `vignette` | `color` (`#000`), `opacity` (0) | Darkened frame edges |
22
+
23
+ `angle` is the direction the light **travels**: 0 → to the right (light from the left), 90 → down
24
+ (from above), 180 → to the left (from the right). A key light from a window on the left of the
25
+ frame: `angle` ≈ 20–60. Match it to the light sources you drew.
26
+
27
+ ### Recipes
28
+
29
+ | Mood | Lighting |
30
+ |---|---|
31
+ | Day, interior | directional key (`glow: 0`), `shading` opacity ~0.2, warm `grade` soft-light 0.1 |
32
+ | Golden hour | point `sun` low near the horizon (parallax ≈ the sun layer's), orange glow 0.4–0.5, key from the sun's side, `grade` `#ffb86b` 0.12, light vignette |
33
+ | Night exterior | `ambient` deep blue 0.45–0.55, a point light per lamp/window (`glow` 0.4–0.6, radius ≈ its reach), directional key `glow: 0`, `rim` = lamp colour, vignette 0.35 |
34
+ | TV room at night | ambient 0.5, point light at the screen with `flicker` 0.15–0.3, cool colour |
35
+ | Lightning / camera flash | `light` action on `lighting.ambient.opacity` to 0 for 0.05 s and back, or the `flash` transition |
36
+
37
+ ### Animating light
38
+
39
+ The `light` action: `{ "at": 2, "action": "light", "channel": "lights.bulb.intensity", "value": 1.3, "duration": 0.6 }`
40
+ (`ease` default `sineInOut`; `duration` 0 = a switch). Channels:
41
+ `lights.<id>.x|y|angle|color|intensity|radius|glow`,
42
+ `lighting.ambient.color|opacity`, `lighting.shading.color|opacity|rim|rimOpacity|offset|inset`,
43
+ `lighting.grade.color|opacity`, `lighting.vignette.color|opacity`. Hex colours interpolate.
44
+ Sunrise = sun intensity up + ambient opacity down + grade colour shift, over seconds.
45
+
46
+ Cost: shading is the most expensive part of a frame without a GPU (~30 ms per lit actor). Leave it
47
+ off scenes that do not need it; set `crowd` on crowd sets.
48
+
49
+ Director scenes change time of day with a `light` beat `mood` (`morning` … `night`), which also
50
+ swaps the set's night art and lamps: see
51
+ [DIRECTOR.md "Light moods"](https://github.com/denerFernandes/animeStudio/blob/master/docs/DIRECTOR.md#light-moods).
52
+
53
+ ## Camera
54
+
55
+ ### Scene `camera` (the base)
56
+
57
+ `x`, `y` (the scene point at the frame centre; default the frame centre), `zoom` (1),
58
+ `rotation` (degrees), `handheld` (px), `dolly`, `focus`, `blur`, `focusRange`, `motionBlur`,
59
+ `bounds: [minX, minY, maxX, maxY]` (the view never shows outside it — set it to the drawn world).
60
+ Tracks `camera.<channel>` are the base before the first camera action.
61
+
62
+ ### The `camera` action
63
+
64
+ Each action starts from where the camera actually is (director model): nothing ever jumps unless
65
+ you cut with `duration: 0`.
66
+
67
+ | Kind | Fields | Notes |
68
+ |---|---|---|
69
+ | Move / zoom / roll | `x`, `y`, `zoom`, `rotation`, `duration` (1), `ease` (`sineInOut`) | `duration: 0` is a cut |
70
+ | Curved move | `path: [[x, y], …]`, `duration`, `ease` | Smooth curve through the points at constant speed |
71
+ | Follow | `follow: actorId` (`null` stops and holds), `offset` `[dx, dy]`, `lag` (0.3 s), `axes` (`x` \| `xy`, default `x`), `deadZone` `[halfW, halfH]`, `lookAhead` (s), `blend` (0.6 s), `zoom?`, `duration?` | Critically damped spring, baked; lead the walk with `offset` / `lookAhead` |
72
+ | Frame | `frame: [ids]` (actors/props; `null` stops), `padding` (80), `minZoom`, `maxZoom`, `lag` (0.4), `blend`, `band: [top, bottom]` (frame sideways only), `on` (`body` \| `face`), `duration?` | Two-shots and groups without computing coordinates; `on: "face"` for close-ups |
73
+ | Punch-in | `punch` (> −1, e.g. 0.1–0.2), `duration` (0.4) | A zoom pulse with a springy settle |
74
+ | Handheld | `handheld` px | Organic drift + slight roll; 3–6 px for life |
75
+ | Dolly zoom | `dolly` | > 0 pushes the background away while the subject keeps its size; combine with a zoom in |
76
+ | Depth of field | `blur` (max px), `focus` (a parallax depth or an actor/prop/layer id), `focusRange` (0.5) | Animate `focus` for a rack focus |
77
+ | Motion blur | `motionBlur` 0–1 | For fast pans; for a hand-drawn look use `animation.smear` instead |
78
+
79
+ `shake` is a separate action: `{ "at": 1.1, "action": "shake", "duration": 0.5, "amount": 10, "frequency": 12 }`
80
+ (defaults shown), seeded noise that fades out.
81
+
82
+ Order applied each frame: base tracks → camera segments → punch → handheld → shake → bounds.
83
+
84
+ ### Shot grammar for sets
85
+
86
+ - Open on a **wide** establishing frame of the set (zoom 1, everything readable), then go closer.
87
+ - Wide ≈ zoom 1 (whole figures, floor visible); medium ≈ zoom 1.6–1.8 (knees/waist up);
88
+ close-up ≈ zoom 2.2–3 or `frame` with `on: "face"`.
89
+ - Keep screen direction (who is left of whom) across cuts.
90
+ - Hide a reveal off frame, then pan to it when the character notices it.
91
+ - Follow walks with `follow` + `deadZone` + `lookAhead` + `bounds`; frame dialogues with `frame`.
92
+ - Parallax sells a camera move: a pan over a set with sky 0, hills 0.4, floor 1 and a
93
+ foreground bush 1.25 reads as depth. A move over a single flat layer reads as a slide.
@@ -0,0 +1,132 @@
1
+ # Scene fields for sets
2
+
3
+ Every field below is in `SceneSchema` (`packages/core/src/format/schema.ts`). Objects are strict:
4
+ an unknown key is an error. Full spec:
5
+ [FORMAT.md §3](https://github.com/denerFernandes/animeStudio/blob/master/docs/FORMAT.md#3-scene-document-scenejson).
6
+
7
+ ## Root
8
+
9
+ | Field | Type | Notes |
10
+ |---|---|---|
11
+ | `$schema` | string | Optional, e.g. `"../schemas/scene.schema.json"` for editor help |
12
+ | `format` | `"toon-scene"` | Required |
13
+ | `version` | `1` | Required |
14
+ | `width`, `height` | positive integers | 1920×1080 (16:9), 1080×1920 (9:16), 1080×1080 (1:1) |
15
+ | `fps` | positive number | 30 typical, 24 filmic |
16
+ | `duration` | seconds | Required |
17
+ | `background` | CSS colour | Painted under everything (fallback; layers usually cover it) |
18
+ | `characters` | `{ id: path }` | Paths relative to the scene file. In TS you may pass any string and give parsed docs in `assets.characters` |
19
+ | `audio`, `lipsync` | `{ id: path }` | Sound files and mouth-cue JSON |
20
+ | `world` | object | Below |
21
+ | `camera` | object | Base camera, see [lighting-camera.md](lighting-camera.md) |
22
+ | `lighting` | object | See [lighting-camera.md](lighting-camera.md) |
23
+ | `animation` | object | Cartoon timing (`twos`, `holds`, `smear`, `arcs`, `boil`): see the animation skill |
24
+ | `layers`, `actors`, `props` | arrays | Below |
25
+ | `tracks` | `{ channel: keyframes }` | Keyframes `[t, value]`, `[t, value, ease]` or `{ t, v, ease? }` |
26
+ | `script` | actions | `at` seconds each |
27
+
28
+ ## Placement (layers, actors, props)
29
+
30
+ `x`, `y`, `rotation` (degrees), `scale` (number or `[sx, sy]`), `z` (draw order, default 0),
31
+ `parallax` (1 normal, 0 screen-fixed, <1 far, >1 near), `opacity` (0–1).
32
+
33
+ How parallax works (`viewMatrix`): an item at parallax p is seen by a camera at
34
+ `lerp(frameCentre, camera, p)` with zoom `camera.zoom^p`. So at p = 0 it never moves; at p = 0.5
35
+ it travels half as far and zooms less; at p = 1.2 it travels farther than the actors. A camera at
36
+ the frame centre with zoom 1 shows every depth exactly where it was drawn, so draw all layers in
37
+ the same scene coordinates and let parallax spread them when the camera moves.
38
+
39
+ ## Layer
40
+
41
+ `{ id, art, ...placement }`. `art` is SVG markup (a string). Use for everything that never
42
+ interacts: sky, walls, floors, far scenery, foreground framing.
43
+
44
+ ## Actor (the set side of it)
45
+
46
+ `{ id, character, x, y, scale, z, flip?, ground?, palette?, seed?, shading?, twos?, holds?, rotation?, parallax?, opacity? }`
47
+
48
+ - `x`, `y`: the point between the feet. `flip: true` faces left.
49
+ - `shading: false` opts out of cel shading (a TV screen, a sign rig).
50
+ - `holds: 0`, `twos: false` for inanimate rigs used as furniture/fixtures (a clock, a car).
51
+
52
+ ## Prop
53
+
54
+ `{ id, art, back?, body?, ground?, cord?, ...placement }`
55
+
56
+ - `art`: SVG around the prop's origin. `back`: its other side (only used by a `grab` `fit` with
57
+ `face`, e.g. a phone held up).
58
+ - Tracks: `props.<id>.x|y|rotation|scale|opacity` (absolute; non-dynamic props), `props.<id>.z`
59
+ (stepped). A prop at opacity 0 is not drawn.
60
+ - `ground`: same as an actor's — the prop's y follows a surface.
61
+
62
+ ### body (rigid, needs `prepareScene` from `@anime-studio/rigid`)
63
+
64
+ | Field | Default | Notes |
65
+ |---|---|---|
66
+ | `type` | — | `dynamic` (simulated), `static` (fixed collider), `kinematic` (follows its tracks, pushes others) |
67
+ | `shape` | — | `{ "circle": r }` or `{ "box": [w, h] }` (full width/height), centred on the origin |
68
+ | `restitution` | 0.3 | Bounciness |
69
+ | `friction` | 0.5 | |
70
+ | `density` | 1 | |
71
+ | `velocity` | — | `[vx, vy]` px/s at t = 0 |
72
+ | `angularVelocity` | — | deg/s at t = 0 |
73
+
74
+ `world`: `gravity` (`[0, 1800]` default, px/s²), `ground` (a flat floor y for bodies only),
75
+ `walls` (true: invisible walls just outside both frame edges), `rate` (simulation Hz, 120),
76
+ `surfaces` (below; bodies collide with them too). Actions: `impulse` (`prop`, `vector` px/s),
77
+ `grab`, `release` (`velocity?`, `keep?`), `put`. Character bones with `colliders` push bodies.
78
+ An invisible static floor or wall is a prop with `art: ""` and a static `body`.
79
+
80
+ ### cord
81
+
82
+ A string or cord drawn every frame from the prop to something.
83
+
84
+ | Field | Notes |
85
+ |---|---|
86
+ | `point` | Where it is tied on the prop (art coordinates, default origin) |
87
+ | `to` | `[x, y]` scene point, `{ actor, anchor }`, `{ prop, point? }`, or `"up"` (out of the top of the picture: a hanging prop) |
88
+ | `length` | Rest length: shorter than the distance stretches it, longer sags |
89
+ | `coils` | Loops of a coiled cord (0 = plain string), `radius` (7) |
90
+ | `width` (3), `color`, `z` | Look and depth |
91
+ | `cut` | Time it snaps |
92
+
93
+ ## Ground surfaces
94
+
95
+ ```json
96
+ "world": { "surfaces": [{ "id": "floor", "path": "M-500 930 C 200 930 700 820 1150 830 S 1900 900 2500 880" }] }
97
+ ```
98
+
99
+ - `path`: SVG path of the walkable **top edge**, scene space, drawn **left to right**. Sampled into
100
+ a polyline; past its ends the height is clamped, so extend it beyond the camera's reach.
101
+ - On an actor or prop: `"ground": { "surface": "floor", "offset": 4, "feet": ["footL", "footR"] }`.
102
+ `offset` sinks the feet (px); `feet` are IK chain ids adapted to the slope. The `y` you give is
103
+ then ignored in favour of the surface at the current `x`.
104
+ - Several surfaces are fine (a branch above the floor); each actor picks one.
105
+
106
+ ## Scene channels (tracks / `set`)
107
+
108
+ | Channel | Value |
109
+ |---|---|
110
+ | `camera.x|y|zoom|rotation` | absolute |
111
+ | `camera.handheld|dolly|focus|blur|focusRange|motionBlur` | see lighting-camera.md |
112
+ | `layers.<id>.x|y|rotation|scale|opacity` | absolute; `layers.<id>.z` stepped |
113
+ | `props.<id>.x|y|rotation|scale|opacity` | absolute; `props.<id>.z` stepped |
114
+ | `actors.<id>.x|y|rotation|scale|opacity`, `.flip`, `.z` | placement |
115
+ | `lights.<id>.x|y|angle|color|intensity|radius|glow` | lighting |
116
+ | `lighting.ambient|shading|grade|vignette.<prop>` | lighting |
117
+
118
+ Tracks hold their first key before it: give a changing channel an explicit key at t = 0.
119
+
120
+ ## Making a set reusable (TypeScript)
121
+
122
+ Return everything a scene needs from one function and spread it in:
123
+
124
+ ```ts
125
+ import type { LayerDef, LightingDef, PropDef, SurfaceDef } from "@anime-studio/core";
126
+ interface CartoonSet { width: number; height: number; background: string; floor: number;
127
+ marks: Record<string, number>; layers: LayerDef[]; props?: PropDef[]; surfaces?: SurfaceDef[]; lighting?: LightingDef }
128
+ ```
129
+
130
+ See `examples/sets.ts`. Director sets (`SetDef`: layers, ground `{ near, far? }`, `depthScale`,
131
+ marks, fixtures, furniture, bounds, lighting, moods) are richer: see
132
+ [DIRECTOR.md "Staging"](https://github.com/denerFernandes/animeStudio/blob/master/docs/DIRECTOR.md#staging).