@algorisys/tinyfly 0.98.0 → 0.100.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 +81 -14
  3. package/docs/character-appearance.md +96 -10
  4. package/docs/editor-guide.md +76 -4
  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 -9
  9. package/docs/maps.md +2 -2
  10. package/docs/props.md +61 -1
  11. package/docs/scene-3d.md +3 -1
  12. package/docs/teaching.md +1 -1
  13. package/lib/addons/characters.js +6709 -5248
  14. package/lib/browser/tinyfly.iife.js +15 -15
  15. package/lib/browser/tinyfly.js +7532 -6071
  16. package/lib/browser/tinyfly.umd.js +15 -15
  17. package/lib/types/characters/acting/character-script.d.ts +56 -0
  18. package/lib/types/characters/acting/index.d.ts +1 -0
  19. package/lib/types/characters/acting/script.d.ts +9 -0
  20. package/lib/types/characters/capabilities.d.ts +2 -0
  21. package/lib/types/characters/character.d.ts +21 -2
  22. package/lib/types/characters/chart.d.ts +52 -14
  23. package/lib/types/characters/hair-follow.d.ts +82 -0
  24. package/lib/types/characters/hands/held-items.d.ts +6 -2
  25. package/lib/types/characters/head/face.d.ts +6 -1
  26. package/lib/types/characters/head/hair.d.ts +27 -1
  27. package/lib/types/characters/head/head-look.d.ts +5 -2
  28. package/lib/types/characters/head/index.d.ts +1 -1
  29. package/lib/types/characters/index.d.ts +4 -2
  30. package/lib/types/characters/interactions.d.ts +60 -0
  31. package/lib/types/characters/props/draw.d.ts +9 -0
  32. package/lib/types/characters/props/families/animals.d.ts +6 -0
  33. package/lib/types/characters/props/families/birds.d.ts +16 -0
  34. package/lib/types/characters/props/families/furniture.d.ts +102 -0
  35. package/lib/types/characters/props/index.d.ts +1 -0
  36. package/lib/types/characters/props/presets.d.ts +15 -2
  37. package/lib/types/characters/props/prop-surface.d.ts +14 -3
  38. package/lib/types/characters/props/ride-3d.d.ts +34 -2
  39. package/lib/types/characters/props/target.d.ts +5 -1
  40. package/lib/types/characters/scenery.d.ts +126 -0
  41. package/lib/types/characters/species/human-motion.d.ts +17 -0
  42. package/lib/types/characters/species/human.d.ts +8 -0
  43. package/lib/types/characters/wardrobe/basic-outfit.d.ts +16 -5
  44. package/lib/types/characters/whiteboard.d.ts +13 -1
  45. package/llms-full.txt +400 -70
  46. package/llms.txt +29 -29
  47. package/package.json +2 -2
  48. package/skills/tinyfly/SKILL.md +22 -10
package/README.md CHANGED
@@ -54,14 +54,14 @@ 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`), and 30 expressions with blush, tears and sweat ([guide](docs/character-appearance.md))
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))
58
58
  - **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. See [docs/dance.md](docs/dance.md)
59
59
  - **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
60
  - **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
61
61
  - **The drawing hand** - `drawnPathTarget()` draws a sketched stroke on from a `draw` track while a cartoon hand holds the pencil at its end in a writing grip; the same hand can hold the eraser. `handAt()` gives one hand for a whole scene: it follows each stroke, lifts and glides to the next, and enters and leaves the page
62
62
  - **Erasing** - An eraser rubs out part of a target (`erasable()`, animated by an `erase` track) or of anything drawn in code (`withErased()`); clip-based, so it works in the browser and headless alike
63
63
  - **Cartoon hands** - A hand rig in 3D, drawn flat: thumb and fingers posed by numbers (`index.curl`, `thumb.across`, `spread`, `turn`), ready-made shapes (fist, point, thumbs-up, peace, OK, pinch, wave, pencil grip…), left and right, four or five fingers, in every look; the animator's hand and (opt-in) character gloves are built on it. See [docs/cartoon-hands.md](docs/cartoon-hands.md)
64
- - **Cartoon acting** - `actTracks()` turns the same key poses into acted motion: wind-ups, overshoot that settles or wobbles, joints that overlap (hips lead, wrists drag), eyes that dart ahead and blink on head turns, moving holds and jump squash, in `full`, `snappy` or `limited` styles. Gags come as data (`gag('take')`, double take, wind-up, tremble). A line of action (`bend`) curves the spine, and gaits have personality (bouncy, double bounce, sneak, strut, tired, run). Lip-sync works from text, Latin or Devanagari. `scriptTracks()` compiles a story written as beats (`{ do: 'walk', to: 640 }`, `{ do: 'take' }`, `{ do: 'say', say: '…' }`) into all of it. `cameraTracks()` films it with push-ins, cuts, shakes and follows. The cartoon zip (`{ do: 'zip' }`) has the legs wheel in place before it is gone. Figures can act on code, Animator vs Animation style: `codePanel()` lays a listing out so every line and word is a place in the scene, and beats leap onto lines, point at them and swipe them away (`{ do: 'swipe', target: code.line(7) }`), with the line wiped, knocked off the panel or blurred out of focus on the frames the hand crosses it. Words come loose too: a figure grabs `var` and throws it, kicks another out of a loop, carries a stray `;` to where it belongs, pushes a word along its line (the text closing up behind it), and writes `mut` into a line by hand. A figure standing on a line rides it when a gap above closes (`code.ride()`). Code is one *surface*; `whiteboard()` is another, a board or chalkboard of texts and hand-drawn circles, boxes, underlines and arrows, so a figure can work through a lesson that is not code, `chart()` a third, bar and line charts whose bars a figure points at, highlights and stands on as they grow, and `propSurface()` makes any prop one, so a figure opens a car's door or switches a house's lights on. Places on a surface have names (`line:7`, `token:4:Println`, `term:eq:+ 4`), and `surfaceScript()` takes a whole scene as JSON: beats aim at named places and say what the surface does in answer, at the moment the hand touches or lets go. Props give the story a world: cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane, a horse, dogs, cats, cows and birds are 3D rigs drawn with the figures' pens, so they turn toward the camera and boil in pencil, or as line art beside stick figures. They act from beats through the same principles (they rock back before they go, dip on the stop, skid, bump, sway, take off and loop; animals walk, trot and gallop with their feet keeping pace, sit and jump; birds hop, peck, flap and fly up to a perch), with an exaggeration dial, and figures can ride them. See [docs/props.md](docs/props.md). Your own behaviours are plain values: `defineAction()` (from beats or timed pose steps), `defineGait()`, and `persona()` for a recurring character's look, acting style, gait, usual face and stance. In the editor, a Character's **Acting** section acts its keyed poses in a style and adds gags, walks in a gait and lip-synced lines, with drawing on twos as a timeline setting. Characters come in builds (slim, kid, broad, curvy, stocky), and the v2 human has its own line of action, gaits and gags, posed in 3D so they read from every view. It also adds speed lines from earlier frames (`drawStickSmear()`), dust puffs, impact stars, and drawing on twos for video (`drawingRate`). Output is plain keyframes. See [docs/acting.md](docs/acting.md)
64
+ - **Cartoon acting** - `actTracks()` turns the same key poses into acted motion: wind-ups, overshoot that settles or wobbles, joints that overlap (hips lead, wrists drag), eyes that dart ahead and blink on head turns, moving holds and jump squash, in `full`, `snappy` or `limited` styles. Gags come as data (`gag('take')`, double take, wind-up, tremble). A line of action (`bend`) curves the spine, and gaits have personality (bouncy, double bounce, sneak, strut, tired, run). Lip-sync works from text, Latin or Devanagari. `scriptTracks()` compiles a story written as beats (`{ do: 'walk', to: 640 }`, `{ do: 'take' }`, `{ do: 'say', say: '…' }`) into all of it, and `characterScript()` compiles the same beats for a v2 character from the cast, on its own body and stride. `cameraTracks()` films it with push-ins, cuts, shakes and follows. The cartoon zip (`{ do: 'zip' }`) has the legs wheel in place before it is gone. Figures can act on code, Animator vs Animation style: `codePanel()` lays a listing out so every line and word is a place in the scene, and beats leap onto lines, point at them and swipe them away (`{ do: 'swipe', target: code.line(7) }`), with the line wiped, knocked off the panel or blurred out of focus on the frames the hand crosses it. Words come loose too: a figure grabs `var` and throws it, kicks another out of a loop, carries a stray `;` to where it belongs, pushes a word along its line (the text closing up behind it), and writes `mut` into a line by hand. A figure standing on a line rides it when a gap above closes (`code.ride()`). Code is one *surface*; `whiteboard()` is another, a board or chalkboard of texts and hand-drawn circles, boxes, underlines and arrows, so a figure can work through a lesson that is not code, `chart()` a third, bar, line, pie and donut charts whose bars a figure points at, highlights and stands on as they grow, with slices it pulls out or kicks loose as pieces, several series with a legend, and axis titles, and `propSurface()` makes any prop one, so a figure opens a car's door or switches a house's lights on, kicks a wheel loose (parts are pieces), and rides on the roof as the car lifts (anchors and parts are floors). Boards write in a handwriting font, bend arrows round what is in the way, and come as ruled paper too. In the editor, a 🧍 Character's **Beats** box compiles a story into its tracks, aimed at a ⌨ **Code** element's lines or a 📊 **Chart** element's bars (which carry the figure as they grow), and riders drive or pedal (`RIDING_POSES.driving`, `pedallingKeys`). Places on a surface have names (`line:7`, `token:4:Println`, `term:eq:+ 4`), and `surfaceScript()` takes a whole scene as JSON: beats aim at named places and say what the surface does in answer, at the moment the hand touches or lets go. Props give the story a world: cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane, furniture with the places a figure uses them at (a chair, a desk, a bed, a door, a wheelchair), a horse, dogs, cats, cows, goats, rabbits, squirrels and birds from songbirds to owls and parrots are 3D rigs drawn with the figures' pens, so they turn toward the camera and boil in pencil, or as line art beside stick figures. They act from beats through the same principles (they rock back before they go, dip on the stop, skid, bump, sway, take off and loop; animals walk, trot and gallop with their feet keeping pace, sit and jump; birds hop, peck, flap and fly up to a perch), with an exaggeration dial, and figures can ride them. `scenery()` puts a sky over it all (the sun and moon on their arcs, clouds on the wind, rain and snow, hills or a city) or a room with a window, with the hour, the clouds and the weather as tracks, and `scenePreset` gives park, street, office and home scenes. See [docs/props.md](docs/props.md). Your own behaviours are plain values: `defineAction()` (from beats or timed pose steps), `defineGait()`, and `persona()` for a recurring character's look, acting style, gait, usual face and stance. In the editor, a Character's **Acting** section acts its keyed poses in a style and adds gags, walks in a gait and lip-synced lines, with drawing on twos as a timeline setting. Characters come in builds (slim, kid, broad, curvy, stocky), and the v2 human has its own line of action, gaits and gags, posed in 3D so they read from every view. It also adds speed lines from earlier frames (`drawStickSmear()`), dust puffs, impact stars, and drawing on twos for video (`drawingRate`). Output is plain keyframes. See [docs/acting.md](docs/acting.md)
65
65
  - **Pencil story example** - `examples/pencil-story-hindi/index.html` tells a short Hindi story (प्यासा राहगीर, the thirsty traveller) Pencilmation-style with the browser bundle alone: the hand draws the scene and writes the narration, then rubs out the pot
66
66
  - **Captions** - `toSRT()` / `toWebVTT()` from narration cues or from a timeline's markers
67
67
 
@@ -90,8 +90,8 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
90
90
  - **Media in embeds** - Exported/embedded HTML carries the media, and the player auto-discovers and syncs it (`[data-tinyfly-media]`), so audio/video play in time wherever the animation is embedded
91
91
 
92
92
  ### Visual Editor
93
- - **AI prompt → animation** - Describe an animation in plain language ("a title that fades up with a shine", "three cards sliding in one after another") and generate a fully editable timeline. Bring your own API key for **OpenAI, Google Gemini, or Anthropic** — keys stay in your browser and are sent directly to the provider. The model emits tinyfly's JSON schema, which loads through the same path as the editable examples, so generated animations are ordinary keyframes you can tweak
94
- - **Any canvas / aspect ratio** - The preview artboard follows the project canvas (DOM, Canvas, and SVG renderers) and fits-to-view, so a vertical 9:16 promo or any custom size previews at true proportions; samples can declare their own canvas size
93
+ - **AI prompt → animation** - Describe an animation in plain language ("a title that fades up with a shine", "three cards sliding in one after another") and generate a fully editable timeline. Bring your own API key for **OpenAI, Google Gemini, or Anthropic** — keys stay in your browser and are sent directly to the provider. The model emits tinyfly's JSON schema, which loads through the same path as the editable examples, so generated animations are ordinary keyframes you can tweak. Ask for a story and it casts a character (`cast: 'grandma'`) and writes its beats (walk, look, a take, a line, a zip) rather than keyframes; the beats compile on load with `characterScript()` and stay on the element
94
+ - **Any canvas / aspect ratio** - The preview artboard follows the project canvas (DOM, Canvas, and SVG renderers), with elements selected, dragged and resized on the stage in all three, and fits-to-view, so a vertical 9:16 promo or any custom size previews at true proportions; samples can declare their own canvas size
95
95
  - **Device-frame preset** - One click stamps a device mockup (rounded body, camera/notch, and a rounded video "screen") sized to the canvas, in **Phone / Landscape / Tablet** variants — drop a screen-recording into the screen's source for an app promo
96
96
  - **Timeline view** - Visual keyframe editing with drag-and-drop
97
97
  - **Camera** - Animate a pan/zoom/rotate over the whole stage (a reserved `Camera` layer driven by ordinary tracks). One-click add, a **🎥 Camera inspector** (Pan/Zoom/Rotation keyframed at the playhead), on-stage **✋ Pan** dragging, and a dedicated 🎥 lane at the top of the timeline; applies in every preview, export, and embed. Ready-made Push In / Pan Across / Orbit Reveal samples
@@ -100,7 +100,7 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
100
100
  - **Loop check** - `tinyfly video scene.mjs --loop-check` renders five frames and says whether a video loops: whether the frame at the duration matches the first, and whether the last → first seam looks like any other step (exit 1 when it does not). `--frames 0,79,88` renders stills at chosen frames. See [docs/video-rendering.md](docs/video-rendering.md#loops)
101
101
  - **Bloom** - `bloom: true` on a video scene adds a deterministic glow around bright things (bright pass, blur, add; no `ctx.filter`), and 3D materials take `emissive` light that shines in the dark and feeds it. `applyBloom(ctx)` works on any 2D canvas. See [docs/video-rendering.md](docs/video-rendering.md#bloom)
102
102
  - **Light trails** - `trailSamples` + `drawTrail` draw comets and light streaks on any 2D canvas: a tapering, fading band with a round head, smooth at any speed, and deterministic (the trail is where the thing was, asked of the timeline, not a frame history). 3D scenes get `line` and `trail` objects whose segments sort by depth among the meshes. See [docs/video-rendering.md](docs/video-rendering.md#light-trails) and [docs/scene-3d.md](docs/scene-3d.md#lines-and-trails)
103
- - **3D scenes** - `@algorisys/tinyfly/scene-3d`: cameras, lights and meshes (box, sphere, cylinder, cone, torus, floor, any SVG path extruded) as JSON in metres, animated by ordinary tracks (`stage/box`), cut between cameras with one keyframe, drawn on a plain canvas with flat, smooth or toon shading, ink outlines and fog: in the browser, in Workers, and to MP4 in Node. Characters stand in scenes and dance, seen by any camera, in their pen looks (clean, pencil) or as solid figures (`characterObjects`); props (cars, houses, trees, animals, birds) stand in them by preset name (`propObjects`), sorted a column at a time so figures walk round them rightly, and lit by the scene's lights (a sunset, a night with lit windows). Both are scripted in world metres (`propScript3D`, `characterScript3D`): drive or walk to a point or along a path, wheels and feet keeping pace with the ground. In the editor, a 🧊 3D Scene element builds them without code: add shapes, characters and lights, key them, dance from the playhead, cut between cameras. No WebGL needed (about 7 KB gzipped, its own entry and CDN script); for big or tangled scenes the optional WebGL2 renderer (`@algorisys/tinyfly/scene-3d/webgl`) adds a depth buffer and light per pixel. See [docs/scene-3d.md](docs/scene-3d.md)
103
+ - **3D scenes** - `@algorisys/tinyfly/scene-3d`: cameras, lights, meshes (box, sphere, cylinder, cone, torus, floor, any SVG path extruded) and props from the catalog (also from the editor's 3D Scene palette) as JSON in metres, animated by ordinary tracks (`stage/box`), cut between cameras with one keyframe, drawn on a plain canvas with flat, smooth or toon shading, ink outlines and fog: in the browser, in Workers, and to MP4 in Node. Characters stand in scenes and dance, seen by any camera, in their pen looks (clean, pencil) or as solid figures (`characterObjects`); props (cars, houses, trees, animals, birds) stand in them by preset name (`propObjects`), sorted a column at a time so figures walk round them rightly, and lit by the scene's lights (a sunset, a night with lit windows). Both are scripted in world metres (`propScript3D`, `characterScript3D`): drive or walk to a point or along a path, wheels and feet keeping pace with the ground. In the editor, a 🧊 3D Scene element builds them without code: add shapes, characters and lights, key them, dance from the playhead, cut between cameras. No WebGL needed (about 7 KB gzipped, its own entry and CDN script); for big or tangled scenes the optional WebGL2 renderer (`@algorisys/tinyfly/scene-3d/webgl`) adds a depth buffer and light per pixel. See [docs/scene-3d.md](docs/scene-3d.md)
104
104
  - **3D transforms** - Cards, images, text and shapes turn in 3D (`rotateX`, `rotateY`, `z`, `perspective`, `backfaceVisibility`) and land on the same pixels in DOM, SVG, Canvas (true perspective, also headless) and WebGL, checked against each browser's own CSS. One documented transform order everywhere; Tilt / Turn / Depth / Perspective fields in the editor; 3D Card Flip and Cover Flow samples. Quaternion tracks with `interpolation: "slerp"` turn without gimbal lock; the engine's `vec3`, `quat` and `mat4` helpers are plain arrays. The first steps of [3D support](docs/3d-support-plan.md). See [docs/3d-rotations.md](docs/3d-rotations.md)
105
105
  - **Shape morph** - 🌀 Tween one path into another over the timeline (engine-level path interpolation); plays in every renderer, export, and embed
106
106
  - **Grid, snapping & guides** - ▦ 20px grid, 🧲 snapping of drag/resize to grid/element-edges/artboard with live alignment guides, and 📏 rulers with draggable guides
@@ -189,7 +189,7 @@ for what you import:
189
189
  | `@algorisys/tinyfly/teach` | `lesson()` step builder and diagram primitives (cells, pointer, stack, queue, table, pipeline) | Anywhere |
190
190
  | `@algorisys/tinyfly/react`, `@algorisys/tinyfly/vue`, `@algorisys/tinyfly/svelte`, `@algorisys/tinyfly/solid` | `useTinyfly` hooks, a Svelte action and a Solid primitive: `live` animations scoped to a component and reverted on unmount | Browser (frameworks are optional peer dependencies) |
191
191
  | `@algorisys/tinyfly/maps` | Animated maps: OpenStreetMap tiles or an offline world outline, places, routes that draw on, a camera that flies (`mapTarget`, `mapFlyTracks`, `fitView`, `WORLD_CITIES`) | Anywhere with a Canvas 2D context (tiles need a network) |
192
- | `@algorisys/tinyfly/characters` | Poseable stick figure: `stickFigureTarget`, `poseTracks`, `POSES`, `blendPose`, `walkPose`, `drawStickFigure`; `stickFigureJoints` and `layers` for costumes, hair and props; `turn`, `sit` and ground contact; an organic look by default (`classic` keeps the old one); **characters v2**: `character()` / `characterTarget()`, turnarounds front to back, contact, reaching, clean / pencil / silhouette looks; `hair`, `facialHair`, `glasses`, `hat`, `ears`, `build`, `outfit` as data, `castMember()`, `HUMAN_EXPRESSIONS` with face marks | Anywhere with a Canvas 2D context |
192
+ | `@algorisys/tinyfly/characters` | Poseable stick figure: `stickFigureTarget`, `poseTracks`, `POSES`, `blendPose`, `walkPose`, `drawStickFigure`; `stickFigureJoints` and `layers` for costumes, hair and props; `turn`, `sit` and ground contact; an organic look by default (`classic` keeps the old one); **characters v2**: `character()` / `characterTarget()`, turnarounds front to back, contact, reaching, clean / pencil / silhouette looks; `hair`, `facialHair`, `glasses`, `hat`, `ears`, `face`, `feet`, `build`, `outfit` as data, `castMember()`, `HUMAN_EXPRESSIONS` with face marks; `embrace`, `helpUp`, `scenery` | Anywhere with a Canvas 2D context |
193
193
  | `@algorisys/tinyfly/headless` | `renderVideo`, `renderStills`, `FrameRenderer`: render a scene to MP4 or PNGs (see [Rendering Video from Code](docs/video-rendering.md)) | Node (`@napi-rs/canvas` optional peer, ffmpeg) |
194
194
  | `@algorisys/tinyfly/browser` | One script-tag bundle (`tinyfly.iife.js`): the engine, player, drivers, interaction, the GSAP-style `live` / `tf` facades, teaching-embed controls and mounting, and the `characters` stick figure. Not included: `export`, `adapters`, `teach`, the framework hooks, `headless` | Browser |
195
195
 
@@ -237,7 +237,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
237
237
  itself.
238
238
 
239
239
  ```html
240
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.98.0/cdn/tinyfly.iife.js"></script>
240
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly.iife.js"></script>
241
241
  <script>
242
242
  tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
243
243
 
@@ -273,7 +273,7 @@ A teaching figure needs no code at all:
273
273
  <script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
274
274
  <figcaption>Appending to a full slice</figcaption>
275
275
  </figure>
276
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.98.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
276
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
277
277
  ```
278
278
 
279
279
  See [Teaching Animations](docs/teaching.md).
@@ -372,7 +372,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
372
372
  <div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
373
373
  </div>
374
374
 
375
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.98.0/cdn/tinyfly-player.iife.js"></script>
375
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly-player.iife.js"></script>
376
376
  <script>
377
377
  tinyfly.play('#animation', './animation.json', { loop: -1 })
378
378
  </script>
@@ -481,7 +481,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
481
481
  <svg viewBox="0 0 720 200">…</svg>
482
482
  <script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
483
483
  </figure>
484
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.98.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
484
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
485
485
  ```
486
486
 
487
487
  ### Audio / Video Sync
package/docs/acting.md CHANGED
@@ -253,6 +253,46 @@ leaves, with a time, a scene x and y and a length, ready for `drawDustPuff`.
253
253
  Any beat can also take `onto` (a scene y): the figure is carried to that floor
254
254
  over the beat, as when the line it stands on moves up.
255
255
 
256
+ ### On a v2 character
257
+
258
+ `characterScript(target, who, beats, options)` compiles the same beats for a
259
+ v2 `character()` (see [Character Appearance](character-appearance.md)), so a
260
+ cast member acts the story the stick figure does:
261
+
262
+ ```js
263
+ import { character, castMember, characterScript, characterTarget, hairFollowTracks } from '@algorisys/tinyfly/characters'
264
+
265
+ const amy = character(castMember('youngWoman', 170))
266
+ const script = characterScript('amy', amy, [
267
+ { do: 'walk', to: 330, mood: 'happy' },
268
+ { do: 'say', say: 'Is that box ticking?', mood: 'worried' },
269
+ { do: 'take' },
270
+ { do: 'zip', to: -200 },
271
+ ], { from: 90, style: 'snappy' })
272
+ const tracks = [...script.tracks, ...hairFollowTracks('amy', script.tracks, amy)]
273
+ const targets = { amy: characterTarget({ x: 90, y: 300, character: amy }) }
274
+ ```
275
+
276
+ It takes every `scriptTracks` option but `height` (the character's own is
277
+ used) and returns the same result: tracks, `duration`, `lines`, `beats`,
278
+ `effects`, and the key poses on the human body. The stick-figure script plans
279
+ the story (timing, where the figure is, which way it faces, its gait, its
280
+ speech); its key poses are taken onto the human body, mirrored when it faces
281
+ left (so `turn` runs negative that way); the human acting pass then winds up,
282
+ overshoots and overlaps on this body, and the lines are lip-synced over its
283
+ mouth. The walk phase is rekeyed to the character's own stride (its height and
284
+ legs: a child takes shorter steps), so its feet stay planted. The `walk`,
285
+ `walking` and `gait` tracks step the gait as the target draws
286
+ (`characterPoseOf(props)` folds them into the pose, for drawing by hand). Reaches
287
+ are planned for the character's own arms and legs (`reach`, the share of the
288
+ stick figure's reach its limbs have, so it steps to where they reach), and
289
+ while a beat's hand or foot is on its target the limb is re-aimed on the
290
+ human body: a `point` aims at the spot, a `grab`, `put` or `kick` lands on it
291
+ (leaning down to a low one), and a `swipe`, `write` or `push` follows where
292
+ the stick figure's palm went. Your own gaits go in
293
+ `options.gaits` for the script and `gaits` on `characterTarget` so the drawing
294
+ knows them too.
295
+
256
296
  ## Your own actions, gaits and personas
257
297
 
258
298
  Behaviours of your own are plain values passed where they are used; nothing
@@ -501,7 +541,7 @@ lists the problems without compiling.
501
541
  ### Whiteboards
502
542
 
503
543
  `whiteboard()` is a second surface, for lessons that are not code: a board
504
- (or `theme: 'chalkboard'`) whose texts and hand-drawn marks are declared as
544
+ (or `theme: 'chalkboard'`, or `'lines'`, ruled paper with a margin) whose texts and hand-drawn marks are declared as
505
545
  data, each with an id, and named as places like a code panel's lines:
506
546
 
507
547
  ```js
@@ -535,11 +575,17 @@ everywhere. Colours are theme names (`red`, `blue`, `green`, `orange`, and
535
575
  `yellow` on chalk) or any CSS colour. The Board Lesson demo solves an
536
576
  equation this way.
537
577
 
578
+ The boards write in a handwriting font, Patrick Hand, when the page loads it
579
+ (the editor and the examples do, from Google Fonts), else the system's own
580
+ hand. An arrow bows a little as a hand draws it; it bends round any text it
581
+ would cross, and `bend` (a fraction of its length, + to its left) sets the bow.
582
+
538
583
  ### Charts
539
584
 
540
- `chart()` is a surface for talking through data: a bar or line chart whose
541
- values are declared as data, scaled once when it is made (`max`, or a round
542
- number above the largest value).
585
+ `chart()` is a surface for talking through data: a bar, line, pie or donut
586
+ chart whose values are declared as data. Bar and line charts are scaled once
587
+ when they are made (`max`, or a round number above the largest value); a pie
588
+ shares its circle by value.
543
589
 
544
590
  ```js
545
591
  const sales = chart({
@@ -559,13 +605,26 @@ surfaceScript('hero', { sales }, [
559
605
  ], { from: 640, ground: 400, height: 90, facing: -1 })
560
606
  ```
561
607
 
562
- Its places are `bar:ID` (on a bar chart) or `point:ID` (on a line chart),
563
- `label:ID`, `value:ID` and `box`, and they follow the values:
564
- `sales.anchor('bar:q4', time)` is the bar as it stands then. Its edits:
565
- `set` (a new `value`; the value label counts along), `show` (grow a
566
- `hidden` bar in from the axis, or draw the line out to a point; `on: false`
567
- takes it back) and `highlight`. A bar's top is a floor: a figure standing on
568
- it is carried up and down as it grows and shrinks, as in the Chart Talk demo.
608
+ Its places are `bar:ID` (on a bar chart), `point:ID` (on a line chart) or
609
+ `slice:ID` (on a pie or donut), `label:ID`, `value:ID` and `box`, and they
610
+ follow the values: `sales.anchor('bar:q4', time)` is the bar as it stands
611
+ then. Its edits: `set` (a new `value`; the value label counts along, and a
612
+ pie re-shares its circle), `show` (grow a `hidden` bar in from the axis, draw
613
+ the line out to a point, or open a slice; `on: false` takes it back),
614
+ `highlight`, and on a pie `pull` (the slice stands out from the centre). A
615
+ bar's top is a floor: a figure standing on it is carried up and down as it
616
+ grows and shrinks, as in the Chart Talk demo.
617
+
618
+ A slice can come loose: `traffic.piece('slice:other')` is a piece, and
619
+ `fling`, `follow` and `move` carry it off as they do a term on a board, so a
620
+ figure can kick the smallest slice out of the pie.
621
+
622
+ Several series (`series: [{ id: 'plan' }, { id: 'actual', color }]`, each
623
+ datum with `values: { plan: 40, actual: 46 }`) draw grouped bars or one line
624
+ per series, with a legend (`legend:SERIES` is a place too). Their places and
625
+ edits take the series after the id: `bar:q1:actual`. Axis titles go in
626
+ `axis: { x, y }`. A pie shows one series. The Pies & Series card shows all of
627
+ it.
569
628
 
570
629
  ### Props as surfaces
571
630
 
@@ -591,6 +650,14 @@ surfaceScript('hero', { home: homeSurface }, [
591
650
  ], { from: 40, ground: floor, height: 100 })
592
651
  ```
593
652
 
653
+ A prop's parts come loose too: `carSurface.piece('part:wheel-0-left')` is a
654
+ piece, and `fling`, `follow` and `move` carry it off, drawn where it went
655
+ (or as edits from a beat: `then: { edit: 'fling', anchor: 'part:wheel-0-left',
656
+ at: 'contact' }` on a `kick`). Every anchor and part is also a floor: a figure
657
+ that leaps `onto: { surface: 'car', anchor: 'anchor:roof' }` is carried as the
658
+ car lifts, drives or is squashed, the way a bar carries it on a chart. The Kick
659
+ the Tyre card does both.
660
+
594
661
  A prop stands on its middle, and seen from a little above its front comes
595
662
  forward of that line. A figure that walks on the prop's own `y` is inside
596
663
  its footprint and seems to walk through the wall; walk it on the prop's
@@ -694,6 +761,6 @@ timeline plays: editor previews, players, embeds and exports.
694
761
 
695
762
  ## Not yet
696
763
 
697
- - A code panel in the editor (a Code element whose lines and words snap beats)
698
- - Beat scripts for v2 characters (`scriptTracks` drives the stick figure)
699
- - Follow-through on hair, tails and ears (character-system milestones 3 and 5)
764
+ - Beat scripts for v2 characters acting on surfaces directly (`surfaceScript`
765
+ drives the stick figure; in the editor, a Character's Beats box resolves
766
+ surface places and cues for it)
@@ -1,7 +1,7 @@
1
1
  # Character Appearance
2
2
 
3
- Hair, facial hair, glasses, hats, ears, builds, a ready-made cast, held items
4
- and meeting hands for the v2 character (`character()` in `@algorisys/tinyfly/characters`). Every choice
3
+ Hair, facial hair, glasses, hats, ears, builds, a ready-made cast, held items,
4
+ meeting hands and hair that swings for the v2 character (`character()` in `@algorisys/tinyfly/characters`). Every choice
5
5
  is plain data, so a character can be saved, synced, generated by a language
6
6
  model and changed one field at a time.
7
7
 
@@ -117,6 +117,52 @@ Every style is the same few fields (`resolveHair(spec)` fills them all in):
117
117
 
118
118
  A style stays a starting point: any style suits anyone.
119
119
 
120
+ ## Hair in motion
121
+
122
+ Hair that hangs (long hair, ponytails, braids) lags behind the head: it swings
123
+ round after a turn, streams back on a run, drops on a jump and lifts on the
124
+ landing. The roots stay on the head; the ends move, more the further they hang.
125
+ Short hair, buns, beards and hats stay put.
126
+
127
+ The lag is three pose fields, so it keys, saves and mirrors like any other:
128
+
129
+ | Field | Meaning |
130
+ |---|---|
131
+ | `hair.swing` | Swung round the head toward the character's left (+) or right (−), degrees |
132
+ | `hair.trail` | Streaming back behind the head (+) or thrown forward (−), head radii |
133
+ | `hair.lift` | Lifted (+) or dropped (−), head radii |
134
+
135
+ You rarely set them by hand. `hairFollowTracks` works them out from the
136
+ character's own tracks (the target's `x` and `y`, the pose's `turn` and
137
+ `head.turn`), each on a spring that chases the head, the way a prop's `follow`
138
+ trails a car's antenna or a dog's tail:
139
+
140
+ ```js
141
+ const tracks = characterPoseTracks('maya', keys)
142
+ tracks.push(...hairFollowTracks('maya', tracks, maya))
143
+ // Nothing is added for hair with nothing to swing. A `hair.swing` track written
144
+ // by hand (a flick) keeps its values, with the lag added on.
145
+ ```
146
+
147
+ Code that poses a character every frame keys the lag once for its loop, then
148
+ reads it at each frame's time:
149
+
150
+ ```js
151
+ const lag = hairFollow((t) => ({ x: xAt(t), y: yAt(t), turn: turnAt(t) }), { end: 8000, headRadius: 24 })
152
+ drawCharacter(ctx, maya, humanPose({ turn: turnAt(t), ...hairMotionAt(lag, t) }), t)
153
+ ```
154
+
155
+ `hairFollow` options: `stiffness` (default 70, higher follows the head more
156
+ tightly), `damping` (6, lower swings longer), `amount` (1; 0 pins the hair) and
157
+ `step` (33 ms between keys). `hairFollowTracks` also takes `settle`, how long
158
+ the hair keeps moving after the last key (1500 ms). The springs step in fixed
159
+ 1 ms steps, so the same motion always gives the same keys, and the drawing
160
+ itself keeps no state between frames.
161
+
162
+ Four-legged animals get the same treatment for free: their `ears` control
163
+ (pricked forward +, laid back −) and `tail` both trail the animal's motion on a
164
+ spring in every `propScript`.
165
+
120
166
  ## Facial hair
121
167
 
122
168
  `facialHair` takes a style name or `{ moustache, beard, color }` (the colour
@@ -139,6 +185,11 @@ Beards: `none`, `stubble`, `goatee`, `soulPatch`, `chinStrap`, `circle`,
139
185
  The crown sits over the hair; hair below the brim still shows.
140
186
  - `ears: true` adds ears: they stick out past the head from the front and
141
187
  behind, and sit on the head with a curl when turned toward the viewer.
188
+ - `face: { teeth: true, tongue: true }` shows a row of upper teeth hanging
189
+ from the top of the mouth, and a tongue lying in the bottom of it, whenever
190
+ the mouth opens past 0.3 (a laugh, a shout, a wail). The mouth's shape is
191
+ still the pose's `mouth`, `smile` and `mouthWidth`; a closed or barely open
192
+ mouth shows neither. Default: neither, so a plain face draws as before.
142
193
 
143
194
  ## Builds
144
195
 
@@ -155,9 +206,16 @@ field can still be set on its own (`headSize`, `shoulderWidth`, `hipWidth`,
155
206
  | `broad`, `curvy`, `stocky` | Shoulder and hip widths (stocky: a larger head) |
156
207
  | `kid`, `child`, `toddler` | Larger head, shorter limbs |
157
208
 
209
+ `feet` sets the feet's shape: `round` (the default blob), `flat` (a shoe,
210
+ longer and even), `pointed` (a slipper, tapering to the toe) or `big` (clown's
211
+ feet, half as long again and wide). The shape is clearest in profile, where
212
+ the foot points along the ground; from the front it points at the viewer.
213
+
158
214
  Age, posture and accessories are separate choices: a child build is only
159
215
  proportions, and an older character is shown by hair and glasses, never by a
160
- stoop unless one is posed. The same poses, gaits and actions work on every
216
+ stoop unless one is posed. A cane (`holding: { right: 'cane' }`) and a
217
+ wheelchair (the `wheelchair()` prop, ridden in the `wheeling` pose) are
218
+ accessories any character can have, not part of an age. The same poses, gaits and actions work on every
161
219
  build; `humanGaitStrideLength(gait, height, stride, legLength)` gives a build's
162
220
  stride so its feet stay planted.
163
221
 
@@ -178,7 +236,8 @@ character({ outfit: { over: 'labCoat' } })
178
236
  | `bottom` | `trousers` (default), `shorts`, `skirt` |
179
237
  | `collar` | `true` for a shirt collar |
180
238
  | `tie` | A colour, for a tie down the front |
181
- | `over`, `overColor` | `apron` or `labCoat`, and its colour |
239
+ | `over`, `overColor` | `apron`, `labCoat`, `hoodie` (a loose top with a hood at the back, a front pocket and long sleeves), `cardigan` (open down the front, buttoned), `overalls` (a bib with straps, in the trousers' colour) or `sari` (a drape to the ankles with the pallu over the near shoulder), and its colour |
240
+ | `shoes`, `shoeColor` | `boots` to above the ankle, and their colour |
182
241
 
183
242
  The front details (collar, tie, apron, the coat's opening) show from the
184
243
  front and turn away with the body; from behind an apron shows its ties.
@@ -197,6 +256,28 @@ family: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`,
197
256
  const family = ['man', 'woman', 'girl', 'grandma'].map((name) => character(castMember(name, 280)))
198
257
  ```
199
258
 
259
+ ## Hugs, help-ups and everyday cycles
260
+
261
+ Two people, more than hands: `embrace(a, b)` is a hug. Both turn toward each
262
+ other, lean in and tilt their heads together, and each reaches its right arm
263
+ over the other's shoulder and its left round the other's waist, exactly, from
264
+ where the two stand (`embraceSpacing(a, b)` apart). `helpUp(helper, sitter,
265
+ progress)` is one person helping another up off the floor as a function of how
266
+ far along it is: at 0 the sitter sits on the floor and the helper bows to take
267
+ its hand, at 1 both stand, and in between the hands stay joined at a point
268
+ that rises with them (`helpUpSpacing(helper, sitter)` apart). Both return
269
+ plain poses (`a`, `b`, or `helper`, `sitter`) and whether they `reached`.
270
+
271
+ ```js
272
+ const hug = embrace({ character: cook, x: 300 }, { character: grandpa, x: 300 + embraceSpacing(cook, grandpa) })
273
+ const rising = helpUp({ character: cook, x: 300 }, { character: grandpa, x: 300 + helpUpSpacing(cook, grandpa) }, 0.5)
274
+ ```
275
+
276
+ Everyday actions as cycles, like a gait: `humanCyclePose('sweeping', phase,
277
+ base)` sweeps a broom side to side (hold one: `holding: { right: 'broom' }`)
278
+ and `'brushing'` works a hand across a surface in front at chest height; `phase`
279
+ 0 → 1 is one stroke and back. The Help Up card shows all three.
280
+
200
281
  ## Expressions and face marks
201
282
 
202
283
  `HUMAN_EXPRESSIONS` sets every face field, so applying one replaces the whole
@@ -227,11 +308,14 @@ character({ holding: { left: 'bag', right: 'bag' } }) // carry
227
308
  character({ holding: { both: { item: 'parcel', color: '#c9a06a' } } })
228
309
  ```
229
310
 
230
- Items: `mug`, `phone`, `briefcase`, `bag`, `umbrella` and `broom` (one hand,
231
- `left` or `right`), `book` (one hand or `both`) and `parcel` (`both`). Each is
311
+ Items: `mug`, `phone`, `briefcase`, `bag`, `umbrella`, `broom` and `cane` (one
312
+ hand, `left` or `right`), `book` (one hand or `both`) and `parcel` (`both`). Each is
232
313
  drawn at the hand's grip, so it follows the hand through any pose, gait or
233
314
  turn, and sorts with that arm (a mug goes behind the body with the far arm).
234
- An umbrella's canopy sits just over the head. `handGrip(joints, side)` gives
315
+ An umbrella's canopy sits just over the head. A cane's crook is in the hand
316
+ and its shaft reaches the ground while the hand hangs, lifting with the hand
317
+ once it rises; `HUMAN_POSES.cane` stands leaning on it (the arm straight, a
318
+ little ahead), and any gait walks with it. `handGrip(joints, side)` gives
235
319
  the grip point and the forearm's direction for drawing anything else in a
236
320
  hand.
237
321
 
@@ -259,8 +343,8 @@ const give = meetHands('handOver', { character: courier, x: 300 }, { character:
259
343
 
260
344
  Select a 🧍 Character and open **Head** in the properties: **Cast** dresses it
261
345
  as a cast member (build, hair, facial hair, glasses and clothes in one step),
262
- then **Hair**, **Hair colour**, **Facial hair**, **Glasses**, **Hat** and
263
- **Ears** change one thing at a time; **Right hand**, **Left hand** and **Both
346
+ then **Hair**, **Hair colour**, **Facial hair**, **Glasses**, **Hat**,
347
+ **Ears**, **Teeth**, **Tongue** and **Feet** change one thing at a time; **Right hand**, **Left hand** and **Both
264
348
  hands** put an item in them. **Build** lists the builds, with **Legs** and
265
349
  **Arms** sliders. The new expressions and everyday poses are in the **Face**
266
350
  and **Body** lists. All of it is saved as plain fields on the element and
@@ -278,4 +362,6 @@ exported to video and GIF.
278
362
 
279
363
  Outlines are traced from the same numbers every time (no randomness, no state
280
364
  between frames), so a frame at a given time always draws the same, and the
281
- pencil look's boil stays seeded as before.
365
+ pencil look's boil stays seeded as before. Hair in motion keeps to this: the
366
+ lag is keyed ahead of time from the motion (`hairFollow`), not accumulated
367
+ while drawing.
@@ -43,7 +43,9 @@ left to right:
43
43
  is a reassuring, tap-friendly manual save (handy on tablets).
44
44
  - **New** — start a fresh project (prompts if you have unsaved changes).
45
45
  - **AI** — show or hide the AI prompt bar, where you describe an animation and
46
- click **Generate**.
46
+ click **Generate**. A brief with a story in it ("grandma walks up to a ticking
47
+ box, jumps, and runs off") gets a 🧍 Character from the cast with a beat
48
+ script, compiled into its tracks on load (the beats stay on the element).
47
49
  - **My Animations** — open the gallery of every project you've saved (thumbnails,
48
50
  open / duplicate / delete). See [Project Management](#project-management).
49
51
  - **Examples** — every ready-made animation on one page (`/examples`). Open one in
@@ -78,6 +80,9 @@ Shapes, text, images, video, lines, arrows and paths are added from the
78
80
  | **Group** | Container that groups multiple elements |
79
81
  | **🧍 Character** | A posable figure: pick a view, a pose and a face, and keyframe them to animate (see [Characters](#characters)) |
80
82
  | **🗺 Map** | An animated map: places, a route between them, and a camera (see [Maps](#maps)) |
83
+ | **🧊 3D Scene** | A real 3D scene seen through its camera: meshes, lights, characters and props (see [3D Scenes](#3d-scenes)) |
84
+ | **⌨ Code** | A code panel whose lines a Character's beats aim at and change (see [Code](#code)) |
85
+ | **📊 Chart** | A bar, line, pie or donut chart from data, whose bars and slices beats aim at, change and ride (see [Charts](#charts-1)) |
81
86
 
82
87
  Polygon and star are **parametric** paths: change the sides/points/inner ratio in
83
88
  the Property Panel and the shape regenerates, and they rescale cleanly when you
@@ -213,12 +218,41 @@ Dances and flips are written as they are, and turn acting off.
213
218
  (`drawingRate` in the JSON), so previews, players and exports all hold the
214
219
  same way.
215
220
 
221
+ - **Beats**: a story written as beats, compiled in the chosen style into the
222
+ character's tracks and kept on the element (`beats` in the JSON). Write them
223
+ as JSON (`[{ "do": "walk", "to": 320, "mood": "happy" }, { "do": "say",
224
+ "say": "Hello!" }, { "do": "take" }]`) and click **🎬 Run beats**; the
225
+ timeline grows to fit. A beat can aim at a **⌨ Code** element's lines or a
226
+ **📊 Chart** element's bars, points and slices
227
+ (`"target": { "surface": "Code 1", "anchor": "line:2" }`, also for `to`,
228
+ `toward` and `onto`) and change them (`"then": { "surface": "Code 1",
229
+ "edit": "highlight", "anchor": "line:2", "at": "contact" }`): the edits
230
+ become tracks on that element, and a figure standing on a bar or a line
231
+ rides it as it moves. Problems are named by beat (an unknown
232
+ action, mood or place) before anything is written. The AI prompt bar writes
233
+ beats this way too.
234
+
216
235
  See [Cartoon Acting](acting.md).
217
236
 
218
237
  Characters show in the DOM and Canvas previews and in GIF / WebP / MP4
219
238
  export. They are not part of exported HTML or embeds yet, and the SVG preview
220
239
  does not draw them.
221
240
 
241
+ ### Code
242
+
243
+ A **⌨ Code** element is a code panel (`codePanel()` from code): a listing with
244
+ line numbers, drawn by code into its box, which grows to fit its lines. In the
245
+ property panel: the **Language** (JavaScript, TypeScript, Python, Go, Rust,
246
+ C#, plain), **Font size**, **Line numbers**, **Hidden lines** (typed in later)
247
+ and the **Listing** itself.
248
+
249
+ Its lines are places. A Character's **Beats** aim at them and change them
250
+ (highlight, strike, remove, type, fling a token…), and those edits are tracks
251
+ on the Code element named `line.N.highlight`, `line.N.strike`, `line.N.wipe`,
252
+ `line.N.reveal` and so on, which you can also key by hand. Code panels show in
253
+ the DOM and Canvas previews and in GIF / WebP / MP4 export. See [Acting on
254
+ code](acting.md#acting-on-code) for the same from code.
255
+
222
256
  ### Maps
223
257
 
224
258
  A **🗺 Map** fills the canvas with a map of the world. In the property panel:
@@ -253,8 +287,8 @@ camera: it starts with a camera at three-quarters, a key light, a floor and a
253
287
  red box. In the property panel:
254
288
 
255
289
  - **Objects**: pick one to edit. **Add** puts a box, sphere, cylinder, cone,
256
- ring, star (an extruded path), character or light on the next free spot;
257
- ✕ removes the picked one (not the scene's camera).
290
+ ring, star (an extruded path), character, prop or light on the next free
291
+ spot; ✕ removes the picked one (not the scene's camera).
258
292
  - **Transform**: X, Y, Z (metres, +y up), Tilt X, Turn Y, Roll Z and Scale.
259
293
  **◆ Key transform at playhead** keys all of them; once a value is animated
260
294
  (◆ by its name), changing it keys it at the playhead.
@@ -263,6 +297,12 @@ red box. In the property panel:
263
297
  - **Characters**: a look (*Clean*, *Pencil*, *Silhouette* drawn by their pens
264
298
  in perspective, or *Solid*) and **🕺 Dance from playhead** with any dance
265
299
  style.
300
+ - **Props**: which prop from the catalog (car, truck, bus, tractor, cart, train
301
+ car, bike, motorbike, tree, house, helicopter, airplane, horse, dog, cat, cow,
302
+ songbird, crow, chicken), its look (*Clean*, *Pencil*, *Silhouette*, or
303
+ *Mesh*, lit with the scene) and style (*Solid* or *Stick* line art). Its
304
+ controls (`car.door`, `car.wheelSpin`, `dog.tail`…) are tracks on the
305
+ element.
266
306
  - **Cameras**: field of view, **Look through this camera**, and **✂ Cut to
267
307
  this camera at playhead**, which keys the shot change.
268
308
  - **Camera** view presets (*Front*, *¾*, *Side*, *Top*) and the scene's
@@ -273,6 +313,28 @@ Its tracks are on the element, named `object.property` (`box.rotateY`,
273
313
  DOM and Canvas previews and in GIF / WebP / MP4 export. See [3D
274
314
  Scenes](scene-3d.md) for the same from code.
275
315
 
316
+ ### Charts
317
+
318
+ A **📊 Chart** element is a `chart()` from code: a bar, line, pie or donut
319
+ chart drawn by code into its box. In the property panel: the **Kind**,
320
+ **Title**, **Theme** (light or dark), **Max** (the top of the scale; blank
321
+ for a round number above the data), **Value labels** (a prefix, a suffix,
322
+ decimal places, and whether to show them), **Axis titles**, the **Data** as
323
+ JSON (`[{ "id": "q1", "label": "Q1", "value": 45 }, …]`; `"hidden": true`
324
+ starts a bar, point or slice out of sight) and, for several series, the
325
+ **Series** (`[{ "id": "plan", "label": "Plan" }, …]`, each datum then with
326
+ `"values": { "plan": 40, … }`). Bad data is named under the fields instead of
327
+ breaking the stage.
328
+
329
+ Its bars, points and slices are places. A Character's **Beats** aim at them
330
+ (`{ "surface": "Chart 1", "anchor": "bar:q2" }`), change them (`set` to a
331
+ value, `show` a hidden one, `highlight`, `pull` a slice out) and ride them:
332
+ a figure that leaps `onto` a bar is carried up as the bar grows. The edits are
333
+ tracks on the Chart element named `bar.q2.value`, `slice.a.pull` and so on,
334
+ which you can also key by hand. Charts show in the DOM and Canvas previews and
335
+ in GIF / WebP / MP4 export. See [Charts](acting.md#charts) for the same from
336
+ code.
337
+
276
338
  ### Selecting Elements
277
339
 
278
340
  - **Click** an element to select it
@@ -1066,7 +1128,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
1066
1128
  **Steps to embed:**
1067
1129
  1. Build the player: `npm run build:player`
1068
1130
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
1069
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.98.0/cdn/tinyfly-player.iife.js`
1131
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly-player.iife.js`
1070
1132
  instead; see [Deployment](DEPLOYMENT.md))
1071
1133
  3. Copy the generated code into your HTML
1072
1134
  4. Adjust the script `src` path if needed
@@ -1105,6 +1167,16 @@ The preview panel supports three rendering modes, switchable via the renderer se
1105
1167
 
1106
1168
  All three renderers play the same animation — switch between them to verify cross-renderer compatibility.
1107
1169
 
1170
+ Every renderer is editable on stage. The DOM preview's elements take the
1171
+ pointer themselves; the Canvas and SVG previews draw into one surface, so a
1172
+ transparent hit layer over the drawing carries the same boxes, handlers and
1173
+ selection chrome (resize and rotation handles, path points), placed by the
1174
+ animation and the camera exactly as the drawing is. Clicking selects (the
1175
+ topmost element first), dragging moves, handles resize and rotate, and the
1176
+ grid, snapping, rulers, guides, the pen tool and camera panning work the
1177
+ same whichever preview is on. Characters, charts, props and 3D scenes, which
1178
+ only the Canvas preview draws fully, can be arranged there directly.
1179
+
1108
1180
  ### Onion skinning
1109
1181
 
1110
1182
  In the **Canvas** renderer, click **🧅 Onion** to show faint **ghost frames**
package/docs/examples.md CHANGED
@@ -694,7 +694,7 @@ For simple website embedding without a build system.
694
694
  </html>
695
695
  ```
696
696
 
697
- 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.98.0/cdn/tinyfly-player.iife.js`.
697
+ 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.100.0/cdn/tinyfly-player.iife.js`.
698
698
 
699
699
  ---
700
700
 
@@ -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.98.0/cdn/tinyfly.iife.js"></script>
188
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.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.98.0/cdn/tinyfly.iife.js"></script>
77
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.100.0/cdn/tinyfly.iife.js"></script>
78
78
  <script>
79
79
  tinyfly.to('.box', { x: 200, duration: 1 })
80
80
  </script>