@algorisys/tinyfly 0.106.1 → 0.108.0

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 (47) hide show
  1. package/README.md +31 -13
  2. package/docs/character-appearance.md +187 -1
  3. package/docs/editor-guide.md +1 -1
  4. package/docs/examples.md +1 -1
  5. package/docs/getting-started.md +1 -1
  6. package/docs/gsap-compat.md +1 -1
  7. package/docs/llm-guide.md +45 -2
  8. package/docs/maps.md +2 -2
  9. package/docs/teaching.md +1 -1
  10. package/lib/addons/characters.js +4985 -4280
  11. package/lib/browser/tinyfly.iife.js +14 -14
  12. package/lib/browser/tinyfly.js +7155 -6450
  13. package/lib/browser/tinyfly.umd.js +14 -14
  14. package/lib/types/characters/body/organic-body.d.ts +56 -0
  15. package/lib/types/characters/body/organic-draw.d.ts +5 -0
  16. package/lib/types/characters/body/organic-geometry.d.ts +25 -0
  17. package/lib/types/characters/capabilities.d.ts +2 -0
  18. package/lib/types/characters/character.d.ts +15 -2
  19. package/lib/types/characters/hair-follow.d.ts +3 -2
  20. package/lib/types/characters/hands/draw-cartoon-hand.d.ts +4 -0
  21. package/lib/types/characters/head/ears.d.ts +2 -0
  22. package/lib/types/characters/head/face.d.ts +8 -4
  23. package/lib/types/characters/head/facial-hair.d.ts +4 -0
  24. package/lib/types/characters/head/flowing-hair.d.ts +55 -0
  25. package/lib/types/characters/head/glasses.d.ts +2 -0
  26. package/lib/types/characters/head/hair-lock-draw.d.ts +5 -0
  27. package/lib/types/characters/head/hair-lock.d.ts +36 -0
  28. package/lib/types/characters/head/hair.d.ts +67 -3
  29. package/lib/types/characters/head/head-look.d.ts +6 -2
  30. package/lib/types/characters/head/head-shape.d.ts +4 -0
  31. package/lib/types/characters/head/index.d.ts +1 -0
  32. package/lib/types/characters/head/shell.d.ts +2 -2
  33. package/lib/types/characters/index.d.ts +5 -0
  34. package/lib/types/characters/look/pen.d.ts +1 -0
  35. package/lib/types/characters/look/skin-shading.d.ts +4 -0
  36. package/lib/types/characters/polyline.d.ts +12 -0
  37. package/lib/types/characters/rig/skeleton.d.ts +2 -0
  38. package/lib/types/characters/sketch.d.ts +54 -0
  39. package/lib/types/characters/soft-cartoon-cast.d.ts +166 -0
  40. package/lib/types/characters/wardrobe/basic-outfit.d.ts +5 -1
  41. package/lib/types/characters/wardrobe/leaf-outfit.d.ts +18 -0
  42. package/lib/types/characters/wardrobe/outfit-preset.d.ts +6 -0
  43. package/lib/types/compat/gsap/playhead-crossings.d.ts +47 -0
  44. package/llms-full.txt +251 -14
  45. package/llms.txt +29 -29
  46. package/package.json +1 -1
  47. package/skills/tinyfly/SKILL.md +32 -1
package/README.md CHANGED
@@ -54,7 +54,8 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
54
54
  - **Code-drawn targets** - A `custom` canvas target draws with code (characters, charts, props) while the timeline animates its position, opacity and its own `props`, so drawing stays code and timing stays JSON
55
55
  - **Immediate mode too** - A scene's `background` and `draw(ctx, { time })` functions paint each frame directly, Cairo/Processing-style, and mix freely with timeline targets
56
56
  - **Timing from narration** - `planNarration()` lays spoken lines out from their clip lengths (lead, gap, tail) into cues, scene spans and markers; `voiceNarration()` measures recorded clips with ffmpeg and writes the sample-aligned narration WAV
57
- - **Characters** - A poseable stick figure (`@algorisys/tinyfly/characters`): named poses, facial expressions (brows, eyes that widen, close and look around, mouth shapes), squash and stretch, rubber-hose limbs, blending, walk cycles and talking, all driven by timeline tracks. **Characters v2**: one skeleton in 3D drawn flat, turning front to side to back, resting on whatever touches the ground, reaching for points, in clean, pencil or silhouette looks, and a 🧍 Character element in the editor you pose and keyframe. **Character appearance**: 34 hairstyles, 20 facial-hair styles, glasses, hats and ears as plain data on the head (they turn with it through all eight views), builds from toddler to tall, a recurring cast (`castMember`), 30 expressions with blush, tears and sweat, and hair that swings after a turn or a run and settles (`hairFollowTracks` keys the lag from the character's own tracks, so drawing stays stateless); four-legged animals' ears lay back on a run the way their tails already trail. Clothes are data too (`outfit.over`: an apron, a lab coat, a hoodie, a cardigan, overalls, a sari; boots), a mouth opens on teeth and a tongue, feet come in shapes, two people hug and help each other up (`embrace`, `helpUp`), and a cane in the hand or a wheelchair to ride are accessories any character can have, not part of an age ([guide](docs/character-appearance.md))
57
+ - **Soft cartoon story characters** - Opt-in `figure: 'organic'` adds filled shoulders, chest/waist/hip contours, supple limbs, small posed hands and deterministic cel shading on the existing rig. JSON body profiles keep anatomy independent of outline width; one skin colour covers body, face and hands under scene lighting and fog, and cel shading respects inherited opacity. Foreground arms stay over waist garments in 2D and globally sorted 3D scenes, with only foreground arms promoted to garment depths so leaning head, neck, torso and legs retain world-object occlusion. Transparent organic skin keeps exposed body, head and both hand variants outline-only in every look. Editor Skin and Line controls resolve and edit imported body colour overrides. Leaf garment options are validated and copied at construction. Actor names are checked at runtime, and each head contour is reused for filling, shading and face clipping within a draw. Editable adult and child `softCartoonCharacter` presets, flowing hair, editable everyday/formal/casual/leaf clothing and the existing script, reach and lip-sync APIs support original stories. Try [**Soft Cartoon Characters**](https://tinyfly.app/examples/live-organic-characters): adults, children or an adult and child, with seven actions, face/hair controls and independent outfit editing. `outfitPreset()` supplies JSON wardrobe defaults; shirts, T-shirts, blouses, dresses, trousers, jeans, cargo, shorts, skirts, sleeves, collars, ties and colours remain editable. See [the appearance guide](docs/character-appearance.md).
58
+ - **Characters** - A poseable stick figure (`@algorisys/tinyfly/characters`): named poses, facial expressions (brows, eyes that widen, close and look around, mouth shapes), squash and stretch, rubber-hose limbs, blending, walk cycles and talking, all driven by timeline tracks. **Characters v2**: one skeleton in 3D drawn flat, turning front to side to back, resting on whatever touches the ground, reaching for points, in clean, pencil or silhouette looks, and a 🧍 Character element in the editor you pose and keyframe. **Character appearance**: 41 hairstyles, including soft sweeps, flowing bobs and cascading waves with scalp-attached curved locks and individual flexibility, 20 facial-hair styles, glasses, hats and ears as plain data on the head (they turn with it through all eight views), builds from toddler to tall, a recurring cast (`castMember`), 30 expressions with blush, tears and sweat, and hair that swings after a turn or a run and settles (`hairFollowTracks` keys the lag from the character's own tracks, so drawing stays stateless); four-legged animals' ears lay back on a run the way their tails already trail. Clothes are data too (`outfit.over`: an apron, a lab coat, a hoodie, a cardigan, overalls, a sari; boots), a mouth opens on teeth and a tongue, feet come in shapes, two people hug and help each other up (`embrace`, `helpUp`), and a cane in the hand or a wheelchair to ride are accessories any character can have, not part of an age ([guide](docs/character-appearance.md))
58
59
  - **Dance and flips** - The stick figure dances disco, hip hop, breaking toprock, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap (foot strikes as data, for tap sounds) and popping (side glide, moonwalk, forward glide, which travel with the planted foot staying put), and does front, back, layout, scissor and side flips, cartwheels, back handsprings, split leaps, toe touches and full splits. Wrists, ankles, foot turn-out, whole-body `spin` and `rise` are pose fields; moves are keyed in beats, so any tempo plays them; styles, grooves and routines are plain JSON (`danceFrame()`, `danceTracks()`, `flipPose()`, `flipTracks()`). In the editor a 🧍 Character dances from the playhead, in time with the music: an Audio element's tempo is detected (`detectTempo()`) or tapped, the timeline shows its beats and bars, and keyframes snap to them. Native v2 garba (two/three clap) and dandiya add body-local poses, circle formations with planted toes, paired stick-tip contacts, and timed full spins (`humanDanceFrame`, `danceCircleTracks`, `meetDandiya`, `characterScript3D`). Sparse custom keys keep numeric hand and pose values through JSON playback; rolled circles preserve native yaw-before-roll and foot grounding. Foot IK preserves authored hip turn-out for ankle and toe plants. Scripted dance entry preserves relaxed or explicitly posed hands through preceding holds. Script action boundaries retain preceding easing; festive examples solve contacts with their rendered body options. See [docs/dance.md](docs/dance.md)
59
60
  - **Maps** - Animated maps on OpenStreetMap tiles or an offline world outline (also in pencil): the camera flies in, pins drop, routes draw themselves while a marker travels them; a 🗺 Map element in the editor with a one-click trip
60
61
  - **Pencil sketch style** - Hand-drawn strokes with line boil (`sketch` style, `sketchPen`) for a pencil-test, Pencilmation-like look, on the stick figure and on canvas rect / circle / line / path shapes (also from the editor's Properties panel); a `drawOn` track draws any of those shapes on; the wobble is seeded by time, so renders stay deterministic
@@ -157,6 +158,19 @@ stick figure also supports `style.armLength` (default `1`).
157
158
  Clothed characters keep their upper legs behind shirt hems through turns and
158
159
  moving poses; shared garments follow the same order in 2D and camera views.
159
160
 
161
+ The [Flowing Cartoon Hair](https://tinyfly.app/examples/live-flowing-hair)
162
+ example compares `softSweep`, `flowingBob` and `cascadingWaves`: curved locks
163
+ fit the scalp and flex after quick head turns, then settle. Choose a face type
164
+ and hairstyle; the selected combination is highlighted in the animation and
165
+ shown in eight resting views. Compare simple and expressive round faces,
166
+ soft angular features with rounded cheeks and a fuller chin, broad jaws and
167
+ older expressive faces. Change colours
168
+ and drawing looks, or use the same styles with
169
+ `characterScript` and `hairFollowTracks` to act out a story.
170
+ Follow-through keeps lock centers and ribbon edges outside the skull while
171
+ roots stay pinned and free hanging tips retain their motion. Scalp-relative
172
+ clearance stays continuous even when motion would collapse a lock center.
173
+
160
174
  Every catalog example has an **Open full page** action. It opens a shareable
161
175
  `/examples/<id>/full` URL in a new tab, with the animation and its controls
162
176
  filling the page. [Open the manga example full page](https://tinyfly.app/examples/live-manga-cast/full).
@@ -261,7 +275,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
261
275
  itself.
262
276
 
263
277
  ```html
264
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly.iife.js"></script>
278
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly.iife.js"></script>
265
279
  <script>
266
280
  tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
267
281
 
@@ -297,7 +311,7 @@ A teaching figure needs no code at all:
297
311
  <script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
298
312
  <figcaption>Appending to a full slice</figcaption>
299
313
  </figure>
300
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
314
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
301
315
  ```
302
316
 
303
317
  See [Teaching Animations](docs/teaching.md).
@@ -396,7 +410,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
396
410
  <div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
397
411
  </div>
398
412
 
399
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-player.iife.js"></script>
413
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-player.iife.js"></script>
400
414
  <script>
401
415
  tinyfly.play('#animation', './animation.json', { loop: -1 })
402
416
  </script>
@@ -505,7 +519,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
505
519
  <svg viewBox="0 0 720 200">…</svg>
506
520
  <script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
507
521
  </figure>
508
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
522
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
509
523
  ```
510
524
 
511
525
  ### Audio / Video Sync
@@ -749,7 +763,7 @@ npm run build
749
763
  ```
750
764
 
751
765
  The private repository's `.no-mistakes.yaml` selects the Codex reviewer and
752
- uses `npm run test:run -- --maxWorkers 2` for tests and
766
+ builds the add-on bundles before `npm run test:run -- --maxWorkers 2` for tests and
753
767
  `npx tsc -p tsconfig.app.json --noEmit` for its lint/type check.
754
768
  It is excluded from the OSS mirror; the project needs no runtime configuration
755
769
  for this validation.
@@ -795,20 +809,24 @@ load.
795
809
 
796
810
  ### Test Coverage
797
811
 
798
- `npm test` runs 2,197 unit tests in 127 files, all passing:
812
+ `npm test` runs 3,610 unit tests in 234 files, all passing. The Organic
813
+ Characters browser suite checks 74 desktop/mobile scenarios per browser.
799
814
 
800
815
  | Area | Tests |
801
816
  |---|---|
802
- | Engine (`src/engine`: timeline, easing, paths, text, exports, serialization) | 521 |
803
- | Editor (`src/editor`: stores, utils, presets, AI, samples) | 409 |
804
- | GSAP-style API (`src/compat/gsap`) | 332 |
805
- | Examples page, GSAP-style demos and showcases (`src/examples`) | 302 |
806
- | Render adapters (`src/adapters`) | 134 |
817
+ | Engine (`src/engine`: timeline, easing, paths, text, exports, serialization) | 601 |
818
+ | Editor (`src/editor`: stores, utils, presets, AI, samples) | 600 |
819
+ | GSAP-style API (`src/compat/gsap`) | 335 |
820
+ | Examples page, GSAP-style demos and showcases (`src/examples`) | 436 |
821
+ | Render adapters (`src/adapters`) | 197 |
822
+ | Characters, maps and 3D scenes (`src/characters`, `src/maps`, `src/scene-3d`) | 865 |
807
823
  | Interactive course (`src/learn`) | 211 |
808
824
  | Drivers and interaction (`src/drivers`, `src/interaction`) | 136 |
809
825
  | Player, media sync, sequencer, teaching and scenarios (`src/player`) | 103 |
810
- | Docs viewer and `llms.txt` (`src/docs`) | 16 |
826
+ | Docs viewer and `llms.txt` (`src/docs`) | 18 |
811
827
  | Embeds, teaching kit, framework hooks, landing (`src/embed`, `src/teach`, `src/frameworks`, `src/landing`) | 33 |
828
+ | Headless rendering and audio (`src/headless`) | 63 |
829
+ | Entry boundaries | 2 |
812
830
 
813
831
  ## Contributing
814
832
 
@@ -35,6 +35,147 @@ drawCharacter(ctx, maya, humanPose({ ...HUMAN_EXPRESSIONS.embarrassed, turn: 0.5
35
35
  A plain figure (no `hair`, `facialHair`, `glasses`, `hat` or `ears`) draws
36
36
  exactly as it did before these options existed.
37
37
 
38
+ ## Organic cartoon bodies
39
+
40
+ Use `figure: 'organic'` for original, softly drawn story characters. The
41
+ existing human skeleton controls poses, reaching, ground contact and part
42
+ order. Filled contours supply shoulders, chest, waist, hips and shaped
43
+ limbs; dimensions are independent of the outline width.
44
+
45
+ ```js
46
+ import { character, softCartoonCharacter, characterScript, hairFollowTracks } from '@algorisys/tinyfly/characters'
47
+
48
+ const actor = character({
49
+ figure: 'organic', height: 320, skin: '#efbd96',
50
+ body: {
51
+ arm: [{ at: 0, width: 0.028 }, { at: 0.5, width: 0.018 },
52
+ { at: 0.7, width: 0.023 }, { at: 1, width: 0.012 }],
53
+ outline: { color: '#53372d', width: 1.5 },
54
+ shading: { mode: 'cel', light: [-0.8, -0.6], opacity: 0.17 },
55
+ },
56
+ face: { style: 'anime', shape: 'angular', jawRoundness: 1 },
57
+ hair: { style: 'flowingBob', color: '#38291f' },
58
+ outfit: { shirt: '#72958b', trousers: '#495a67' },
59
+ })
60
+ const friend = softCartoonCharacter('youngWoman', { height: 300 })
61
+ const story = characterScript('actor', actor, [
62
+ { do: 'walk', to: 240, for: 2200 },
63
+ { do: 'say', say: 'Let us explore!', for: 1800, mood: 'happy' },
64
+ ], { from: 60 })
65
+ story.tracks.push(...hairFollowTracks('actor', story.tracks, actor))
66
+ ```
67
+
68
+ `softCartoonCharacter` accepts only `youngMan`, `youngWoman`, `childBoy`
69
+ and `childGirl`; unknown actor names throw an error, including inherited
70
+ object keys such as `constructor`.
71
+
72
+ `body.torso`, `arm`, `leg` and `neck` are arrays of `{ at, width }`.
73
+ `at` increases from 0 to 1; `width` is a half-width fraction of character
74
+ height. Torso positions run hip to neck, arms shoulder to wrist, and legs
75
+ hip to ankle. Cubic centerlines pass through native elbow/knee joints with
76
+ interpolated width profiles. Options are copied at construction and can
77
+ travel as JSON. `body.depth` (0.2–1, default 0.55) sets torso side thickness.
78
+ `body.fill` overrides `skin` for all exposed body, face and palms; omit it
79
+ to keep one `skin` colour control. The editor's Skin and Line controls show
80
+ the resolved fill and outline colour; editing them also updates any existing
81
+ `body.fill` or `body.outline.color` override without changing other body options.
82
+
83
+ Default organic hands are small natural five-finger hands (`handSize: 0.073`).
84
+ Existing `hand.left.*` / `hand.right.*` tracks control palms, fists, pointing,
85
+ bends and wrist rolls. Foreground organic arms and hands draw together after
86
+ the torso and lower garments; rear arms remain behind them. Attached borders at shoulders, hips, wrists and ankles are hidden
87
+ where connected contours meet. This ordering also survives the 3D scene's
88
+ global depth sort, while separate world objects can still occlude the figure.
89
+ `characterPartsInView()` retains each part's physical `depth` and supplies
90
+ an organic `sortDepth` for painter ordering. Only foreground arms are promoted
91
+ to the nearest torso/leg garment depth; head, neck, torso, legs and rear arms
92
+ keep their physical depths. Scene integrations sort by `sortDepth ?? depth`, retaining array
93
+ order for ties. Fluid and stick parts retain their existing depth ordering.
94
+
95
+ Organic faces default to `face.projection: 'volume'`: feature centres follow
96
+ the head's 3D axes, both eyes stay readable in three-quarter views, the far
97
+ eye narrows toward profile, and opaque hair covers
98
+ eyes and brows. Features stay clipped inside the head through turns and nods.
99
+ The facial plane is flatter than the rounded rear cranium in profile.
100
+ With `face.nose: true`, a small nose projects from above the mouth and shapes
101
+ the turned silhouette without extending the chin.
102
+ `projection: 'cartoon'` retains the classic face slide used by fluid/stick.
103
+
104
+ Cel shading is clipped to moving skin in the clean look. `body.shading`
105
+ accepts `mode: 'cel' | 'none'`, screen-space `light: [x, y]`, `shadow`,
106
+ `opacity` and `highlight`. Seeking and headless rendering are deterministic.
107
+ Pencil and silhouette use their existing pens. Artist-authored painted
108
+ meshes remain a separate future capability.
109
+
110
+ Set `body.fill: 'none'` (or `skin: 'none'` without a body fill override) for
111
+ outline-only exposed body, head and hands in every look. Dot and articulated
112
+ hands omit skin fills and shading; clothing retains its own material.
113
+
114
+ Everyday shirts, sleeves, trousers, shorts and skirts follow organic anatomy.
115
+ `leafOutfit: { top: true, color: '#638c39', accent: '#87ae4e', length: 0.32 }`
116
+ selects attached leaf garments with curved shapes and veins; `top: false`
117
+ leaves the upper body uncovered. It requires organic mode.
118
+ `leafOutfitContours(joints, options)` exposes plain coverage geometry for
119
+ custom layers and exporters. Both wardrobes use native part depths.
120
+
121
+ `softCartoonCharacter('childBoy')` and `softCartoonCharacter('childGirl')`
122
+ provide original child presets with a larger head/body ratio, shorter arms
123
+ and legs, rounded torsos and smaller default heights (230 and 225 px).
124
+ All face, hair, clothes, skin and proportions remain editable; changing
125
+ `height` preserves the child anatomy. The same pose, script, hand, reaching
126
+ and lip-sync APIs work for adults and children.
127
+
128
+ The example at `/examples/live-organic-characters` includes adult, child and
129
+ adult/child pairs, face/hair
130
+ choices, independently editable everyday/formal/casual/leaf garments, seven actions, outline and skin controls,
131
+ shading, playback and scrubbing. Available in v0.108.0. See the
132
+ [contact sheet](model-sheet/organic-characters.png) and
133
+ [child character sheet](model-sheet/child-characters.png).
134
+ Close-up [head turns](model-sheet/organic-head-turns.png) exercise independent
135
+ `head.turn` at the story's body orientation.
136
+ `fluid` and `stick` keep their existing defaults and ink-based dimensions.
137
+
138
+ ## Everyday, Formal and Casual clothing
139
+
140
+ `outfitPreset(category, overrides)` returns fresh plain JSON options for
141
+ `character({ outfit })` or `softCartoonCharacter(name, { outfit })`.
142
+ The categories are `everyday`, `formal` and `casual`. Every garment works
143
+ with adult and child actors, regardless of gender.
144
+
145
+ ```js
146
+ import { softCartoonCharacter, outfitPreset } from '@algorisys/tinyfly/characters'
147
+
148
+ const formal = softCartoonCharacter('youngMan', {
149
+ outfit: outfitPreset('formal', { shirt: '#ece6db', trousers: '#354456', tie: '#7b3955' }),
150
+ })
151
+ const casual = softCartoonCharacter('youngWoman', {
152
+ outfit: outfitPreset('casual', { top: 'tshirt', bottom: 'shorts', trouserStyle: 'cargo' }),
153
+ })
154
+ const dress = softCartoonCharacter('childGirl', {
155
+ outfit: outfitPreset('formal', { top: 'dress', shirt: '#aa6b91', sleeves: 'none' }),
156
+ })
157
+ ```
158
+
159
+ - `top`: `tshirt`, `shirt` (button placket), `blouse` (V neckline) or `dress`.
160
+ Omit it to retain the original plain T-shirt. Shirts default to a collar;
161
+ an explicit `collar: false` removes it.
162
+ - `bottom`: `trousers`, `shorts` or `skirt`; `trouserStyle`: `plain`, `jeans`
163
+ (pockets and stitching) or `cargo` (thigh pockets). Details follow the
164
+ limbs and stay clipped inside the fabric.
165
+ - `shirt` and `trousers` remain top and bottom colours. A dress uses
166
+ `shirt` for both its bodice and skirt, overriding `bottom` and ignoring
167
+ the separate bottom colour. `sleeves` accepts `short`, `long` or `none`.
168
+ - `collar` is a boolean; `tie` is a colour or `null` to remove it. Changing a
169
+ formal preset to a different top removes its default collar and tie;
170
+ explicit accessory overrides take precedence.
171
+
172
+ The example's **Edit outfit** choice edits both characters or either actor
173
+ separately. Formal starts with a shirt/tie or blouse/skirt; Casual starts
174
+ with a T-shirt/jeans. All cuts remain selectable for either character.
175
+ The editor exposes the same presets and garment choices, saved with scene
176
+ JSON. [Clothing sheet](model-sheet/clothing-options.png), reproduced by
177
+ `examples/headless-video/clothing-options.mjs`.
178
+
38
179
  ## How it turns
39
180
 
40
181
  Hair, beards and hats are not flat drawings pasted on the face. Each is a
@@ -97,6 +238,11 @@ Medium and long hair: `pixie`, `bob`, `longBob`, `wavyBob`, `shoulderStraight`,
97
238
  `lowPonytail`, `highPonytail`, `ponytail`, `sidePonytail`, `topBun`, `lowBun`,
98
239
  `singleBraid`, `twinBraids`, `braids`.
99
240
 
241
+ Flowing cartoon hair: `softSweep`, `flowingBob`, `cascadingWaves`. These use
242
+ broad curved locks over a fitted scalp cap, with soft tapered ends and gentle
243
+ asymmetry. The bob and long waves include a narrowing supporting mass so the
244
+ locks overlap without gaps. Each description serves every head angle.
245
+
100
246
  Every style is the same few fields (`resolveHair(spec)` fills them all in):
101
247
 
102
248
  | Field | Meaning |
@@ -113,16 +259,45 @@ Every style is the same few fields (`resolveHair(spec)` fills them all in):
113
259
  | `part`, `strands` | A parting (degrees round from the middle of the face) and the detail lines: `none`, `part`, `sweep`, `combed`, `hanging`, `thin` |
114
260
  | `fill` | `solid`, or `stipple` (close-cropped: dots on the scalp) |
115
261
  | `ties` | Ponytails, buns and braids: `{ kind: 'ponytail' \| 'bun' \| 'braid', at: 'top' \| 'high' \| 'low' \| 'left' \| 'right', length?, size? }` |
262
+ | `locks` | Curved sections: `{ path, width, follow? }`; `width` is in head radii; `follow` scales their flex (default 1, 0 pins a lock) |
263
+ | `fall` | Hanging mass: `{ taper, wave }`, narrowing toward the ends (0..1 head radii) and a soft uneven hem (nonnegative head radii) |
264
+ | `shine` | Soft highlight opacity on the locks, 0..1 (default 0); drawn in the clean look |
116
265
  | `coversEars` | The hair hides the ears |
117
266
 
118
267
  A style stays a starting point: any style suits anyone.
119
268
 
269
+ A lock's `path` has a root, two controls and a tip for a cubic curve; append
270
+ groups of three points for additional segments. Each point is
271
+ `{ around, up, lift? }`: `around` is degrees from the face toward the character's
272
+ left, `up` is head radii from the centre (at most 1), and nonnegative `lift`
273
+ adds distance outside the cap. The root must have `up` between 0 and 1 and no
274
+ extra lift. Sweeps follow the scalp rather than cutting through the skull.
275
+ Use continuous angles across the back, such as 160, 190, 220. Invalid lock
276
+ paths, widths, flexibility, shine and fall values throw during `resolveHair`.
277
+
278
+ ```js
279
+ const hair = resolveHair({ style: 'cascadingWaves', color: '#985b32' })
280
+ // Edit the resolved data; presets and other characters keep their own paths.
281
+ hair.locks[0].follow = 0.65
282
+ character({ hair })
283
+ // Remove the sculpted locks, keeping the cap and supporting mass:
284
+ character({ hair: { style: 'flowingBob', locks: [], shine: 0 } })
285
+ ```
286
+
287
+ `length` changes the supporting mass; edit lock path points to change their
288
+ individual lengths and curls. Public types: `HairLock`, `HairLockPoint`.
289
+ See the **Flowing Cartoon Hair** example and the
290
+ [eight-view reference sheet](model-sheet/flowing-hair.png).
291
+
120
292
  ## Hair in motion
121
293
 
122
294
  Hair that hangs (long hair, ponytails, braids) lags behind the head: it swings
123
295
  round after a turn, streams back on a run, drops on a jump and lifts on the
124
296
  landing. The roots stay on the head; the ends move, more the further they hang.
125
- Short hair, buns, beards and hats stay put.
297
+ Ordinary short hair, buns, beards and hats stay put. Flowing locks also flex,
298
+ including the short `softSweep`: their roots remain fixed while their ends
299
+ respond by each lock's `follow` amount. The presets use smaller amounts on
300
+ the fringe and larger, varied amounts on the hanging locks.
126
301
 
127
302
  The lag is three pose fields, so it keys, saves and mirrors like any other:
128
303
 
@@ -253,6 +428,13 @@ body part before it draws. Set the canvas clipping path in this hook; it is
253
428
  restored before the part's `over` layers and the next part. The built-in outfit
254
429
  uses this to hide thighs under tops. `joints.parts[id].order` is the resolved
255
430
  far-to-near drawing index; use it when a garment spans several parts.
431
+ Camera-projected joints also provide `bodyForward: [x,y,z]` in view space:
432
+ `z` is front visibility and `x` is the side offset for front details. This
433
+ axis follows the body and camera independently of head yaw. `joints.turn`
434
+ retains the authored body turn; flat drawing omits `bodyForward`, so use
435
+ `cos(turn * Math.PI / 2)` and `sin(turn * Math.PI / 2)` there.
436
+ The built-in wardrobe uses this direction for front buttons, necklines,
437
+ pockets, collars, ties and outer-garment details.
256
438
 
257
439
  ## The cast
258
440
 
@@ -324,6 +506,10 @@ const hero = character(castMember('mangaYoungMan', 300, {
324
506
  projected 3D tapered head, following yaw, nod and roll. `jawWidth` is the
325
507
  half-width at the jaw (clamped to 0.55–0.95 head radii, default 0.74);
326
508
  `chinWidth` is the half-width just above the chin (0.03–0.35, default 0.14).
509
+ `jawRoundness` softens angular cheek and chin corners (0–1, default 0 keeps
510
+ the sharp outline). The Flowing Cartoon Hair demo's soft angular face uses
511
+ `jawWidth: 0.8`, `chinWidth: 0.28` and `jawRoundness: 1` for a fuller,
512
+ rounded chin. Behind-head hair, ears and beards clip to this same outline.
327
513
  `shape: 'round'` is the original default. The underlying rig and contact
328
514
  geometry retain their original head bounds; solid mesh characters retain
329
515
  their existing mesh head.
@@ -1143,7 +1143,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
1143
1143
  **Steps to embed:**
1144
1144
  1. Build the player: `npm run build:player`
1145
1145
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
1146
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-player.iife.js`
1146
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-player.iife.js`
1147
1147
  instead; see [Deployment](DEPLOYMENT.md))
1148
1148
  3. Copy the generated code into your HTML
1149
1149
  4. Adjust the script `src` path if needed
package/docs/examples.md CHANGED
@@ -743,7 +743,7 @@ For simple website embedding without a build system.
743
743
  </html>
744
744
  ```
745
745
 
746
- Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-player.iife.js`.
746
+ Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-player.iife.js`.
747
747
 
748
748
  ---
749
749
 
@@ -185,7 +185,7 @@ with a GSAP-style call (durations are in seconds here):
185
185
  ```html
186
186
  <div class="box" style="width:60px;height:60px;background:#4a9eff"></div>
187
187
 
188
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly.iife.js"></script>
188
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly.iife.js"></script>
189
189
  <script>
190
190
  tinyfly.to('.box', { x: 200, duration: 1 })
191
191
  </script>
@@ -74,7 +74,7 @@ Without a build step, the all-in-one bundle exposes the same functions on a
74
74
  global — `tinyfly.to()`, `tinyfly.timeline()` and so on:
75
75
 
76
76
  ```html
77
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly.iife.js"></script>
77
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly.iife.js"></script>
78
78
  <script>
79
79
  tinyfly.to('.box', { x: 200, duration: 1 })
80
80
  </script>
package/docs/llm-guide.md CHANGED
@@ -88,6 +88,38 @@ bakes. See `docs/dance.md`.
88
88
 
89
89
  ## Characters with a look
90
90
 
91
+ For original soft cartoon story characters, opt into `figure: 'organic'`.
92
+ Its default `face.projection: 'volume'` moves eyes/mouth around the head and
93
+ lets hair occlude them, with a flatter profile facial plane and a nose above
94
+ the mouth; classic `cartoon` projection remains available. Foreground organic
95
+ arms/hands draw together over lower garments, preserving the wrist at the waist.
96
+ `body` owns JSON half-width profiles (`torso`, `arm`, `leg`, `neck`): increasing
97
+ arrays of `{ at: 0..1, width: fractionOfHeight }` spanning 0 to 1. Set `skin`
98
+ once for exposed body, head and hands; `body.fill` overrides it.
99
+ Use `body.fill: 'none'` for outline-only exposed skin, including both hand
100
+ variants in every look. In 3D, only foreground arms use garment depths for
101
+ painter ordering; other organic parts retain physical world-object occlusion.
102
+ `body.outline: { color, width }` is independent of anatomy. Optional
103
+ `body.shading: { mode: 'cel' | 'none', light: [x,y], shadow, opacity, highlight }`
104
+ is deterministic and clipped to skin. Defaults include small natural hands.
105
+ `softCartoonCharacter('youngMan' | 'youngWoman' | 'childBoy' | 'childGirl', options)`
106
+ provides editable original actors; `SOFT_CARTOON_CAST` contains their source
107
+ options. Children default to shorter heights, larger head proportions, shorter
108
+ limbs and rounded torsos. Override `height` to change size while preserving
109
+ their anatomy. Use `outfitPreset('everyday' | 'formal' | 'casual', overrides)`
110
+ for owned JSON wardrobe defaults. `outfit.top` is `tshirt | shirt | blouse |
111
+ dress`; `trouserStyle` is `plain | jeans | cargo`; `shirt` and `trousers`
112
+ remain colour fields. Bottoms are `trousers | shorts | skirt`; sleeves,
113
+ collar and tie colour are editable. Dresses force a skirt in the top colour.
114
+ All garments are available for every actor. `outfit` adapts to organic contours; organic-only `leafOutfit` accepts
115
+ `{ top?, color?, accent?, length? }`. Use the existing `characterScript`,
116
+ `characterPoseTracks`, `reachCharacter`, hand pose and `hairFollowTracks`
117
+ APIs for motion. Avoid a foreground whole-body overlay. An unrigged PNG
118
+ is not a posable character. The interactive example is
119
+ `/examples/live-organic-characters`; a headless study is
120
+ `examples/headless-video/organic-characters.mjs`. Child proportions and poses
121
+ are shown in `examples/headless-video/child-characters.mjs`.
122
+
91
123
  A v2 character's appearance is plain options to `character()`, never drawing
92
124
  code: `build` (`child`, `tall`, `short`…), `hair` (a style name, or
93
125
  `{ style, color, length, … }`), `facialHair`, `glasses`, `hat`, `ears: true`,
@@ -96,6 +128,9 @@ code: `build` (`child`, `tall`, `short`…), `hair` (a style name, or
96
128
  'cardigan' | 'overalls' | 'sari' | 'apron' | 'labCoat', shoes: 'boots' }`.
97
129
  Built-in tops hide thighs and trouser roots under their hem during turns;
98
130
  garments spanning both legs use the resolved body order in camera views too.
131
+ Custom camera-view garment details should use `joints.bodyForward` (view-space
132
+ body axis: `z` front visibility, `x` side offset), independent of head yaw.
133
+ `joints.turn` remains authored; flat joints omit `bodyForward`.
99
134
  For custom clothes, `layers.parts[id].clip` clips only the bare body before
100
135
  `over` draws, and `joints.parts[id].order` gives the drawing index.
101
136
  `castMember('grandpa', 300)` gives a whole ready-made character to start
@@ -113,8 +148,15 @@ and the close-up fields `pupil`, `lid` and `bulge`, so any face goes with any
113
148
  action or view; `drawCharacterHead(ctx, who, pose, { x, y, radius })` draws
114
149
  just the head big, and `face: { nose, inPupil }` adds a nose and a drawing in
115
150
  the pupils. Hair and hats turn with the head:
116
- don't draw a different hairstyle per view. Hanging hair swings on its own:
117
- after the character's tracks add `hairFollowTracks(target, tracks, who)` (or,
151
+ don't draw a different hairstyle per view.
152
+ `softSweep`, `flowingBob` and `cascadingWaves` provide flowing cartoon hair
153
+ with editable cubic `locks: [{ path, width, follow? }]`. Each path is a root
154
+ plus groups of three `{ around, up, lift? }` points (degrees around the head,
155
+ head radii up/out); the root has up 0..1 and lift 0. `follow: 0` pins a lock.
156
+ `length` changes the supporting mass; edit the path to change a lock's length.
157
+ These styles work with the same acting and story tracks as other characters.
158
+ Hanging hair and flexible locks, including short sweeps, follow motion through
159
+ the same API: after the character's tracks add `hairFollowTracks(target, tracks, who)` (or,
118
160
  posing per frame, `hairFollow` once and `hairMotionAt(keys, t)` each frame)
119
161
  rather than keying `hair.swing` by hand. Put things in hands with `holding`
120
162
  (`{ right: 'mug' }`, `{ both: 'parcel' }`; the pose field `held.both` lets go),
@@ -270,6 +312,7 @@ or link `llms-full.txt`.
270
312
 
271
313
  `MANGA_CAST` supplies four original young adult presets through `castMember`.
272
314
  `face.shape: 'angular'`, `jawWidth` and `chinWidth` shape the projected pen head;
315
+ `jawRoundness: 1` rounds cheek/chin corners (default `0` preserves sharp jaws).
273
316
  `eyeScale` and `eyeAspect` shape anime eyes. Hair and outfit overrides remain
274
317
  independent; spread the preset's face when changing one nested field.
275
318
  `mangaSpikes` / `mangaSweep` contain editable `hair.spikes` tufts as JSON
package/docs/maps.md CHANGED
@@ -14,8 +14,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
14
14
  adds to the same `tinyfly` global:
15
15
 
16
16
  ```html
17
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly.iife.js"></script>
18
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-maps.iife.js"></script>
17
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly.iife.js"></script>
18
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-maps.iife.js"></script>
19
19
  ```
20
20
 
21
21
  It is a separate script because the offline world map it carries adds about
package/docs/teaching.md CHANGED
@@ -25,7 +25,7 @@ path for all of that:
25
25
  </figure>
26
26
 
27
27
  <!-- once, anywhere on the page (a site-wide footer is fine) -->
28
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.106.1/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
28
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.108.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
29
29
  ```
30
30
 
31
31
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post