@algorisys/tinyfly 0.101.0 → 0.102.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 +5 -5
  2. package/bin/tinyfly.mjs +9 -3
  3. package/docs/editor-guide.md +1 -1
  4. package/docs/examples.md +1 -1
  5. package/docs/getting-started.md +1 -1
  6. package/docs/gsap-compat.md +1 -1
  7. package/docs/llm-guide.md +8 -2
  8. package/docs/maps.md +2 -2
  9. package/docs/scene-3d.md +117 -5
  10. package/docs/teaching.md +1 -1
  11. package/docs/video-rendering.md +44 -1
  12. package/lib/addons/adapters.js +168 -123
  13. package/lib/addons/characters.js +4663 -4566
  14. package/lib/addons/scene-3d-webgl.js +30 -30
  15. package/lib/addons/scene-3d.js +650 -341
  16. package/lib/browser/tinyfly-scene-3d-webgl.iife.js +2 -2
  17. package/lib/browser/tinyfly-scene-3d.iife.js +2 -2
  18. package/lib/browser/tinyfly.iife.js +13 -13
  19. package/lib/browser/tinyfly.js +4105 -3973
  20. package/lib/browser/tinyfly.umd.js +13 -13
  21. package/lib/engine/tinyfly-engine.js +1207 -1172
  22. package/lib/engine/tinyfly-engine.umd.cjs +2 -2
  23. package/lib/headless/headless.js +150 -6
  24. package/lib/types/adapters/canvas/framing.d.ts +27 -0
  25. package/lib/types/adapters/canvas/index.d.ts +1 -0
  26. package/lib/types/characters/character-script-3d.d.ts +21 -1
  27. package/lib/types/characters/index.d.ts +2 -1
  28. package/lib/types/characters/staging-3d.d.ts +56 -0
  29. package/lib/types/engine/authoring/framing.d.ts +48 -0
  30. package/lib/types/engine/authoring/index.d.ts +1 -0
  31. package/lib/types/headless/audio-mix.d.ts +40 -0
  32. package/lib/types/headless/ffmpeg-args.d.ts +2 -0
  33. package/lib/types/headless/frame-renderer.d.ts +7 -1
  34. package/lib/types/headless/index.d.ts +1 -0
  35. package/lib/types/headless/node-audio.d.ts +19 -0
  36. package/lib/types/headless/node-video.d.ts +2 -0
  37. package/lib/types/headless/video-scene.d.ts +12 -0
  38. package/lib/types/scene-3d/index.d.ts +3 -0
  39. package/lib/types/scene-3d/lighting.d.ts +58 -0
  40. package/lib/types/scene-3d/resolve-scene.d.ts +5 -1
  41. package/lib/types/scene-3d/scene-3d-adapter.d.ts +2 -0
  42. package/lib/types/scene-3d/scene-types.d.ts +14 -2
  43. package/lib/types/scene-3d/shots.d.ts +162 -0
  44. package/lib/types/scene-3d/software-renderer.d.ts +40 -0
  45. package/llms-full.txt +177 -16
  46. package/llms.txt +29 -29
  47. package/package.json +1 -1
  48. package/skills/tinyfly/SKILL.md +4 -1
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.101.0/cdn/tinyfly.iife.js"></script>
207
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.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.101.0/cdn/tinyfly.iife.js"></script>
415
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.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.101.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.102.0/cdn/tinyfly-player.iife.js`.
2282
2282
 
2283
2283
  ---
2284
2284
 
@@ -6536,7 +6536,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
6536
6536
  **Steps to embed:**
6537
6537
  1. Build the player: `npm run build:player`
6538
6538
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
6539
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.101.0/cdn/tinyfly-player.iife.js`
6539
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.0/cdn/tinyfly-player.iife.js`
6540
6540
  instead; see [Deployment](DEPLOYMENT.md))
6541
6541
  3. Copy the generated code into your HTML
6542
6542
  4. Adjust the script `src` path if needed
@@ -7737,8 +7737,14 @@ loaded with `kinds: [characterObjects, propObjects]`; its controls are tracks
7737
7737
  on the object. Script it in world metres with `propScript3D` (`to: [x, z]`,
7738
7738
  `through: [[x, z], …]`, `face`), not with `propScript`, whose `to` is screen px.
7739
7739
  Characters in a 3D scene walk the same way with `characterScript3D`
7740
- (`{ do: 'walk', to: [x, z] }`, `pose`, `gag`, `face`, `place`); a rider is
7741
- seated with `propRide3D` and spliced into its script with `spliceTracks`. See `docs/props.md`.
7740
+ (`{ do: 'walk', to: [x, z] }`, `pose`, `gag`, `face`, `place`, `say` with a
7741
+ line, `look` at a point or `'camera'`); a rider is seated with `propRide3D`
7742
+ and spliced into its script with `spliceTracks`. A film from a 3D scene is a
7743
+ shot list (`shotTracks`, `transitionAt` + `drawTransition`), camera moves as
7744
+ tracks (`cameraMoveTracks`, `cameraHandheldTracks`), a mood from
7745
+ `lightingPreset('dusk')` with `ground()` and `shadow: true` on meshes, and
7746
+ sound from `renderMix`; draw it with `depthBuffer: true` when shapes cross.
7747
+ See `docs/props.md` and `docs/scene-3d.md`.
7742
7748
 
7743
7749
  ## Characters with a look
7744
7750
 
@@ -7941,7 +7947,7 @@ path for all of that:
7941
7947
  </figure>
7942
7948
 
7943
7949
  <!-- once, anywhere on the page (a site-wide footer is fine) -->
7944
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.101.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
7950
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
7945
7951
  ```
7946
7952
 
7947
7953
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
@@ -8283,6 +8289,7 @@ npx tinyfly video scene.mjs --stills stills/ # one PNG per caption line (els
8283
8289
  npx tinyfly video scene.mjs --stills stills/ --frames 0,79,88 # stills at chosen frames (or --times 0,2640 in ms)
8284
8290
  npx tinyfly video scene.mjs --loop-check # does it loop? (exit 1 when not)
8285
8291
  npx tinyfly video scene.mjs --scale 0.5 --fps 12 # quick preview
8292
+ npx tinyfly video scene.mjs --codec prores # a ProRes 422 HQ .mov for editing elsewhere
8286
8293
  ```
8287
8294
 
8288
8295
  Runnable scenes are in [`examples/headless-video/`](../examples/headless-video/):
@@ -8411,6 +8418,38 @@ Scene modules may use top-level `await`, or default-export an async function.
8411
8418
  `assembleNarration(plan, clips, sampleRate)` and `encodeWav(samples, sampleRate)`
8412
8419
  are the pure steps underneath, for audio you generate yourself.
8413
8420
 
8421
+ ### A sound mix
8422
+
8423
+ A film's sound is layers: a music bed, the narration, effects at the moments
8424
+ things happen, with the music ducked under the voice. `renderMix` decodes
8425
+ every file with ffmpeg, mixes them and writes one WAV for the scene's
8426
+ `audio`:
8427
+
8428
+ ```js
8429
+ import { renderMix } from '@algorisys/tinyfly/headless'
8430
+
8431
+ const audio = await renderMix(
8432
+ [
8433
+ { id: 'bed', file: 'music/bed.mp3', loop: true, gain: 0.6, fadeOut: 1500, duck: { under: 'voice', amount: 0.7 } },
8434
+ { id: 'voice', file: 'build/narration.wav' },
8435
+ { file: 'sfx/tap.wav', at: [1200, 2650, 4100], gain: 0.8 }, // a sound effect at three moments
8436
+ { file: 'sfx/thud.wav', at: landings.map((t) => t + 40) }, // or at every landing a script reports
8437
+ ],
8438
+ { output: 'build/mix.wav', duration: END, baseDir: here }
8439
+ )
8440
+ export default { /* … */ audio }
8441
+ ```
8442
+
8443
+ Each layer has `start` (ms) or `at` (times for a sound effect), `gain`,
8444
+ `fadeIn` and `fadeOut`, `loop` for a bed shorter than the film, and `duck:
8445
+ { under, amount, attack, release }` to make way for another layer while it
8446
+ sounds. The whole mix is soft-limited so peaks never clip. `mixAudio(layers,
8447
+ { sampleRate, duration, master })` is the pure step on samples. For cuts and
8448
+ dances on the music's beat, `detectTempo(samples, sampleRate)` finds the
8449
+ grid; `snapShotsToBeats(shots, grid)` moves each cut to the nearest beat,
8450
+ and `danceTracks(target, { bpm: grid.bpm, start: nextBeat(grid, t) })`
8451
+ dances to it.
8452
+
8414
8453
  ## Characters
8415
8454
 
8416
8455
  `@algorisys/tinyfly/characters` has a poseable stick figure. A pose is a set of
@@ -9067,6 +9106,12 @@ draw(ctx, frame) {
9067
9106
  stay put while the camera moves.
9068
9107
  - `drawingRate: 12` holds the timeline's poses for two frames of 24 fps ("on
9069
9108
  twos"), as hand-drawn animation is timed.
9109
+ - `motionBlur: { samples: 4, shutter: 0.5 }` makes each frame the average of
9110
+ four drawings spread over the shutter's open time (half the frame, a 180°
9111
+ shutter): fast moves streak as a camera's do. Deterministic, `samples`
9112
+ times the work.
9113
+ - `supersample: 2` draws at twice the size and scales down: smoother edges
9114
+ on thin lines and small text (four times the work).
9070
9115
 
9071
9116
  See [acting.md](acting.md) for camera shots, beat scripts and the rest of the
9072
9117
  cartoon acting tools.
@@ -9091,6 +9136,7 @@ await renderVideo(scene, {
9091
9136
  output: 'out.mp4',
9092
9137
  baseDir: '.', // relative audio and font paths resolve against this
9093
9138
  scale: 1, crf: 20, preset: 'medium',
9139
+ codec: 'h264', // or 'prores' for a .mov
9094
9140
  onProgress: (done, total) => {},
9095
9141
  })
9096
9142
  await renderStills(scene, { dir: 'stills' })
@@ -9147,7 +9193,10 @@ room) was ported call for call to Canvas 2D and rendered at 1920×1080, 24 fps,
9147
9193
  rendering) and `ffmpeg`. Rendering defines `globalThis.Path2D` from the canvas
9148
9194
  package when it is missing, because path targets use it.
9149
9195
  - Output is H.264 MP4 (`yuv420p`, odd sizes padded to even), with AAC audio when
9150
- `audio` is set; video stops at the shorter of picture and sound.
9196
+ `audio` is set; video stops at the shorter of picture and sound. `codec:
9197
+ 'prores'` (or `--codec prores`) writes ProRes 422 HQ (10-bit, PCM audio) in
9198
+ a `.mov` for an editor; any size works, 1080p and 4K included; `renderStills`
9199
+ gives a PNG sequence.
9151
9200
  - `image` targets need images loaded with the canvas package's `loadImage`.
9152
9201
 
9153
9202
  ---
@@ -9170,8 +9219,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
9170
9219
  adds to the same `tinyfly` global:
9171
9220
 
9172
9221
  ```html
9173
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.101.0/cdn/tinyfly.iife.js"></script>
9174
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.101.0/cdn/tinyfly-maps.iife.js"></script>
9222
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.0/cdn/tinyfly.iife.js"></script>
9223
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.102.0/cdn/tinyfly-maps.iife.js"></script>
9175
9224
  ```
9176
9225
 
9177
9226
  It is a separate script because the offline world map it carries adds about
@@ -10962,8 +11011,11 @@ for a neon glow: `{ color: '#000000', emissive: '#ff2bd6', shading: 'unlit' }`.
10962
11011
  `roughness` and `metalness` are for the realistic look (three.js, a later
10963
11012
  milestone); the stylized renderers ignore them, so one material serves both.
10964
11013
 
10965
- The scene can have `background` and `fog: { color, near, far }` (metres from
10966
- the camera). A scene with no lights gets a soft default (ambient plus a key
11014
+ The scene can have `background` (a colour, or a sky as a vertical gradient
11015
+ `{ top, bottom }`), `fog: { color, near, far }` (metres from the camera) and
11016
+ `ground` (the height blob shadows lie at, default 0). A mesh with `shadow:
11017
+ true` (or `{ opacity, ground }`) gets a soft blob shadow on the ground under
11018
+ it, which spreads and fades as the mesh lifts off. A scene with no lights gets a soft default (ambient plus a key
10967
11019
  light from upper right). Outlines fade into the fog too. `nearFade: { from, to }` fades geometry
10968
11020
  nearer the camera than `to` metres, gone at `from`, so a dive passes through
10969
11021
  things as if they were glass (also an option of `resolveScene3D`).
@@ -10996,6 +11048,85 @@ so instead of picking a winner.
10996
11048
  the group. `orbitPosition(target, yaw, pitch, distance)` and
10997
11049
  `dollyPosition(eye, target, amount)` place cameras for keyframes.
10998
11050
 
11051
+ ## Shots and cameras
11052
+
11053
+ A film is a shot list, as data, over the same scene and timeline:
11054
+
11055
+ ```js
11056
+ import { shotTracks, shotMarkers, transitionAt, withActiveCamera, cameraMoveTracks, cameraHandheldTracks } from '@algorisys/tinyfly/scene-3d'
11057
+ import { drawTransition, drawLetterbox } from '@algorisys/tinyfly/adapters'
11058
+
11059
+ const shots = [
11060
+ { id: 'establish', start: 0, end: 4000, camera: 'wide', label: 'Dolly in' },
11061
+ { id: 'orbit', start: 4000, end: 7500, camera: 'orbiter', transition: { kind: 'crossfade', duration: 700 } },
11062
+ { id: 'close', start: 7500, end: 10000, camera: 'close', transition: { kind: 'dipToBlack', duration: 600 } },
11063
+ ]
11064
+ const tracks = [
11065
+ ...shotTracks(shots, 'set'), // the activeCamera track: a cut is one keyframe
11066
+ ...cameraMoveTracks({ scene: 'set', camera: 'wide', start: 0, end: 4000,
11067
+ from: { target: [0, 0.8, 0], yaw: 20, pitch: 18, distance: 11 }, to: { distance: 7 } }), // a dolly
11068
+ ...cameraHandheldTracks([], { scene: 'set', camera: 'close', start: 7500, end: 10000,
11069
+ base: { position: [1.2, 1.4, 3.6], lookAt: [0, 0.75, 1.3] }, seed: 'close' }),
11070
+ ]
11071
+ ```
11072
+
11073
+ - **Shots** are `{ id, start, end, camera, label?, transition? }`;
11074
+ `checkShots` names overlaps, bad ends and a transition on the first shot;
11075
+ `shotAt(shots, time)` is the shot playing; `shotMarkers` gives the
11076
+ timeline's markers (stills and captions step through them).
11077
+ - **Transitions** (`cut`, `crossfade`, `dipToBlack`, `wipe` with a
11078
+ `direction`) start at the shot's start and last `duration` ms. Any frame can
11079
+ ask `transitionAt(shots, time)` which two shots to draw and how far along
11080
+ (0..1); `drawTransition(ctx, transition, { width, height, draw(ctx,
11081
+ cameraId) })` draws both and blends them (a crossfade mixes, a dip covers
11082
+ the cut, a wipe sweeps the new shot in), with `withActiveCamera(values,
11083
+ sceneId, cameraId)` to draw the shot going out. Pure and frame-addressable:
11084
+ the film renders the same in any order.
11085
+ - **Camera moves** are presets that write `position`, `lookAt` (and `fov`)
11086
+ tracks on the camera: `cameraMoveTracks({ from, to, easing, every })` with
11087
+ poses as an orbit round a target (`yaw`, `pitch`, `distance`), or a fixed
11088
+ `position` with a moving `lookAt`, or a `fov`: change `yaw` for an orbit,
11089
+ `distance` for a dolly, `pitch` and `distance` for a crane, `lookAt` for a
11090
+ pan or tilt, `fov` for a zoom, or any mix. `cameraFollowTracks({ subjectAt,
11091
+ offset, lag })` keeps a camera on a moving subject. `cameraHandheldTracks(
11092
+ tracks, { amount, aim, rate, seed })` adds a deterministic handheld shake
11093
+ onto a move's tracks or a still camera's `base`.
11094
+ - **Aspect and safe areas**: `drawLetterbox(ctx, canvas, '2.39:1')` paints
11095
+ the bars (in a video's `overlay`), `frameRect`, `frameSize` and `safeAreas`
11096
+ are the geometry, `drawSafeAreas` draws the action and title guides for
11097
+ stills. `FRAME_ASPECTS` has 16:9, 2.39:1, 4:3, 1:1, 9:16 and 4:5.
11098
+
11099
+ `examples/headless-video/film-shots.mjs` is a three-shot film with a dolly, a
11100
+ crossfade into an orbit, a dip to black into a handheld close-up, letterboxed.
11101
+
11102
+ ## Sets and light for mood
11103
+
11104
+ A set is objects like any other; what sets the mood is its light, its sky and
11105
+ its fog, and those come as presets:
11106
+
11107
+ ```js
11108
+ import { lightingPreset, lightingTracks, ground } from '@algorisys/tinyfly/scene-3d'
11109
+
11110
+ const light = lightingPreset('dusk') // or 'day', 'night', 'stage'
11111
+ const floor = ground({ size: 20 })
11112
+ const scene = {
11113
+ id: 'set', camera: 'cam', background: light.background, fog: light.fog,
11114
+ materials: { ...floor.materials, red: { color: '#ef4444', shading: 'toon' } },
11115
+ objects: [camera, ...light.objects, ...floor.objects, { id: 'box', kind: 'mesh', geometry: { type: 'box', size: [1, 1, 1] }, material: 'red', position: [0, 0.5, 0], shadow: true }],
11116
+ }
11117
+ // Day turning to night over four seconds: tracks on the same lights.
11118
+ const tracks = lightingTracks('day', 'night', { scene: 'set', start: 0, end: 4000 })
11119
+ ```
11120
+
11121
+ Every preset uses the same light ids (`key`, `fill`, `sky`, and `spot` on
11122
+ the stage), so `lightingTracks(from, to, { scene, start, end })` keys each
11123
+ light's `color`, `intensity`, `position` and `target` from one mood to the
11124
+ other (a spot only one mood has fades in or out); the sky and fog are the
11125
+ scene's to set per shot. `ground({ size, color, segments, y })` is a floor
11126
+ on layer −1 with its material; props from the catalog (trees, houses,
11127
+ furniture) are the set pieces, placed by preset name (see Props). Blob
11128
+ shadows under meshes are `shadow: true`; projected shadows are planned.
11129
+
10999
11130
  ## Lines and trails
11000
11131
 
11001
11132
  Two more kinds of object draw a band that faces the camera, as wide as
@@ -11041,7 +11172,7 @@ front of the meshes. For trails on a plain 2D canvas, see `drawTrail` in
11041
11172
  loadScene3D(json): LoadedScene3D // validates and builds meshes once (throws with every problem)
11042
11173
  validateScene3D(json, tracks?): string[] // problems as sentences, empty when fine
11043
11174
  resolveScene3D(loaded, values, { width, height, time?, valuesAt? }): ResolvedScene3D // pure: matrices, camera, lights, sorted triangles
11044
- drawScene3D(ctx, loaded, values, { width, height, time?, valuesAt? | stateAt? }) // resolve and draw, in one call
11175
+ drawScene3D(ctx, loaded, values, { width, height, time?, valuesAt? | stateAt?, depthBuffer? }) // resolve and draw, in one call
11045
11176
  new Scene3DAdapter(new Canvas2DRenderer(ctx), { width, height, valuesAt? }) // registerScene, applyState(state), render()
11046
11177
  ```
11047
11178
 
@@ -11139,6 +11270,21 @@ phase) with the distance, one stride per cycle, so the feet stay planted, plus
11139
11270
  the stepping pose as it draws, on the pose it holds: a wave carries on while it
11140
11271
  walks. Objects take `gait` and `walking` as fields too.
11141
11272
 
11273
+ **Speaking and looking.** `{ do: 'say', say: 'A pot of water!' }` lip-syncs
11274
+ the line on the character's mouth (the same `lipSyncOver` the 2D scripts use)
11275
+ with a talking head, and lasts as long as the line (`speechLength(text)`, or
11276
+ `for`). `{ do: 'look', look: [x, z] }` turns the head and eyes toward a point
11277
+ at eye height (`[x, y, z]` for any height, `'camera'` for the viewer with
11278
+ `options.camera`); `lookFields(from, at)` is the maths. To keep looking at
11279
+ something that moves, `characterLookAtTracks(tracks, { scene, character,
11280
+ at: { object: 'didi' } | { camera: 'cam' } | [x, y, z] | (time) => [x, y, z],
11281
+ start, end, objects })` keys `head.turn`, `head.nod`, `lookX` and `lookY`
11282
+ from where both are at every moment; `objectPositionAt(tracks, target,
11283
+ base)` is the sampler it uses. For several figures, `stageSpots({ count,
11284
+ shape: 'line' | 'arc' | 'circle' | 'cluster', spacing, centre })` gives
11285
+ positions and headings that do not overlap: a line across, an arc facing its
11286
+ middle, a circle facing in, or a seeded loose group.
11287
+
11142
11288
  **Riding.** `propRide3D({ prop, propId, propTracks, scene, placement, anchor, riderId, pose, start, end, mount?, dismount? })`
11143
11289
  keeps a rider's hips on a prop's seat anchor (a horse's `saddle`, a bike's or
11144
11290
  a cart's `seat`) as the prop moves, turns, bobs with its stride and pitches,
@@ -11307,8 +11453,9 @@ renderer.render(resolveScene3D(scene, values, { width: canvas.width, height: can
11307
11453
  trails, go on `overlay`, a 2D canvas laid over the GL one (in front of the meshes);
11308
11454
  solid characters are meshes and sort properly.
11309
11455
 
11310
- It runs on a page or in a Worker (OffscreenCanvas). Node has no WebGL2, so
11311
- headless video uses the Canvas 2D renderer. The cross-browser checks
11456
+ It runs on a page or in a Worker (OffscreenCanvas). Node has no WebGL2;
11457
+ headless video uses the Canvas 2D renderer, or its software depth buffer
11458
+ (below) when shapes cut through each other. The cross-browser checks
11312
11459
  (`npm run e2e -- --check scene-3d-webgl`) compile it in Chromium, Firefox and
11313
11460
  WebKit, compare its silhouettes with the Canvas 2D renderer's and check the
11314
11461
  depth buffer.
@@ -11324,6 +11471,20 @@ modest, or use a layer. Each triangle has one colour, so smooth shading is
11324
11471
  smoothed per triangle, not per pixel; more segments look rounder. The WebGL2
11325
11472
  renderer (above) has a depth buffer and per-pixel light.
11326
11473
 
11474
+ **A software depth buffer** draws right where the painter's order cannot:
11475
+ `drawScene3D(ctx, scene, values, { …, depthBuffer: true })`, or
11476
+ `new Scene3DAdapter(new SoftwareRenderer(ctx), …)`. Every triangle is
11477
+ rasterised into a pixel buffer with a depth per pixel (`rasterizeResolvedScene`
11478
+ gives the bytes and depths without a canvas), so crossing beams, huge floors
11479
+ and long meshes need no `layer` or segments; see-through meshes blend over
11480
+ what is behind them, and ink is depth-tested so an outline never shows
11481
+ through what is in front. Each triangle keeps its one shaded colour and its
11482
+ fog, edges are hard (no anti-aliasing), and objects drawn whole (characters
11483
+ in their pen looks, lines, trails) go on top of the meshes, as on the WebGL2
11484
+ overlay. It costs about three times the painter's time and works anywhere
11485
+ the Canvas 2D renderer does. Layers keep their meaning: a lower layer is
11486
+ drawn first and a higher one paints over it whatever the depths.
11487
+
11327
11488
  Rendering speed in Node: a 1280×720 scene of a few thousand triangles renders
11328
11489
  at a few frames a second; parallel rendering for long films is planned.
11329
11490
 
@@ -13765,7 +13926,7 @@ magnet.addEventListener('pointerleave', () => {
13765
13926
 
13766
13927
  <!-- capabilities: generated from the library -->
13767
13928
 
13768
- # tinyfly capabilities (v0.101.0)
13929
+ # tinyfly capabilities (v0.102.0)
13769
13930
 
13770
13931
  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).
13771
13932
 
package/llms.txt CHANGED
@@ -13,47 +13,47 @@ Key facts:
13
13
  - For language models: read the capability catalog first (`npx @algorisys/tinyfly capabilities`, or the end of llms-full.txt). It is generated from the library, so every name in it (poses, expressions, gags, gaits, beat actions, canvas properties, code-panel edits) is accepted, and names not in it are rejected with the name probably meant. Check beat scripts with `npx @algorisys/tinyfly check beats.json`, tracks with `checkTracks(tracks, targets)`, and ask any target what it animates with `describeTarget(target)`. The npm package ships `docs/`, `llms.txt`, `llms-full.txt` and an agent skill (`skills/tinyfly/SKILL.md`); `docs/llm-guide.md` describes the workflow.
14
14
  - Source: https://github.com/algorisys-oss/tinyfly. License: MIT.
15
15
 
16
- All documentation and the interactive course in a single file: [llms-full.txt](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/llms-full.txt)
16
+ All documentation and the interactive course in a single file: [llms-full.txt](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/llms-full.txt)
17
17
 
18
18
  ## Start here
19
19
 
20
- - [Getting Started](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/getting-started.md): What tinyfly is, making a first animation in the editor, and using it from code, a script tag or the CDN.
21
- - [GSAP Compatibility](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/gsap-compat.md): The GSAP-style API (`live.to`, `tf.timeline`): supported vars, motion paths, morphSVG, text, inertia, Draggable, Flip, and where it differs from GSAP.
22
- - [Code Examples](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/examples.md): Recipes with the engine API: fades, loops, colour and bezier easing, loading JSON, canvas and SVG rendering, multi-scene sequences, motion paths and script-tag embeds.
23
- - [Building Animations with an LLM](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/llm-guide.md): For assistants and the people setting them up: read the capability catalog (`tinyfly capabilities`), ask targets what they animate (`describeTarget`), check beats and tracks with did-you-mean errors (`tinyfly check`, `checkTracks`), render stills to look at, and the agent skill shipped in the package.
20
+ - [Getting Started](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/getting-started.md): What tinyfly is, making a first animation in the editor, and using it from code, a script tag or the CDN.
21
+ - [GSAP Compatibility](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/gsap-compat.md): The GSAP-style API (`live.to`, `tf.timeline`): supported vars, motion paths, morphSVG, text, inertia, Draggable, Flip, and where it differs from GSAP.
22
+ - [Code Examples](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/examples.md): Recipes with the engine API: fades, loops, colour and bezier easing, loading JSON, canvas and SVG rendering, multi-scene sequences, motion paths and script-tag embeds.
23
+ - [Building Animations with an LLM](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/llm-guide.md): For assistants and the people setting them up: read the capability catalog (`tinyfly capabilities`), ask targets what they animate (`describeTarget`), check beats and tracks with did-you-mean errors (`tinyfly check`, `checkTracks`), render stills to look at, and the agent skill shipped in the package.
24
24
 
25
25
  ## Reference
26
26
 
27
- - [API Reference](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/api-reference.md): Every public engine, player and adapter API: Timeline, tracks, keyframes, easing, drivers, serialization and exports.
28
- - [File Format](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/file-format.md): The JSON animation format: timelines, every track kind, keyframes, easing and the project file — for generating or consuming animations.
27
+ - [API Reference](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/api-reference.md): Every public engine, player and adapter API: Timeline, tracks, keyframes, easing, drivers, serialization and exports.
28
+ - [File Format](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/file-format.md): The JSON animation format: timelines, every track kind, keyframes, easing and the project file — for generating or consuming animations.
29
29
 
30
30
  ## Editor features
31
31
 
32
- - [Editor Guide](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/editor-guide.md): Every panel and feature of the visual editor, from elements and keyframes to text and inertia tracks, preview and export.
33
- - [Shape Morphing](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/shape-morph.md): Tweening one path into another, including shapes with different point counts and several subpaths.
34
- - [Pen Tool](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/pen-tool.md): Drawing custom paths point by point with straight segments and bezier curves.
35
- - [Polygons & Stars](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/polygon-star.md): Parametric polygon and star shapes that stay editable while animating like any path.
36
- - [Grid & Snapping](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/grid-and-snapping.md): The grid overlay, snapping to grid, elements and artboard centre, and alignment guides.
37
- - [Onion Skinning](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/onion-skinning.md): Ghost frames before and after the playhead for judging arcs and easing.
38
- - [Sprite-sheet Export](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/sprite-sheet-export.md): Exporting frames as a PNG grid plus JSON metadata for game engines and canvas players.
32
+ - [Editor Guide](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/editor-guide.md): Every panel and feature of the visual editor, from elements and keyframes to text and inertia tracks, preview and export.
33
+ - [Shape Morphing](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/shape-morph.md): Tweening one path into another, including shapes with different point counts and several subpaths.
34
+ - [Pen Tool](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/pen-tool.md): Drawing custom paths point by point with straight segments and bezier curves.
35
+ - [Polygons & Stars](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/polygon-star.md): Parametric polygon and star shapes that stay editable while animating like any path.
36
+ - [Grid & Snapping](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/grid-and-snapping.md): The grid overlay, snapping to grid, elements and artboard centre, and alignment guides.
37
+ - [Onion Skinning](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/onion-skinning.md): Ghost frames before and after the playhead for judging arcs and easing.
38
+ - [Sprite-sheet Export](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/sprite-sheet-export.md): Exporting frames as a PNG grid plus JSON metadata for game engines and canvas players.
39
39
 
40
40
  ## Guides
41
41
 
42
- - [Scroll Animation](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/scroll-animation.md): Scroll-driven and play-when-visible animation with ScrollDriver and VisibilityDriver.
43
- - [Props: Everyday Objects with Behaviours](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/props.md): Cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane: 3D rigs drawn with the characters’ pens (clean, pencil) that turn toward the camera, with beats acted through the 12 principles (anticipation, squash and stretch, follow-through, an exaggeration dial), wheels that roll exactly, effects, and figures riding them.
44
- - [Teaching Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/teaching.md): Step-through explanatory figures: markers, captions in several languages, the teaching player, step controls, one-script declarative embeds, tinyfly/teach diagram primitives, and validate / render for build pipelines.
45
- - [Rendering Video from Code](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/video-rendering.md): Rendering a scene to MP4 without a browser: `tinyfly video`, custom canvas targets drawn by code, timing from narration and recorded voice-over, the stick-figure character, SRT/WebVTT captions, stills, porting Cairo scripts, and a benchmark against pycairo.
46
- - [Animated Maps](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/maps.md): Maps that animate: a camera that flies in to a city, pins that drop in, routes that draw themselves while a marker travels them, on OpenStreetMap tiles or an offline world outline (also in pencil), in the browser and in headless video.
47
- - [Cartoon Hands](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/cartoon-hands.md): A hand you can pose: a palm and five fingers in 3D, posed by numbers (curls, thumb, spread, wrist turn), ready-made shapes from a fist to a pencil grip, left and right, four or five fingers, in clean, pencil and silhouette looks; the animator's hand and character gloves are built on it.
48
- - [Character Appearance](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/character-appearance.md): Hair (34 styles), facial hair (20), glasses, hats and ears for the v2 character as plain data on the head, so they turn with it through all eight views; builds (child, tall, short…), a recurring cast (castMember), expressions with blush, tears and sweat, everyday poses, held items (mug, phone, bags, umbrella, parcel) and two characters’ hands meeting (meetHands: handshake, high five, hand-over).
49
- - [Cartoon Acting](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/acting.md): actTracks(): the same key poses, acted: anticipation, overshoot and settle, overlapping joints, eyes that lead and blink, moving holds and jump squash, in full, snappy or limited styles; gags as data (take, double take, wind-up); a line of action (bend); gaits with personality; lip-sync from text (Latin and Devanagari); beat scripts compiled to acted tracks; your own actions (defineAction), gaits (defineGait) and personas (persona()); acting on code (codePanel lines and words as anchors: leap onto a line, point at it, swipe it away wiped, knocked off or blurred; grab, throw, kick, carry and drop words, push them along their line, write new text in by hand; ride a line as gaps close); camera shots (push in, cut, shake, follow); the cartoon zip; speed lines, dust puffs and impact stars; drawing on twos (a timeline setting); acting, gags, walks and lines in the editor.
50
- - [Dance and Flips](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/dance.md): The stick figure dances disco, hip hop, breaking, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap (with tap sounds) and popping (side glide, moonwalk), and does front, back, layout and scissor flips, cartwheels, handsprings, split leaps and full splits: wrists, ankles, turn-out, spin and rise as pose fields; moves keyed in beats; styles, grooves and routines as plain data.
51
- - [3D Scenes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/scene-3d.md): @algorisys/tinyfly/scene-3d: cameras, lights and meshes as JSON, in metres, animated by tracks at <scene>/<object> (cuts with activeCamera), drawn on a 2D canvas with flat, smooth or toon shading, ink outlines and fog, in browsers, Workers and Node (MP4 with tinyfly video); v2 characters in scenes, dancing, in their pen looks or as solid figures, seen by any camera.
52
- - [3D Transforms and Rotations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/3d-rotations.md): CSS-style 3D for flat elements in every renderer (rotateX, rotateY, z, perspective, backface visibility; true perspective on Canvas and WebGL, matching CSS within a pixel), one documented transform order, the editor's 3D fields; smooth quaternion rotations with interpolation: "slerp"; the vec3, quat and mat4 helpers; format version 2.
53
- - [Extending tinyfly](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/extending.md): Writing a render adapter, animating any object with live and the ticker, custom and parametric eases, stagger offsets, adding a track kind, and contributing gallery examples.
54
- - [Deployment](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/docs/DEPLOYMENT.md): Building and hosting the editor, and serving the player bundles.
42
+ - [Scroll Animation](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/scroll-animation.md): Scroll-driven and play-when-visible animation with ScrollDriver and VisibilityDriver.
43
+ - [Props: Everyday Objects with Behaviours](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/props.md): Cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane: 3D rigs drawn with the characters’ pens (clean, pencil) that turn toward the camera, with beats acted through the 12 principles (anticipation, squash and stretch, follow-through, an exaggeration dial), wheels that roll exactly, effects, and figures riding them.
44
+ - [Teaching Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/teaching.md): Step-through explanatory figures: markers, captions in several languages, the teaching player, step controls, one-script declarative embeds, tinyfly/teach diagram primitives, and validate / render for build pipelines.
45
+ - [Rendering Video from Code](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/video-rendering.md): Rendering a scene to MP4 without a browser: `tinyfly video`, custom canvas targets drawn by code, timing from narration and recorded voice-over, the stick-figure character, SRT/WebVTT captions, stills, porting Cairo scripts, and a benchmark against pycairo.
46
+ - [Animated Maps](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/maps.md): Maps that animate: a camera that flies in to a city, pins that drop in, routes that draw themselves while a marker travels them, on OpenStreetMap tiles or an offline world outline (also in pencil), in the browser and in headless video.
47
+ - [Cartoon Hands](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/cartoon-hands.md): A hand you can pose: a palm and five fingers in 3D, posed by numbers (curls, thumb, spread, wrist turn), ready-made shapes from a fist to a pencil grip, left and right, four or five fingers, in clean, pencil and silhouette looks; the animator's hand and character gloves are built on it.
48
+ - [Character Appearance](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/character-appearance.md): Hair (34 styles), facial hair (20), glasses, hats and ears for the v2 character as plain data on the head, so they turn with it through all eight views; builds (child, tall, short…), a recurring cast (castMember), expressions with blush, tears and sweat, everyday poses, held items (mug, phone, bags, umbrella, parcel) and two characters’ hands meeting (meetHands: handshake, high five, hand-over).
49
+ - [Cartoon Acting](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/acting.md): actTracks(): the same key poses, acted: anticipation, overshoot and settle, overlapping joints, eyes that lead and blink, moving holds and jump squash, in full, snappy or limited styles; gags as data (take, double take, wind-up); a line of action (bend); gaits with personality; lip-sync from text (Latin and Devanagari); beat scripts compiled to acted tracks; your own actions (defineAction), gaits (defineGait) and personas (persona()); acting on code (codePanel lines and words as anchors: leap onto a line, point at it, swipe it away wiped, knocked off or blurred; grab, throw, kick, carry and drop words, push them along their line, write new text in by hand; ride a line as gaps close); camera shots (push in, cut, shake, follow); the cartoon zip; speed lines, dust puffs and impact stars; drawing on twos (a timeline setting); acting, gags, walks and lines in the editor.
50
+ - [Dance and Flips](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/dance.md): The stick figure dances disco, hip hop, breaking, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap (with tap sounds) and popping (side glide, moonwalk), and does front, back, layout and scissor flips, cartwheels, handsprings, split leaps and full splits: wrists, ankles, turn-out, spin and rise as pose fields; moves keyed in beats; styles, grooves and routines as plain data.
51
+ - [3D Scenes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/scene-3d.md): @algorisys/tinyfly/scene-3d: cameras, lights and meshes as JSON, in metres, animated by tracks at <scene>/<object> (cuts with activeCamera), drawn on a 2D canvas with flat, smooth or toon shading, ink outlines and fog, in browsers, Workers and Node (MP4 with tinyfly video); v2 characters in scenes, dancing, in their pen looks or as solid figures, seen by any camera.
52
+ - [3D Transforms and Rotations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/3d-rotations.md): CSS-style 3D for flat elements in every renderer (rotateX, rotateY, z, perspective, backface visibility; true perspective on Canvas and WebGL, matching CSS within a pixel), one documented transform order, the editor's 3D fields; smooth quaternion rotations with interpolation: "slerp"; the vec3, quat and mat4 helpers; format version 2.
53
+ - [Extending tinyfly](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/extending.md): Writing a render adapter, animating any object with live and the ticker, custom and parametric eases, stagger offsets, adding a track kind, and contributing gallery examples.
54
+ - [Deployment](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/docs/DEPLOYMENT.md): Building and hosting the editor, and serving the player bundles.
55
55
 
56
56
  ## Optional
57
57
 
58
- - [README](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/README.md): Feature overview, project layout and development setup.
59
- - [Release notes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.101.0/release-notes/README.md): What changed in each version.
58
+ - [README](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/README.md): Feature overview, project layout and development setup.
59
+ - [Release notes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.102.0/release-notes/README.md): What changed in each version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algorisys/tinyfly",
3
- "version": "0.101.0",
3
+ "version": "0.102.0",
4
4
  "type": "module",
5
5
  "description": "Lightweight, API-driven animation engine and editor. The engine is framework-agnostic and runs in browsers, Web Workers, and Node.",
6
6
  "license": "MIT",
@@ -72,7 +72,10 @@ names.
72
72
  `style: 'stick'` draws props as line art. In a 3D scene, place props with
73
73
  `rotation: [0, deg, 0]` (`rotateY` is a track) and script them with
74
74
  `propScript3D` (`to: [x, z]` metres), not `propScript` (screen px);
75
- characters there with `characterScript3D`, riders with `propRide3D`.
75
+ characters there with `characterScript3D` (`say`, `look` too), riders with
76
+ `propRide3D`. A film: `shotTracks` + `transitionAt` / `drawTransition`,
77
+ `cameraMoveTracks`, `lightingPreset`, `ground`, `shadow: true`, `renderMix`;
78
+ `depthBuffer: true` when shapes cut through each other.
76
79
  - Give a v2 `character()` its look as options, not drawing code: `build`,
77
80
  `hair` (`'bob'` or `{ style, color, length }`), `facialHair`, `glasses`,
78
81
  `hat`, `ears: true`, `face: { teeth, tongue }`, `feet: 'flat' | 'pointed' |