@algorisys/tinyfly 0.97.0 → 0.99.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 (48) hide show
  1. package/README.md +10 -10
  2. package/docs/acting.md +76 -13
  3. package/docs/character-appearance.md +329 -0
  4. package/docs/editor-guide.md +54 -9
  5. package/docs/examples.md +1 -1
  6. package/docs/getting-started.md +1 -1
  7. package/docs/gsap-compat.md +1 -1
  8. package/docs/llm-guide.md +29 -2
  9. package/docs/maps.md +2 -2
  10. package/docs/props.md +8 -6
  11. package/docs/scene-3d.md +3 -1
  12. package/docs/teaching.md +1 -1
  13. package/lib/addons/characters.js +5911 -4230
  14. package/lib/browser/tinyfly.iife.js +14 -14
  15. package/lib/browser/tinyfly.js +8545 -6864
  16. package/lib/browser/tinyfly.umd.js +14 -14
  17. package/lib/types/characters/acting/character-script.d.ts +44 -0
  18. package/lib/types/characters/acting/index.d.ts +1 -0
  19. package/lib/types/characters/capabilities.d.ts +15 -0
  20. package/lib/types/characters/cast.d.ts +284 -0
  21. package/lib/types/characters/character.d.ts +35 -5
  22. package/lib/types/characters/chart.d.ts +52 -14
  23. package/lib/types/characters/hair-follow.d.ts +76 -0
  24. package/lib/types/characters/hands/held-items.d.ts +88 -0
  25. package/lib/types/characters/hands/index.d.ts +1 -0
  26. package/lib/types/characters/head/ears.d.ts +10 -0
  27. package/lib/types/characters/head/facial-hair.d.ts +118 -0
  28. package/lib/types/characters/head/glasses.d.ts +24 -0
  29. package/lib/types/characters/head/hair.d.ts +586 -0
  30. package/lib/types/characters/head/hats.d.ts +58 -0
  31. package/lib/types/characters/head/head-look.d.ts +56 -0
  32. package/lib/types/characters/head/index.d.ts +5 -0
  33. package/lib/types/characters/head/shell.d.ts +64 -0
  34. package/lib/types/characters/index.d.ts +5 -1
  35. package/lib/types/characters/interactions.d.ts +69 -0
  36. package/lib/types/characters/props/draw.d.ts +9 -0
  37. package/lib/types/characters/props/families/animals.d.ts +6 -0
  38. package/lib/types/characters/props/prop-surface.d.ts +14 -3
  39. package/lib/types/characters/props/ride-3d.d.ts +31 -2
  40. package/lib/types/characters/props/target.d.ts +5 -1
  41. package/lib/types/characters/species/human-motion.d.ts +5 -2
  42. package/lib/types/characters/species/human.d.ts +113 -4
  43. package/lib/types/characters/wardrobe/basic-outfit.d.ts +19 -5
  44. package/lib/types/characters/whiteboard.d.ts +13 -1
  45. package/llms-full.txt +549 -56
  46. package/llms.txt +29 -28
  47. package/package.json +1 -1
  48. package/skills/tinyfly/SKILL.md +18 -4
package/llms-full.txt CHANGED
@@ -204,7 +204,7 @@ with a GSAP-style call (durations are in seconds here):
204
204
  ```html
205
205
  <div class="box" style="width:60px;height:60px;background:#4a9eff"></div>
206
206
 
207
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly.iife.js"></script>
207
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly.iife.js"></script>
208
208
  <script>
209
209
  tinyfly.to('.box', { x: 200, duration: 1 })
210
210
  </script>
@@ -412,7 +412,7 @@ Without a build step, the all-in-one bundle exposes the same functions on a
412
412
  global — `tinyfly.to()`, `tinyfly.timeline()` and so on:
413
413
 
414
414
  ```html
415
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly.iife.js"></script>
415
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly.iife.js"></script>
416
416
  <script>
417
417
  tinyfly.to('.box', { x: 200, duration: 1 })
418
418
  </script>
@@ -2278,7 +2278,7 @@ For simple website embedding without a build system.
2278
2278
  </html>
2279
2279
  ```
2280
2280
 
2281
- 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.97.0/cdn/tinyfly-player.iife.js`.
2281
+ 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.99.0/cdn/tinyfly-player.iife.js`.
2282
2282
 
2283
2283
  ---
2284
2284
 
@@ -5451,7 +5451,9 @@ left to right:
5451
5451
  is a reassuring, tap-friendly manual save (handy on tablets).
5452
5452
  - **New** — start a fresh project (prompts if you have unsaved changes).
5453
5453
  - **AI** — show or hide the AI prompt bar, where you describe an animation and
5454
- click **Generate**.
5454
+ click **Generate**. A brief with a story in it ("grandma walks up to a ticking
5455
+ box, jumps, and runs off") gets a 🧍 Character from the cast with a beat
5456
+ script, compiled into its tracks on load (the beats stay on the element).
5455
5457
  - **My Animations** — open the gallery of every project you've saved (thumbnails,
5456
5458
  open / duplicate / delete). See [Project Management](#project-management).
5457
5459
  - **Examples** — every ready-made animation on one page (`/examples`). Open one in
@@ -5486,6 +5488,8 @@ Shapes, text, images, video, lines, arrows and paths are added from the
5486
5488
  | **Group** | Container that groups multiple elements |
5487
5489
  | **🧍 Character** | A posable figure: pick a view, a pose and a face, and keyframe them to animate (see [Characters](#characters)) |
5488
5490
  | **🗺 Map** | An animated map: places, a route between them, and a camera (see [Maps](#maps)) |
5491
+ | **🧊 3D Scene** | A real 3D scene seen through its camera: meshes, lights, characters and props (see [3D Scenes](#3d-scenes)) |
5492
+ | **⌨ Code** | A code panel whose lines a Character's beats aim at and change (see [Code](#code)) |
5489
5493
 
5490
5494
  Polygon and star are **parametric** paths: change the sides/points/inner ratio in
5491
5495
  the Property Panel and the shape regenerates, and they rescale cleanly when you
@@ -5545,12 +5549,19 @@ its box; resize the box to change its height. In the property panel:
5545
5549
  traditional stick figure).
5546
5550
  - **Look**: *Clean*, *Pencil* (hand-drawn strokes that boil, with faint
5547
5551
  construction lines) or *Silhouette*.
5548
- - **Build**: *Standard*, *Slim*, *Kid* (big head), *Broad*, *Curvy* or
5549
- *Stocky*, or set **Head**, **Shoulders** and **Hips** with the sliders (the
5550
- Stick figure has a head size only). Clothes, gags, walks and dances fit
5551
- every build.
5552
+ - **Build**: *Standard*, *Slim*, *Kid* (big head), *Child*, *Toddler*, *Tall*,
5553
+ *Short*, *Broad*, *Curvy* or *Stocky*, or set **Head**, **Shoulders**,
5554
+ **Hips**, **Legs** and **Arms** with the sliders (the Stick figure has no
5555
+ shoulders or hips). Clothes, gags, walks and dances fit every build.
5552
5556
  - **Line**, **Skin**, and **Clothes** (a T-shirt and trousers, with their
5553
5557
  colours, or none).
5558
+ - **Head**: **Cast** dresses the character as one of the ready-made cast
5559
+ (boy, girl, young man, young woman, man, woman, grandpa, grandma: build,
5560
+ hair, facial hair, glasses and clothes in one step); then **Hair** (34
5561
+ styles, from buzz cut to twin braids) and its **Hair colour**, **Facial
5562
+ hair** (20 styles), **Glasses**, **Hat** and **Ears** change one thing at a
5563
+ time. Hair and hats turn with the head in every view (see
5564
+ [Character Appearance](character-appearance.md)).
5554
5565
  - **Hands**: *Round*, *Cartoon gloves* (a thumb and three plump fingers), or
5555
5566
  *Natural* (five fingers, best for mudras). Gloves and natural hands take hand
5556
5567
  shapes: dances key them (jazz hands, mudras), and each finger is a track
@@ -5562,7 +5573,8 @@ its box; resize the box to change its height. In the property panel:
5562
5573
  - **Body**: a pose (standing, waving, pointing, cheering, hands on hips,
5563
5574
  thinking, shrugging, sitting, kneeling, crouching, crawling, lying down).
5564
5575
  Poses that rest on a knee, the hands or the back are set down on the ground.
5565
- - **Face**: an expression (happy, sad, surprised, angry…), or the pose's own.
5576
+ - **Face**: an expression (happy, sad, surprised, angry, embarrassed with a
5577
+ blush, crying with tears, afraid with a bead of sweat…), or the pose's own.
5566
5578
 
5567
5579
  To animate a character, pick a view, a pose and a face, and click
5568
5580
  **◆ Keyframe pose at playhead**. Move the playhead, pick the next pose, and
@@ -5613,12 +5625,39 @@ Dances and flips are written as they are, and turn acting off.
5613
5625
  (`drawingRate` in the JSON), so previews, players and exports all hold the
5614
5626
  same way.
5615
5627
 
5628
+ - **Beats**: a story written as beats, compiled in the chosen style into the
5629
+ character's tracks and kept on the element (`beats` in the JSON). Write them
5630
+ as JSON (`[{ "do": "walk", "to": 320, "mood": "happy" }, { "do": "say",
5631
+ "say": "Hello!" }, { "do": "take" }]`) and click **🎬 Run beats**; the
5632
+ timeline grows to fit. A beat can aim at a **⌨ Code** element's lines
5633
+ (`"target": { "surface": "Code 1", "anchor": "line:2" }`, also for `to`,
5634
+ `toward` and `onto`) and change them (`"then": { "surface": "Code 1",
5635
+ "edit": "highlight", "anchor": "line:2", "at": "contact" }`): the edits
5636
+ become tracks on that element. Problems are named by beat (an unknown
5637
+ action, mood or place) before anything is written. The AI prompt bar writes
5638
+ beats this way too.
5639
+
5616
5640
  See [Cartoon Acting](acting.md).
5617
5641
 
5618
5642
  Characters show in the DOM and Canvas previews and in GIF / WebP / MP4
5619
5643
  export. They are not part of exported HTML or embeds yet, and the SVG preview
5620
5644
  does not draw them.
5621
5645
 
5646
+ ### Code
5647
+
5648
+ A **⌨ Code** element is a code panel (`codePanel()` from code): a listing with
5649
+ line numbers, drawn by code into its box, which grows to fit its lines. In the
5650
+ property panel: the **Language** (JavaScript, TypeScript, Python, Go, Rust,
5651
+ C#, plain), **Font size**, **Line numbers**, **Hidden lines** (typed in later)
5652
+ and the **Listing** itself.
5653
+
5654
+ Its lines are places. A Character's **Beats** aim at them and change them
5655
+ (highlight, strike, remove, type, fling a token…), and those edits are tracks
5656
+ on the Code element named `line.N.highlight`, `line.N.strike`, `line.N.wipe`,
5657
+ `line.N.reveal` and so on, which you can also key by hand. Code panels show in
5658
+ the DOM and Canvas previews and in GIF / WebP / MP4 export. See [Acting on
5659
+ code](acting.md#acting-on-code) for the same from code.
5660
+
5622
5661
  ### Maps
5623
5662
 
5624
5663
  A **🗺 Map** fills the canvas with a map of the world. In the property panel:
@@ -5653,8 +5692,8 @@ camera: it starts with a camera at three-quarters, a key light, a floor and a
5653
5692
  red box. In the property panel:
5654
5693
 
5655
5694
  - **Objects**: pick one to edit. **Add** puts a box, sphere, cylinder, cone,
5656
- ring, star (an extruded path), character or light on the next free spot;
5657
- ✕ removes the picked one (not the scene's camera).
5695
+ ring, star (an extruded path), character, prop or light on the next free
5696
+ spot; ✕ removes the picked one (not the scene's camera).
5658
5697
  - **Transform**: X, Y, Z (metres, +y up), Tilt X, Turn Y, Roll Z and Scale.
5659
5698
  **◆ Key transform at playhead** keys all of them; once a value is animated
5660
5699
  (◆ by its name), changing it keys it at the playhead.
@@ -5663,6 +5702,12 @@ red box. In the property panel:
5663
5702
  - **Characters**: a look (*Clean*, *Pencil*, *Silhouette* drawn by their pens
5664
5703
  in perspective, or *Solid*) and **🕺 Dance from playhead** with any dance
5665
5704
  style.
5705
+ - **Props**: which prop from the catalog (car, truck, bus, tractor, cart, train
5706
+ car, bike, motorbike, tree, house, helicopter, airplane, horse, dog, cat, cow,
5707
+ songbird, crow, chicken), its look (*Clean*, *Pencil*, *Silhouette*, or
5708
+ *Mesh*, lit with the scene) and style (*Solid* or *Stick* line art). Its
5709
+ controls (`car.door`, `car.wheelSpin`, `dog.tail`…) are tracks on the
5710
+ element.
5666
5711
  - **Cameras**: field of view, **Look through this camera**, and **✂ Cut to
5667
5712
  this camera at playhead**, which keys the shot change.
5668
5713
  - **Camera** view presets (*Front*, *¾*, *Side*, *Top*) and the scene's
@@ -6466,7 +6511,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
6466
6511
  **Steps to embed:**
6467
6512
  1. Build the player: `npm run build:player`
6468
6513
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
6469
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly-player.iife.js`
6514
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly-player.iife.js`
6470
6515
  instead; see [Deployment](DEPLOYMENT.md))
6471
6516
  3. Copy the generated code into your HTML
6472
6517
  4. Adjust the script `src` path if needed
@@ -7449,11 +7494,11 @@ one probably meant, and `propScript` throws on them.
7449
7494
  | `house()` | `door` (`open`), `lights` (`on`), `smoke` (`for`, runs in the background), `shake` |
7450
7495
  | `helicopter()` | `takeOff` (`height`), `fly` (`to`, `height`), `hover`, `land` |
7451
7496
  | `airplane()` | `takeOff` (`to`, `height`), `fly` (`to`, `height`), `loop`, `land` (`to`) |
7452
- | `horse()` | `walk`, `trot`, `canter`, `gallop` (`to`), `rear`, `buck`, `neigh`, `graze`, `sit`, `jump`, `nod`, `swish` |
7453
- | `dog()` | `walk`, `trot`, `run` (`to`), `bark`, `wag`, `sniff`, `sit`, `jump`, `nod`, `swish` |
7454
- | `cat()` | `walk`, `trot`, `run` (`to`), `meow`, `arch`, `pounce` (`to`), `sit`, `jump`, `nod`, `swish` |
7455
- | `cow()` | `walk`, `trot` (`to`), `moo`, `graze`, `sit`, `jump`, `nod`, `swish` |
7456
- | `songbird()`, `crow()` | `hop`, `walk` (`to`), `peck` (`for`), `flap` (`for`), `fly` (`to`, `height`), `land` (`height`, `to`), `tweet` / `caw` |
7497
+ | `horse()` | `walk`, `trot`, `canter`, `gallop` (`to`), `rear`, `buck`, `neigh`, `graze`, `sit`, `lie`, `jump`, `nod`, `swish` |
7498
+ | `dog()` | `walk`, `trot`, `run` (`to`), `bark`, `wag`, `sniff`, `sit`, `lie`, `jump`, `nod`, `swish` |
7499
+ | `cat()` | `walk`, `trot`, `run` (`to`), `meow`, `arch`, `pounce` (`to`), `sit`, `lie`, `jump`, `nod`, `swish` |
7500
+ | `cow()` | `walk`, `trot` (`to`), `moo`, `graze`, `sit`, `lie`, `jump`, `nod`, `swish` |
7501
+ | `songbird()`, `crow()` | `hop`, `walk` (`to`), `peck` (`for`), `flap` (`for`), `fly` (`to`, `height`), `glide` (`to`, `height`), `land` (`height`, `to`), `tweet` / `caw` |
7457
7502
  | `chicken()` | `walk` (`to`), `peck`, `flap`, `flutter`, `cluck` (it cannot fly) |
7458
7503
 
7459
7504
  **Line art.** `propTarget({ …, style: 'stick' })` (or `drawSolvedProp(…, { style: 'stick' })`)
@@ -7478,7 +7523,9 @@ and while `flapping` is on, the rig's `derive` beats them from a phase,
7478
7523
  a second, a crow four). Its head pecks from a neck joint (`peck`; a chicken's
7479
7524
  neck stretches down to reach), and it walks with its head bobbing or hops.
7480
7525
  `fly` takes off with a crouch and a leap (no crouch if it is already in the
7481
- air) and flies to `height` metres; `land` comes down to the ground or to a
7526
+ air) and flies to `height` metres; `glide` holds the wings out still and sinks
7527
+ gently toward `height` on the way to `to` (from the ground it flies the first
7528
+ stretch); `land` comes down to the ground or to a
7482
7529
  perch (`height`). Perch it with anchors:
7483
7530
 
7484
7531
  ```js
@@ -7565,7 +7612,8 @@ npx @algorisys/tinyfly capabilities --json # the same as data
7565
7612
  It lists the easings, track kinds, every property each canvas shape can
7566
7613
  animate (with units and ranges), the stick figure's joints, poses,
7567
7614
  expressions, gags, gaits, beat actions, dances, flips and hand shapes, the v2
7568
- character's poses, the code panel's languages, every surface's anchors and
7615
+ character's poses, expressions, builds, hairstyles, facial hair, glasses,
7616
+ hats and cast, the code panel's languages, every surface's anchors and
7569
7617
  edits (code panel, whiteboard, chart), camera shots and the teaching
7570
7618
  helpers. It is generated from the code, so it can't
7571
7619
  fall behind: **a name in it is accepted, and a name not in it is rejected.**
@@ -7591,6 +7639,24 @@ Characters in a 3D scene walk the same way with `characterScript3D`
7591
7639
  (`{ do: 'walk', to: [x, z] }`, `pose`, `gag`, `face`, `place`); a rider is
7592
7640
  seated with `propRide3D` and spliced into its script with `spliceTracks`. See `docs/props.md`.
7593
7641
 
7642
+ ## Characters with a look
7643
+
7644
+ A v2 character's appearance is plain options to `character()`, never drawing
7645
+ code: `build` (`child`, `tall`, `short`…), `hair` (a style name, or
7646
+ `{ style, color, length, … }`), `facialHair`, `glasses`, `hat`, `ears: true`
7647
+ and `outfit: { shirt, trousers }`. `castMember('grandpa', 300)` gives a whole
7648
+ ready-made character to start from. Expressions come from `HUMAN_EXPRESSIONS`
7649
+ and are pose fields, as are the face marks `blush`, `tears` and `sweat` (0–1),
7650
+ so any face goes with any action or view. Hair and hats turn with the head:
7651
+ don't draw a different hairstyle per view. Hanging hair swings on its own:
7652
+ after the character's tracks add `hairFollowTracks(target, tracks, who)` (or,
7653
+ posing per frame, `hairFollow` once and `hairMotionAt(keys, t)` each frame)
7654
+ rather than keying `hair.swing` by hand. Put things in hands with `holding`
7655
+ (`{ right: 'mug' }`, `{ both: 'parcel' }`; the pose field `held.both` lets go),
7656
+ and for two characters touching use `meetHands('handshake', a, b)` with the
7657
+ two standing `meetingSpacing(…)` apart, never two separate clips. See
7658
+ `docs/character-appearance.md`.
7659
+
7594
7660
  ## Surfaces
7595
7661
 
7596
7662
  Code panels (`codePanel()`), whiteboards (`whiteboard()`), charts
@@ -7641,7 +7707,11 @@ scriptTracks: 2 problem(s) in the beats:
7641
7707
 
7642
7708
  - **Beat scripts**: `scriptTracks()` throws on errors. `checkBeats(beats)`
7643
7709
  returns errors and warnings without throwing, and from the command line:
7644
- `npx @algorisys/tinyfly check beats.json`.
7710
+ `npx @algorisys/tinyfly check beats.json`. For a v2 `character()` use
7711
+ `characterScript(target, who, beats, options)`: the same beats and checks,
7712
+ compiled for the human body and a `characterTarget` (its `walk`, `walking`
7713
+ and `gait` tracks step the gait as it draws); add
7714
+ `hairFollowTracks(target, tracks, who)` after it.
7645
7715
  - **Tracks**: `checkTracks(tracks, targets)` finds tracks aimed at targets
7646
7716
  that aren't there, properties a target can't animate (`rotation` → `rotate`),
7647
7717
  keys out of time order, values of the wrong kind and values out of range.
@@ -7675,6 +7745,10 @@ Fix, render again.
7675
7745
  figure's `ground` (a house's `anchor:doorstep`).
7676
7746
  - **Angles are degrees.** Stick-figure arms: 0 hangs down, 90 straight out,
7677
7747
  180 straight up; in profile the left arm's forward is negative.
7748
+ - **A character's look is data, and names are checked.** `hair: 'bob'`, not
7749
+ a drawing in `layers`; a style name not in the catalog throws (`hair:
7750
+ unknown style`). Side names (`at: 'left'`, `arm.left`) are the character's
7751
+ own: from the front its left is on screen right.
7678
7752
  - **Aim beats at anchors, not guessed numbers**: `code.line(7)`,
7679
7753
  `code.token(3, 'var')`, `code.spot(2, 8, 4)`, `piece.home`.
7680
7754
  - **Key reactions to contact times.** Beats that touch something report
@@ -7747,7 +7821,7 @@ path for all of that:
7747
7821
  </figure>
7748
7822
 
7749
7823
  <!-- once, anywhere on the page (a site-wide footer is fine) -->
7750
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
7824
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
7751
7825
  ```
7752
7826
 
7753
7827
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
@@ -8822,8 +8896,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
8822
8896
  adds to the same `tinyfly` global:
8823
8897
 
8824
8898
  ```html
8825
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly.iife.js"></script>
8826
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.97.0/cdn/tinyfly-maps.iife.js"></script>
8899
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly.iife.js"></script>
8900
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.99.0/cdn/tinyfly-maps.iife.js"></script>
8827
8901
  ```
8828
8902
 
8829
8903
  It is a separate script because the offline world map it carries adds about
@@ -9026,6 +9100,340 @@ prop, or the depths to slot it between fingers.
9026
9100
 
9027
9101
  ---
9028
9102
 
9103
+ <!-- docs/character-appearance.md -->
9104
+
9105
+ # Character Appearance
9106
+
9107
+ Hair, facial hair, glasses, hats, ears, builds, a ready-made cast, held items,
9108
+ meeting hands and hair that swings for the v2 character (`character()` in `@algorisys/tinyfly/characters`). Every choice
9109
+ is plain data, so a character can be saved, synced, generated by a language
9110
+ model and changed one field at a time.
9111
+
9112
+ ![Character appearance sheet: the cast, every hairstyle, facial-hair style, glasses, hats and expressions](model-sheet/appearance.png)
9113
+
9114
+ The sheet is drawn by `examples/headless-video/appearance-sheet.mjs`
9115
+ (`npx tinyfly video examples/headless-video/appearance-sheet.mjs --stills stills/`).
9116
+
9117
+ ## Quick start
9118
+
9119
+ ```js
9120
+ import { character, characterTarget, drawCharacter, humanPose, castMember, HUMAN_EXPRESSIONS } from '@algorisys/tinyfly/characters'
9121
+
9122
+ // Pick everything by name…
9123
+ const maya = character({
9124
+ height: 300,
9125
+ build: 'slim',
9126
+ hair: { style: 'highPonytail', color: '#9a4426' },
9127
+ glasses: 'round',
9128
+ ears: true,
9129
+ outfit: { shirt: '#f0b43c', trousers: '#36507a' },
9130
+ })
9131
+
9132
+ // …or start from the cast and change what you like.
9133
+ const grandpa = character(castMember('grandpa', 300, { look: 'pencil' }))
9134
+
9135
+ // Faces are pose fields, so any expression goes with any action and view.
9136
+ drawCharacter(ctx, maya, humanPose({ ...HUMAN_EXPRESSIONS.embarrassed, turn: 0.5 }))
9137
+ ```
9138
+
9139
+ A plain figure (no `hair`, `facialHair`, `glasses`, `hat` or `ears`) draws
9140
+ exactly as it did before these options existed.
9141
+
9142
+ ## How it turns
9143
+
9144
+ Hair, beards and hats are not flat drawings pasted on the face. Each is a
9145
+ region on the head's surface (where the hairline runs, how far the hair stands
9146
+ off the head, how far it hangs), drawn wherever the head's `turn`, `head.turn`,
9147
+ `head.nod` and `head.tilt` put it:
9148
+
9149
+ - the part facing away is drawn before the body, so long hair hangs behind the
9150
+ shoulders seen from the front, and a bob shows beside the face;
9151
+ - the part facing the viewer is drawn over the head, so a fringe crosses the
9152
+ forehead and, from behind, the hair covers the whole head;
9153
+ - turned away (past about `turn` 1.2), the hair is drawn after the whole body,
9154
+ over an arm at the side;
9155
+ - a parting, a side ponytail or a braid stays on the character's own side
9156
+ through a turn: left and right are the character's, never mirrored.
9157
+
9158
+ Glasses, moustaches and the face marks sit on the face itself, placed like the
9159
+ eyes and mouth, so they slide round with the face and hide with it.
9160
+
9161
+ **Which part wins where two overlap** is fixed: eyes and brows draw over a
9162
+ fringe; the mouth draws over a beard, which leaves an opening for it (so every
9163
+ lip-sync shape stays readable); a moustache draws over the top of the mouth;
9164
+ glasses over the eyes; a hat over the hair. Ears are hidden by hair that
9165
+ `coversEars`.
9166
+
9167
+ ## Views
9168
+
9169
+ `turn` runs 0 → 4. The eight reference views:
9170
+
9171
+ | View | `turn` |
9172
+ |---|---|
9173
+ | Front | 0 |
9174
+ | Front 3/4 right (nose toward screen right) | 0.5 |
9175
+ | Right profile | 1 |
9176
+ | Back 3/4 right | 1.5 |
9177
+ | Back | 2 |
9178
+ | Back 3/4 left | 2.5 |
9179
+ | Left profile | 3 |
9180
+ | Front 3/4 left | 3.5 |
9181
+
9182
+ The view names describe the screen; limb and side names (`arm.left`,
9183
+ `at: 'left'`) are always the character's own.
9184
+
9185
+ ## Hair
9186
+
9187
+ `hair` takes a style name, a style with changes, or `null`:
9188
+
9189
+ ```js
9190
+ character({ hair: 'bob' })
9191
+ character({ hair: { style: 'bob', color: HAIR_COLORS.auburn, length: 1.4 } })
9192
+ character({ hair: { volume: 0.2, hairline: { front: 0.3 }, ties: [{ kind: 'bun', at: 'top' }] } })
9193
+ ```
9194
+
9195
+ Short cuts and hairlines: `bald`, `buzzCut`, `crewCut`, `short`, `sidePart`,
9196
+ `sideSwept`, `slickBack`, `quiff`, `spiky`, `undercut`, `curlyCrop`, `afro`,
9197
+ `wavyCrop`, `shortLocs`, `flatTop`, `receding`, `thinning`.
9198
+
9199
+ Medium and long hair: `pixie`, `bob`, `longBob`, `wavyBob`, `shoulderStraight`,
9200
+ `shoulderWaves`, `longStraight`, `longWaves`, `longCurls`, `longLocs`,
9201
+ `lowPonytail`, `highPonytail`, `ponytail`, `sidePonytail`, `topBun`, `lowBun`,
9202
+ `singleBraid`, `twinBraids`, `braids`.
9203
+
9204
+ Every style is the same few fields (`resolveHair(spec)` fills them all in):
9205
+
9206
+ | Field | Meaning |
9207
+ |---|---|
9208
+ | `color` | Fill colour. `HAIR_COLORS` has `black`, `brown`, `chestnut`, `auburn`, `blond`, `ginger`, `gray`, `white` |
9209
+ | `volume` | How far the hair stands off the head (head radii) |
9210
+ | `hairline` | `{ front, side, back }`: its height at the forehead, temples and nape (head radii, +up from the head's centre) |
9211
+ | `sweep` | A side fringe: the hairline drops toward the character's left (+) or right (−) |
9212
+ | `recede` | Temples pushed back |
9213
+ | `length` | Long hair: where it ends, head radii below the head's centre (`0` short; about 1.75 is the shoulders) |
9214
+ | `opening` | Long hair: half the opening left for the face, degrees |
9215
+ | `texture`, `textureAmount` | `smooth`, `spiky`, `curly`, `wavy` or `locs`, and how strong |
9216
+ | `quiff`, `flat` | Volume swept up over the forehead; a flat top's height |
9217
+ | `part`, `strands` | A parting (degrees round from the middle of the face) and the detail lines: `none`, `part`, `sweep`, `combed`, `hanging`, `thin` |
9218
+ | `fill` | `solid`, or `stipple` (close-cropped: dots on the scalp) |
9219
+ | `ties` | Ponytails, buns and braids: `{ kind: 'ponytail' \| 'bun' \| 'braid', at: 'top' \| 'high' \| 'low' \| 'left' \| 'right', length?, size? }` |
9220
+ | `coversEars` | The hair hides the ears |
9221
+
9222
+ A style stays a starting point: any style suits anyone.
9223
+
9224
+ ## Hair in motion
9225
+
9226
+ Hair that hangs (long hair, ponytails, braids) lags behind the head: it swings
9227
+ round after a turn, streams back on a run, drops on a jump and lifts on the
9228
+ landing. The roots stay on the head; the ends move, more the further they hang.
9229
+ Short hair, buns, beards and hats stay put.
9230
+
9231
+ The lag is three pose fields, so it keys, saves and mirrors like any other:
9232
+
9233
+ | Field | Meaning |
9234
+ |---|---|
9235
+ | `hair.swing` | Swung round the head toward the character's left (+) or right (−), degrees |
9236
+ | `hair.trail` | Streaming back behind the head (+) or thrown forward (−), head radii |
9237
+ | `hair.lift` | Lifted (+) or dropped (−), head radii |
9238
+
9239
+ You rarely set them by hand. `hairFollowTracks` works them out from the
9240
+ character's own tracks (the target's `x` and `y`, the pose's `turn` and
9241
+ `head.turn`), each on a spring that chases the head, the way a prop's `follow`
9242
+ trails a car's antenna or a dog's tail:
9243
+
9244
+ ```js
9245
+ const tracks = characterPoseTracks('maya', keys)
9246
+ tracks.push(...hairFollowTracks('maya', tracks, maya))
9247
+ // Nothing is added for hair with nothing to swing. A `hair.swing` track written
9248
+ // by hand (a flick) keeps its values, with the lag added on.
9249
+ ```
9250
+
9251
+ Code that poses a character every frame keys the lag once for its loop, then
9252
+ reads it at each frame's time:
9253
+
9254
+ ```js
9255
+ const lag = hairFollow((t) => ({ x: xAt(t), y: yAt(t), turn: turnAt(t) }), { end: 8000, headRadius: 24 })
9256
+ drawCharacter(ctx, maya, humanPose({ turn: turnAt(t), ...hairMotionAt(lag, t) }), t)
9257
+ ```
9258
+
9259
+ `hairFollow` options: `stiffness` (default 70, higher follows the head more
9260
+ tightly), `damping` (6, lower swings longer), `amount` (1; 0 pins the hair) and
9261
+ `step` (33 ms between keys). `hairFollowTracks` also takes `settle`, how long
9262
+ the hair keeps moving after the last key (1500 ms). The springs step in fixed
9263
+ 1 ms steps, so the same motion always gives the same keys, and the drawing
9264
+ itself keeps no state between frames.
9265
+
9266
+ Four-legged animals get the same treatment for free: their `ears` control
9267
+ (pricked forward +, laid back −) and `tail` both trail the animal's motion on a
9268
+ spring in every `propScript`.
9269
+
9270
+ ## Facial hair
9271
+
9272
+ `facialHair` takes a style name or `{ moustache, beard, color }` (the colour
9273
+ defaults to the hair's):
9274
+
9275
+ `cleanShaven`, `stubble`, `pencilMoustache`, `shortMoustache`, `chevron`,
9276
+ `handlebar`, `walrus`, `goatee`, `vanDyke`, `circleBeard`, `shortBoxed`,
9277
+ `fullBeard`, `longBeard`, `roundedBeard`, `pointedBeard`, `chinStrap`,
9278
+ `soulPatch`, `sideburns`, `muttonChops`, `moustacheStubble`.
9279
+
9280
+ Moustaches: `none`, `pencil`, `short`, `chevron`, `handlebar`, `walrus`.
9281
+ Beards: `none`, `stubble`, `goatee`, `soulPatch`, `chinStrap`, `circle`,
9282
+ `boxed`, `full`, `rounded`, `pointed`, `long`, `sideburns`, `muttonChops`.
9283
+
9284
+ ## Glasses, hats and ears
9285
+
9286
+ - `glasses`: `round`, `square`, `sunglasses` (drawn in the ink; the near arm
9287
+ runs back to the ear in profile).
9288
+ - `hat`: `cap`, `beanie`, `hardHat`, `sunHat`, `bowler`, or `{ style, color }`.
9289
+ The crown sits over the hair; hair below the brim still shows.
9290
+ - `ears: true` adds ears: they stick out past the head from the front and
9291
+ behind, and sit on the head with a curl when turned toward the viewer.
9292
+
9293
+ ## Builds
9294
+
9295
+ `build` sets proportions; `height` sets how tall the character stands. Any
9296
+ field can still be set on its own (`headSize`, `shoulderWidth`, `hipWidth`,
9297
+ `legLength`, `armLength`).
9298
+
9299
+ | Build | What changes |
9300
+ |---|---|
9301
+ | `standard` | Nothing |
9302
+ | `slim` | Smaller head, narrower |
9303
+ | `tall` | Smaller head, longer legs and arms |
9304
+ | `short` | Larger head, shorter legs, a little wider |
9305
+ | `broad`, `curvy`, `stocky` | Shoulder and hip widths (stocky: a larger head) |
9306
+ | `kid`, `child`, `toddler` | Larger head, shorter limbs |
9307
+
9308
+ Age, posture and accessories are separate choices: a child build is only
9309
+ proportions, and an older character is shown by hair and glasses, never by a
9310
+ stoop unless one is posed. The same poses, gaits and actions work on every
9311
+ build; `humanGaitStrideLength(gait, height, stride, legLength)` gives a build's
9312
+ stride so its feet stay planted.
9313
+
9314
+ ## Clothes
9315
+
9316
+ `outfit` dresses the character as data (any `layers` are drawn over it):
9317
+
9318
+ ```js
9319
+ character({ outfit: { shirt: '#7a8fa6', trousers: '#3b3f46', sleeves: 'long', collar: true, tie: '#2b4f8c' } })
9320
+ character({ outfit: { bottom: 'skirt' } })
9321
+ character({ outfit: { over: 'labCoat' } })
9322
+ ```
9323
+
9324
+ | Field | Choices |
9325
+ |---|---|
9326
+ | `shirt`, `trousers` | Colours (the trousers' colour also colours shorts and a skirt) |
9327
+ | `sleeves` | `short` (default), `long`, `none` |
9328
+ | `bottom` | `trousers` (default), `shorts`, `skirt` |
9329
+ | `collar` | `true` for a shirt collar |
9330
+ | `tie` | A colour, for a tie down the front |
9331
+ | `over`, `overColor` | `apron` or `labCoat`, and its colour |
9332
+
9333
+ The front details (collar, tie, apron, the coat's opening) show from the
9334
+ front and turn away with the body; from behind an apron shows its ties.
9335
+ `basicOutfit(options)` gives the same clothes as layers.
9336
+
9337
+ ## The cast
9338
+
9339
+ `castMember(name, height, changes?)` returns character options for a recurring
9340
+ cast member at an adult `height` (each stands at their own scale of it). The
9341
+ family: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`,
9342
+ `grandma`; at work (from the occupations sheet): `doctor`, `cook`, `builder`,
9343
+ `courier`, `teacher`, `farmer`. `CHARACTER_CAST` has each one's `label`,
9344
+ `group` (`family` or `work`), `scale` and `options`.
9345
+
9346
+ ```js
9347
+ const family = ['man', 'woman', 'girl', 'grandma'].map((name) => character(castMember(name, 280)))
9348
+ ```
9349
+
9350
+ ## Expressions and face marks
9351
+
9352
+ `HUMAN_EXPRESSIONS` sets every face field, so applying one replaces the whole
9353
+ face, and any two blend. Besides the stick figure's faces (`neutral`, `happy`,
9354
+ `joyful`, `sad`, `crying`, `surprised`, `shocked`, `angry`, `furious`,
9355
+ `worried`, `scared`, `confused`, `skeptical`, `thinking`, `sleepy`,
9356
+ `disgusted`, `smug`, `wink`) there are `laughing`, `afraid`, `bored`, `tired`,
9357
+ `embarrassed`, `proud`, `determined`, `affectionate`, `hurt`, `suspicious`,
9358
+ `relieved` and `excited`.
9359
+
9360
+ Three face marks fade in from 0 to 1 and are pose fields like any other (so
9361
+ tracks animate them): `blush` (rosy cheeks, with hatch lines past 0.5),
9362
+ `tears` (a drop under each eye, running down past 0.6) and `sweat` (a bead at
9363
+ the temple).
9364
+
9365
+ ## Everyday actions, held items and meeting hands
9366
+
9367
+ The motion and everyday-life sheets add poses to `HUMAN_POSES`: `sleep`,
9368
+ `stretch`, `sitFloor` (cross-legged), `carry`, `lift`, `push`, `pull`,
9369
+ `drink`, `phone`, `read` and `type` (seated, for a desk). Like every pose they
9370
+ blend, turn and take any face.
9371
+
9372
+ **Holding things.** `holding` puts an item in a hand, as data:
9373
+
9374
+ ```js
9375
+ character({ holding: { right: 'mug' } }) // drink
9376
+ character({ holding: { left: 'bag', right: 'bag' } }) // carry
9377
+ character({ holding: { both: { item: 'parcel', color: '#c9a06a' } } })
9378
+ ```
9379
+
9380
+ Items: `mug`, `phone`, `briefcase`, `bag`, `umbrella` and `broom` (one hand,
9381
+ `left` or `right`), `book` (one hand or `both`) and `parcel` (`both`). Each is
9382
+ drawn at the hand's grip, so it follows the hand through any pose, gait or
9383
+ turn, and sorts with that arm (a mug goes behind the body with the far arm).
9384
+ An umbrella's canopy sits just over the head. `handGrip(joints, side)` gives
9385
+ the grip point and the forearm's direction for drawing anything else in a
9386
+ hand.
9387
+
9388
+ Whether an item shows is a pose field, `held.left`, `held.right` or
9389
+ `held.both` (1 by default; below 0.5 it has been let go), so a track lets go
9390
+ of it at a moment: a parcel handed over is the giver's `held.both` going to 0
9391
+ as the taker's goes to 1.
9392
+
9393
+ **Meeting hands.** `meetHands(kind, a, b, options?)` poses two characters so
9394
+ their hands meet at one point, rather than playing two clips and hoping they
9395
+ line up: `handshake`, `highFive`, `fistBump` and `handOver` (four hands round
9396
+ one parcel). Each partner is `{ character, x, pose? }` on the same ground
9397
+ line; the one on the left turns to face right and the other left,
9398
+ three-quarters on (`view: 'side'` for profiles). Stand them
9399
+ `meetingSpacing(kind, a, b)` apart; the result's `reached` says whether both
9400
+ got there.
9401
+
9402
+ ```js
9403
+ const gap = meetingSpacing('handOver', courier, neighbour)
9404
+ const give = meetHands('handOver', { character: courier, x: 300 }, { character: neighbour, x: 300 + gap })
9405
+ // give.a and give.b are poses to key; give.point is where the parcel is.
9406
+ ```
9407
+
9408
+ ## In the editor
9409
+
9410
+ Select a 🧍 Character and open **Head** in the properties: **Cast** dresses it
9411
+ as a cast member (build, hair, facial hair, glasses and clothes in one step),
9412
+ then **Hair**, **Hair colour**, **Facial hair**, **Glasses**, **Hat** and
9413
+ **Ears** change one thing at a time; **Right hand**, **Left hand** and **Both
9414
+ hands** put an item in them. **Build** lists the builds, with **Legs** and
9415
+ **Arms** sliders. The new expressions and everyday poses are in the **Face**
9416
+ and **Body** lists. All of it is saved as plain fields on the element and
9417
+ exported to video and GIF.
9418
+
9419
+ ## In the gallery
9420
+
9421
+ - **Cast Turnaround**: the whole cast turning through all eight views together.
9422
+ - **Hair, Beards & Hats**: pick a style, colour, facial hair, glasses, hat and
9423
+ face, and see the character turning and in all eight views at once.
9424
+ - **Hand Over**: a courier walks up and hands a parcel over (`meetHands`,
9425
+ `holding`, `held.both`).
9426
+
9427
+ ## Determinism
9428
+
9429
+ Outlines are traced from the same numbers every time (no randomness, no state
9430
+ between frames), so a frame at a given time always draws the same, and the
9431
+ pencil look's boil stays seeded as before. Hair in motion keeps to this: the
9432
+ lag is keyed ahead of time from the motion (`hairFollow`), not accumulated
9433
+ while drawing.
9434
+
9435
+ ---
9436
+
9029
9437
  <!-- docs/acting.md -->
9030
9438
 
9031
9439
  # Cartoon Acting
@@ -9283,6 +9691,42 @@ leaves, with a time, a scene x and y and a length, ready for `drawDustPuff`.
9283
9691
  Any beat can also take `onto` (a scene y): the figure is carried to that floor
9284
9692
  over the beat, as when the line it stands on moves up.
9285
9693
 
9694
+ ### On a v2 character
9695
+
9696
+ `characterScript(target, who, beats, options)` compiles the same beats for a
9697
+ v2 `character()` (see [Character Appearance](character-appearance.md)), so a
9698
+ cast member acts the story the stick figure does:
9699
+
9700
+ ```js
9701
+ import { character, castMember, characterScript, characterTarget, hairFollowTracks } from '@algorisys/tinyfly/characters'
9702
+
9703
+ const amy = character(castMember('youngWoman', 170))
9704
+ const script = characterScript('amy', amy, [
9705
+ { do: 'walk', to: 330, mood: 'happy' },
9706
+ { do: 'say', say: 'Is that box ticking?', mood: 'worried' },
9707
+ { do: 'take' },
9708
+ { do: 'zip', to: -200 },
9709
+ ], { from: 90, style: 'snappy' })
9710
+ const tracks = [...script.tracks, ...hairFollowTracks('amy', script.tracks, amy)]
9711
+ const targets = { amy: characterTarget({ x: 90, y: 300, character: amy }) }
9712
+ ```
9713
+
9714
+ It takes every `scriptTracks` option but `height` (the character's own is
9715
+ used) and returns the same result: tracks, `duration`, `lines`, `beats`,
9716
+ `effects`, and the key poses on the human body. The stick-figure script plans
9717
+ the story (timing, where the figure is, which way it faces, its gait, its
9718
+ speech); its key poses are taken onto the human body, mirrored when it faces
9719
+ left (so `turn` runs negative that way); the human acting pass then winds up,
9720
+ overshoots and overlaps on this body, and the lines are lip-synced over its
9721
+ mouth. The walk phase is rekeyed to the character's own stride (its height and
9722
+ legs: a child takes shorter steps), so its feet stay planted. The `walk`,
9723
+ `walking` and `gait` tracks step the gait as the target draws
9724
+ (`characterPoseOf(props)` folds them into the pose, for drawing by hand). Hands
9725
+ reach in the stick figure's proportions, so a `grab` or a `point` lands near
9726
+ its target on the human body, not exactly on it. Your own gaits go in
9727
+ `options.gaits` for the script and `gaits` on `characterTarget` so the drawing
9728
+ knows them too.
9729
+
9286
9730
  ## Your own actions, gaits and personas
9287
9731
 
9288
9732
  Behaviours of your own are plain values passed where they are used; nothing
@@ -9531,7 +9975,7 @@ lists the problems without compiling.
9531
9975
  ### Whiteboards
9532
9976
 
9533
9977
  `whiteboard()` is a second surface, for lessons that are not code: a board
9534
- (or `theme: 'chalkboard'`) whose texts and hand-drawn marks are declared as
9978
+ (or `theme: 'chalkboard'`, or `'lines'`, ruled paper with a margin) whose texts and hand-drawn marks are declared as
9535
9979
  data, each with an id, and named as places like a code panel's lines:
9536
9980
 
9537
9981
  ```js
@@ -9565,11 +10009,17 @@ everywhere. Colours are theme names (`red`, `blue`, `green`, `orange`, and
9565
10009
  `yellow` on chalk) or any CSS colour. The Board Lesson demo solves an
9566
10010
  equation this way.
9567
10011
 
10012
+ The boards write in a handwriting font, Patrick Hand, when the page loads it
10013
+ (the editor and the examples do, from Google Fonts), else the system's own
10014
+ hand. An arrow bows a little as a hand draws it; it bends round any text it
10015
+ would cross, and `bend` (a fraction of its length, + to its left) sets the bow.
10016
+
9568
10017
  ### Charts
9569
10018
 
9570
- `chart()` is a surface for talking through data: a bar or line chart whose
9571
- values are declared as data, scaled once when it is made (`max`, or a round
9572
- number above the largest value).
10019
+ `chart()` is a surface for talking through data: a bar, line, pie or donut
10020
+ chart whose values are declared as data. Bar and line charts are scaled once
10021
+ when they are made (`max`, or a round number above the largest value); a pie
10022
+ shares its circle by value.
9573
10023
 
9574
10024
  ```js
9575
10025
  const sales = chart({
@@ -9589,13 +10039,26 @@ surfaceScript('hero', { sales }, [
9589
10039
  ], { from: 640, ground: 400, height: 90, facing: -1 })
9590
10040
  ```
9591
10041
 
9592
- Its places are `bar:ID` (on a bar chart) or `point:ID` (on a line chart),
9593
- `label:ID`, `value:ID` and `box`, and they follow the values:
9594
- `sales.anchor('bar:q4', time)` is the bar as it stands then. Its edits:
9595
- `set` (a new `value`; the value label counts along), `show` (grow a
9596
- `hidden` bar in from the axis, or draw the line out to a point; `on: false`
9597
- takes it back) and `highlight`. A bar's top is a floor: a figure standing on
9598
- it is carried up and down as it grows and shrinks, as in the Chart Talk demo.
10042
+ Its places are `bar:ID` (on a bar chart), `point:ID` (on a line chart) or
10043
+ `slice:ID` (on a pie or donut), `label:ID`, `value:ID` and `box`, and they
10044
+ follow the values: `sales.anchor('bar:q4', time)` is the bar as it stands
10045
+ then. Its edits: `set` (a new `value`; the value label counts along, and a
10046
+ pie re-shares its circle), `show` (grow a `hidden` bar in from the axis, draw
10047
+ the line out to a point, or open a slice; `on: false` takes it back),
10048
+ `highlight`, and on a pie `pull` (the slice stands out from the centre). A
10049
+ bar's top is a floor: a figure standing on it is carried up and down as it
10050
+ grows and shrinks, as in the Chart Talk demo.
10051
+
10052
+ A slice can come loose: `traffic.piece('slice:other')` is a piece, and
10053
+ `fling`, `follow` and `move` carry it off as they do a term on a board, so a
10054
+ figure can kick the smallest slice out of the pie.
10055
+
10056
+ Several series (`series: [{ id: 'plan' }, { id: 'actual', color }]`, each
10057
+ datum with `values: { plan: 40, actual: 46 }`) draw grouped bars or one line
10058
+ per series, with a legend (`legend:SERIES` is a place too). Their places and
10059
+ edits take the series after the id: `bar:q1:actual`. Axis titles go in
10060
+ `axis: { x, y }`. A pie shows one series. The Pies & Series card shows all of
10061
+ it.
9599
10062
 
9600
10063
  ### Props as surfaces
9601
10064
 
@@ -9621,6 +10084,14 @@ surfaceScript('hero', { home: homeSurface }, [
9621
10084
  ], { from: 40, ground: floor, height: 100 })
9622
10085
  ```
9623
10086
 
10087
+ A prop's parts come loose too: `carSurface.piece('part:wheel-0-left')` is a
10088
+ piece, and `fling`, `follow` and `move` carry it off, drawn where it went
10089
+ (or as edits from a beat: `then: { edit: 'fling', anchor: 'part:wheel-0-left',
10090
+ at: 'contact' }` on a `kick`). Every anchor and part is also a floor: a figure
10091
+ that leaps `onto: { surface: 'car', anchor: 'anchor:roof' }` is carried as the
10092
+ car lifts, drives or is squashed, the way a bar carries it on a chart. The Kick
10093
+ the Tyre card does both.
10094
+
9624
10095
  A prop stands on its middle, and seen from a little above its front comes
9625
10096
  forward of that line. A figure that walks on the prop's own `y` is inside
9626
10097
  its footprint and seems to walk through the wall; walk it on the prop's
@@ -9725,8 +10196,8 @@ timeline plays: editor previews, players, embeds and exports.
9725
10196
  ## Not yet
9726
10197
 
9727
10198
  - A code panel in the editor (a Code element whose lines and words snap beats)
9728
- - Beat scripts for v2 characters (`scriptTracks` drives the stick figure)
9729
- - Follow-through on hair, tails and ears (character-system milestones 3 and 5)
10199
+ - Beat scripts' hands reaching in the v2 character's own proportions (a `grab`
10200
+ lands near its target, not on it)
9730
10201
 
9731
10202
  ---
9732
10203
 
@@ -10325,7 +10796,9 @@ a cart's `seat`) as the prop moves, turns, bobs with its stride and pitches,
10325
10796
  writing the rider's `x`, `y`, `z` and `rotateY`; `mount: { from: [x, z] }` and
10326
10797
  `dismount: { to: [x, z] }` hop it on and off. `spliceTracks(riderTracks, ride, { from, to })`
10327
10798
  puts the ride into the rider's script, which holds the riding pose
10328
- (`RIDING_POSES.astride` or `.seated`) meanwhile and `place`s it where it got
10799
+ (`RIDING_POSES.astride`, `.seated`, `.driving` with the hands on a wheel, or
10800
+ `.cycling`; `pedallingKeys({ start, end, cadence })` keys the legs round the
10801
+ pedals on the cycling pose) meanwhile and `place`s it where it got
10329
10802
  off. A character in a scene is drawn part by part, each part at its own depth
10330
10803
  (`characterPartsInView`), so a leg astride a horse shows on each side of it.
10331
10804
  A seat inside a closed cabin (a car's) is not handled yet: its glass is opaque
@@ -12931,7 +13404,7 @@ magnet.addEventListener('pointerleave', () => {
12931
13404
 
12932
13405
  <!-- capabilities: generated from the library -->
12933
13406
 
12934
- # tinyfly capabilities (v0.97.0)
13407
+ # tinyfly capabilities (v0.99.0)
12935
13408
 
12936
13409
  Generated from the library itself: every name below is accepted, and names not listed are rejected (beat scripts, code panels and `checkTracks` say which name was probably meant).
12937
13410
 
@@ -13075,6 +13548,8 @@ With `style.hands`, each hand has `hand.left.<field>` / `hand.right.<field>` pro
13075
13548
 
13076
13549
  `scriptTracks(target, beats, { from, ground, height, facing, style })`. A beat has these fields only: `do`, `at`, `for`, `to`, `toward`, `mood`, `say`, `pose`, `target`, `onto`. Times are ms; `to` and `target` are scene px; `onto` is a floor's scene y.
13077
13550
 
13551
+ `characterScript(target, who, beats, options)` compiles the same beats for a v2 `character()` on a `characterTarget` (every option but `height`; the same result, its key poses on the human body; the walk phase keyed to that character's stride, and `walk` / `walking` / `gait` tracks that step the gait as the target draws). Add `hairFollowTracks(target, tracks, who)` after it so hanging hair swings.
13552
+
13078
13553
  | `do` | Needs | What happens |
13079
13554
  |---|---|---|
13080
13555
  | `walk` | `to` | Walks to `to` in the walk gait. |
@@ -13181,17 +13656,30 @@ Prop beat fields: `do`, `at`, `for`, `to`, `toward`, `speed`, `open`, `on`, `hei
13181
13656
  | `house()` | building | `door` (open), `lights` (on), `shake`, `smoke` | `door`, `lights` | door, doorstep, ridge, chimney |
13182
13657
  | `helicopter()` | aircraft | `takeOff`, `fly` (to), `hover`, `land` | `rotor`, `blur` | seat, door, rotor, skids, hook |
13183
13658
  | `airplane()` | aircraft | `takeOff` (to), `fly` (to), `loop`, `land` (to) | `rotor`, `blur` | seat, nose, tail, wingtip |
13184
- | `horse()` | animal | `walk` (to), `trot` (to), `canter` (to), `gallop` (to), `neigh`, `sit`, `jump`, `nod`, `swish`, `graze`, `rear`, `buck` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front, hitch, saddle |
13185
- | `dog()` | animal | `walk` (to), `trot` (to), `run` (to), `gallop` (to), `bark`, `sit`, `jump`, `nod`, `swish`, `wag`, `sniff` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front, leash |
13186
- | `cat()` | animal | `walk` (to), `trot` (to), `run` (to), `gallop` (to), `meow`, `sit`, `jump`, `nod`, `swish`, `arch`, `pounce` (to) | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front |
13187
- | `cow()` | animal | `walk` (to), `trot` (to), `moo`, `sit`, `jump`, `nod`, `swish`, `graze` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front |
13188
- | `songbird()` | bird | `hop` (to), `walk` (to), `peck`, `flap`, `tweet`, `fly` (to), `land` | `spread`, `flap`, `wingbeat`, `flapping`, `peck`, `step`, `stepping`, `leg.left`, `leg.right` | beak, head, back, feet |
13189
- | `crow()` | bird | `hop` (to), `walk` (to), `peck`, `flap`, `caw`, `fly` (to), `land` | `spread`, `flap`, `wingbeat`, `flapping`, `peck`, `step`, `stepping`, `leg.left`, `leg.right` | beak, head, back, feet |
13659
+ | `horse()` | animal | `walk` (to), `trot` (to), `canter` (to), `gallop` (to), `neigh`, `sit`, `lie`, `jump`, `nod`, `swish`, `graze`, `rear`, `buck` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `ears`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front, hitch, saddle |
13660
+ | `dog()` | animal | `walk` (to), `trot` (to), `run` (to), `gallop` (to), `bark`, `sit`, `lie`, `jump`, `nod`, `swish`, `wag`, `sniff` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `ears`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front, leash |
13661
+ | `cat()` | animal | `walk` (to), `trot` (to), `run` (to), `gallop` (to), `meow`, `sit`, `lie`, `jump`, `nod`, `swish`, `arch`, `pounce` (to) | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `ears`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front |
13662
+ | `cow()` | animal | `walk` (to), `trot` (to), `moo`, `sit`, `lie`, `jump`, `nod`, `swish`, `graze` | `walk`, `walking`, `gait`, `neck`, `tail`, `wag`, `ears`, `fl.swing`, `fl.knee`, `fl.ankle`, `fr.swing`, `fr.knee`, `fr.ankle`, `hl.swing`, `hl.knee`, `hl.ankle`, `hr.swing`, `hr.knee`, `hr.ankle` | back, head, mouth, front |
13663
+ | `songbird()` | bird | `hop` (to), `walk` (to), `peck`, `flap`, `tweet`, `fly` (to), `glide` (to), `land` | `spread`, `flap`, `wingbeat`, `flapping`, `peck`, `step`, `stepping`, `leg.left`, `leg.right` | beak, head, back, feet |
13664
+ | `crow()` | bird | `hop` (to), `walk` (to), `peck`, `flap`, `caw`, `fly` (to), `glide` (to), `land` | `spread`, `flap`, `wingbeat`, `flapping`, `peck`, `step`, `stepping`, `leg.left`, `leg.right` | beak, head, back, feet |
13190
13665
  | `chicken()` | bird | `hop` (to), `walk` (to), `peck`, `flap`, `cluck`, `flutter` | `spread`, `flap`, `wingbeat`, `flapping`, `peck`, `step`, `stepping`, `leg.left`, `leg.right` | beak, head, back, feet |
13191
13666
 
13192
13667
  ## Character (v2 human)
13193
13668
 
13194
- Poses: `rest`, `wave`, `cheer`, `point`, `handsOnHips`, `think`, `shrug`, `sit`, `kneel`, `crouch`, `crawl`, `lieDown`. Expressions: `neutral`, `happy`, `joyful`, `sad`, `crying`, `surprised`, `shocked`, `angry`, `furious`, `worried`, `scared`, `confused`, `skeptical`, `thinking`, `sleepy`, `disgusted`, `smug`, `wink`. Gags: `take`, `doubleTake`, `windUp`, `land`, `tremble`, `deflate`.
13669
+ Poses: `rest`, `wave`, `cheer`, `point`, `handsOnHips`, `think`, `shrug`, `sit`, `kneel`, `crouch`, `crawl`, `lieDown`, `sleep`, `stretch`, `sitFloor`, `carry`, `lift`, `push`, `pull`, `drink`, `phone`, `read`, `type`. Expressions: `neutral`, `happy`, `joyful`, `sad`, `crying`, `surprised`, `shocked`, `angry`, `furious`, `worried`, `scared`, `confused`, `skeptical`, `thinking`, `sleepy`, `disgusted`, `smug`, `wink`, `laughing`, `afraid`, `bored`, `tired`, `embarrassed`, `proud`, `determined`, `affectionate`, `hurt`, `suspicious`, `relieved`, `excited`. Gags: `take`, `doubleTake`, `windUp`, `land`, `tremble`, `deflate`.
13670
+
13671
+ Appearance options of `character({ … })`, all plain data that turns with the head (see docs/character-appearance.md):
13672
+
13673
+ - `build`: `standard`, `slim`, `tall`, `short`, `broad`, `curvy`, `stocky`, `kid`, `child`, `toddler`
13674
+ - `hair`: `bald`, `buzzCut`, `crewCut`, `short`, `sidePart`, `sideSwept`, `slickBack`, `quiff`, `spiky`, `undercut`, `curlyCrop`, `afro`, `wavyCrop`, `shortLocs`, `flatTop`, `receding`, `thinning`, `pixie`, `bob`, `longBob`, `wavyBob`, `shoulderStraight`, `shoulderWaves`, `longStraight`, `longWaves`, `longCurls`, `longLocs`, `lowPonytail`, `highPonytail`, `ponytail`, `sidePonytail`, `topBun`, `lowBun`, `singleBraid`, `twinBraids`, `braids` (colours: `black`, `brown`, `chestnut`, `auburn`, `blond`, `ginger`, `gray`, `white` in `HAIR_COLORS`)
13675
+ - `facialHair`: `cleanShaven`, `stubble`, `pencilMoustache`, `shortMoustache`, `chevron`, `handlebar`, `walrus`, `goatee`, `vanDyke`, `circleBeard`, `shortBoxed`, `fullBeard`, `longBeard`, `roundedBeard`, `pointedBeard`, `chinStrap`, `soulPatch`, `sideburns`, `muttonChops`, `moustacheStubble`
13676
+ - `glasses`: `round`, `square`, `sunglasses`; `hat`: `cap`, `beanie`, `hardHat`, `sunHat`, `bowler`; `ears: true`
13677
+ - `outfit`: `{ shirt, trousers, sleeves: short | long | none, bottom: trousers | shorts | skirt, collar, tie: colour, over: apron | labCoat, overColor }`
13678
+ - `castMember(name, height)`: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`, `grandma`, `doctor`, `cook`, `builder`, `courier`, `teacher`, `farmer`
13679
+ - Face marks (pose fields, 0–1): `blush`, `tears`, `sweat`
13680
+ - Hair in motion (pose fields): `hair.swing` (degrees round the head, + toward its left), `hair.trail` (head radii back), `hair.lift` (head radii up); key them with `hairFollowTracks(target, tracks, who)` after the character's tracks, or `hairFollow` + `hairMotionAt` when posing per frame
13681
+ - `holding`: `mug` (left or right), `phone` (left or right), `book` (one hand or both), `bag` (left or right), `briefcase` (left or right), `umbrella` (left or right), `broom` (left or right), `parcel` (both); pose fields `held.left`, `held.right`, `held.both` (below 0.5 lets go); `handGrip(joints, side)`
13682
+ - `meetHands(kind, a, b)` (stand them `meetingSpacing(kind, a, b)` apart): `handshake`, `highFive`, `fistBump`, `handOver`
13195
13683
 
13196
13684
  ## Code panel
13197
13685
 
@@ -13252,7 +13740,7 @@ Edits:
13252
13740
 
13253
13741
  ### board
13254
13742
 
13255
- `whiteboard({ x, y, width, height, theme?: whiteboard | chalkboard, fontSize?, items: [{ id, text, at: [x, y], size?, color?, hidden? } | { id, mark: circle | box | underline | arrow, around? | from?, to?, color?, hidden? }] })`
13743
+ `whiteboard({ x, y, width, height, theme?: whiteboard | chalkboard | lines, fontSize?, items: [{ id, text, at: [x, y], size?, color?, hidden? } | { id, mark: circle | box | underline | arrow, around? | from?, to?, bend?, color?, hidden? }] })`
13256
13744
 
13257
13745
  Anchors:
13258
13746
  - `box`: the whole board
@@ -13270,19 +13758,22 @@ Edits:
13270
13758
 
13271
13759
  ### chart
13272
13760
 
13273
- `chart({ x, y, width, height, kind: bar | line, data: [{ id, label?, value, hidden? }], max?, title?, theme?: light | dark, decimals?, prefix?, suffix?, values? })`
13761
+ `chart({ x, y, width, height, kind: bar | line | pie | donut, data: [{ id, label?, value | values: { SERIES: value }, hidden? }], series?: [{ id, label?, color? }], max?, title?, axis?: { x?, y? }, legend?, theme?: light | dark, decimals?, prefix?, suffix?, values? })`
13274
13762
 
13275
13763
  Anchors:
13276
13764
  - `box`: the whole chart
13277
- - `bar:ID`: a bar (bar charts), as it stands at the time: stand on its top (it carries a figure as it grows), point at it
13278
- - `point:ID`: a point on the line (line charts), as it stands at the time
13279
- - `label:ID`: its label under the axis
13280
- - `value:ID`: its value label, above it
13765
+ - `bar:ID`: a bar (bar charts; bar:ID:SERIES with several series), as it stands at the time: stand on its top (it carries a figure as it grows), point at it
13766
+ - `point:ID`: a point on the line (line charts; point:ID:SERIES with several series), as it stands at the time
13767
+ - `slice:ID`: a slice of a pie or donut, as it stands at the time (its middle; pulled out, it moves): point at it, make it a piece
13768
+ - `label:ID`: its label: under the axis, or beside the slice
13769
+ - `value:ID`: its value label: above the bar or point (value:ID:SERIES), or on the slice
13770
+ - `legend:SERIES`: a series in the legend (several series)
13281
13771
 
13282
13772
  Edits:
13283
- - `set`: bar or point anchors; { at, value, duration? }: animate to a new value; its value label counts along
13284
- - `show`: bar or point anchors given `hidden`; { at, duration?, on? }: grow a bar in from the axis, or draw the line out to a point (on: false takes it back)
13285
- - `highlight`: bar or point anchors; { at, duration?, on? }: colour it out (on: false clears)
13773
+ - `set`: bar, point or slice anchors; { at, value, duration? }: animate to a new value; its value label counts along (a pie re-shares the circle)
13774
+ - `show`: bar, point or slice anchors given `hidden`; { at, duration?, on? }: grow a bar in from the axis, draw the line out to a point, or open a slice (on: false takes it back)
13775
+ - `highlight`: bar, point or slice anchors; { at, duration?, on? }: colour it out (on: false clears)
13776
+ - `pull`: slice anchors; { at, duration?, on? }: pull the slice out from the centre (on: false puts it back)
13286
13777
 
13287
13778
  ### prop
13288
13779
 
@@ -13291,12 +13782,14 @@ Edits:
13291
13782
  Anchors:
13292
13783
  - `box`: the prop’s whole box
13293
13784
  - `anchor:NAME`: one of its rig’s anchors (door, seat, branch, ridge…), as posed at the time
13294
- - `part:ID`: one of its parts as seen at the time (window-1, door-left, wheel-0-left…)
13295
- - `control:NAME`: where the parts a control moves or lights are (control:door is the doors, control:lights the lamps)
13785
+ - `part:ID`: one of its parts as seen at the time (window-1, door-left, wheel-0-left…); it can come loose as a piece
13786
+ - `control:NAME`: where the parts a control moves or lights are (control:door is the doors, control:lights the lamps; a control of the whole prop, like lift, is its box)
13296
13787
 
13297
13788
  Edits:
13298
13789
  - `set`: control anchors; { at, value, duration? }: move a control to a value
13299
13790
  - `switch`: control anchors; { at, on?, duration? }: a control to its full value (open, on), or back to its rest value with on: false
13791
+ - `move`: a part; { at, to: an anchor name or { x, y }, duration? }: carry the part there, loose
13792
+ - `fling`: a part; { at, velocity?, spin?, gravity?, duration? }: knock the part off on a spinning arc
13300
13793
 
13301
13794
  ## Camera shots (`cameraTracks(shots, { stage })`)
13302
13795