@algorisys/tinyfly 0.122.0 → 0.124.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.
- package/README.md +16 -5
- package/docs/acting.md +8 -3
- package/docs/character-appearance.md +30 -5
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +12 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +15 -1
- package/docs/maps.md +2 -2
- package/docs/math.md +1 -1
- package/docs/noir-detective.md +137 -0
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +4344 -3893
- package/lib/addons/{cricket-play-BRehNToP.js → cricket-play-B8PSBPDd.js} +2207 -2130
- package/lib/addons/sports.js +1 -1
- package/lib/browser/tinyfly.iife.js +15 -13
- package/lib/browser/tinyfly.js +9261 -8738
- package/lib/browser/tinyfly.umd.js +15 -13
- package/lib/types/characters/body/bean-figure.d.ts +37 -2
- package/lib/types/characters/capabilities.d.ts +11 -0
- package/lib/types/characters/cast.d.ts +42 -0
- package/lib/types/characters/gaits.d.ts +33 -1
- package/lib/types/characters/index.d.ts +2 -1
- package/lib/types/characters/noir/atmosphere.d.ts +124 -0
- package/lib/types/characters/noir/case-board.d.ts +137 -0
- package/lib/types/characters/noir/index.d.ts +12 -0
- package/lib/types/characters/noir/noir-kit.d.ts +38 -0
- package/lib/types/characters/noir/noir-utils.d.ts +31 -0
- package/lib/types/characters/noir/overlays.d.ts +178 -0
- package/llms-full.txt +244 -19
- package/llms.txt +32 -31
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +11 -0
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
|
|
|
68
68
|
- **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
|
|
69
69
|
- **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
|
|
70
70
|
- **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)
|
|
71
|
-
- **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)
|
|
71
|
+
- **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: airborne with the legs apart, landing on a bent knee), with arms that hang plumb however far the body leans. 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)
|
|
72
72
|
- **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
|
|
73
73
|
- **Captions** - `toSRT()` / `toWebVTT()` from narration cues or from a timeline's markers
|
|
74
74
|
|
|
@@ -161,6 +161,17 @@ bare line limbs with `bean: { limbs: 'line' }`), a shaped body, big oval eyes (`
|
|
|
161
161
|
mittens and cartoon shoes, plus detective gear (`coat`, `fedora`, aviator `shades`), on the same rig, so every pose, gait, dance and expression works.
|
|
162
162
|
Try `character(castMember('beanMan', 400))` or the other `BEAN_CAST` presets; see
|
|
163
163
|
[the appearance guide](docs/character-appearance.md#bean-figures-white-outlined-stick-figures).
|
|
164
|
+
Household clothes dress them too: a `skirt` (a sari, or a kurta's hem with `length`) that
|
|
165
|
+
walks and sits with the legs, a `drape` (pallu or dupatta) and `bangles` (`castMember('beanSari', 400)`).
|
|
166
|
+
|
|
167
|
+
**Noir and detective scenes**: a canvas kit for detective stories, deterministic from time: rain in a
|
|
168
|
+
window, light through blinds, darkness with torch beams and holes, glow, vignette, lightning and a
|
|
169
|
+
flickering bulb (`drawRain`, `drawBlinds`, `drawDarkness`, …); the red clue magnifier, an evidence folder,
|
|
170
|
+
a clock and time chip, a freeze-frame suspect name card, a typed narration box and speech bubbles; and a
|
|
171
|
+
case board as data (`caseBoard` + `drawCaseBoard`: pinned photo and note cards, red string, marker
|
|
172
|
+
cross-outs and scribble-outs drawn on over time). Text and fonts are yours. See
|
|
173
|
+
[Noir and Detective Scenes](docs/noir-detective.md) and the
|
|
174
|
+
[Noir Case File](https://tinyfly.app/examples/live-noir-case-file) example.
|
|
164
175
|
|
|
165
176
|
The [Young Adult Manga Cast](https://tinyfly.app/examples/live-manga-cast)
|
|
166
177
|
adds four original presets with angular jaws, tapered chins, narrower eyes
|
|
@@ -291,7 +302,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
|
291
302
|
itself.
|
|
292
303
|
|
|
293
304
|
```html
|
|
294
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
305
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
|
|
295
306
|
<script>
|
|
296
307
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
297
308
|
|
|
@@ -328,7 +339,7 @@ A teaching figure needs no code at all:
|
|
|
328
339
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
329
340
|
<figcaption>Appending to a full slice</figcaption>
|
|
330
341
|
</figure>
|
|
331
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
342
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
332
343
|
```
|
|
333
344
|
|
|
334
345
|
See [Teaching Animations](docs/teaching.md).
|
|
@@ -427,7 +438,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
|
|
|
427
438
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
428
439
|
</div>
|
|
429
440
|
|
|
430
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
441
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-player.iife.js"></script>
|
|
431
442
|
<script>
|
|
432
443
|
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
433
444
|
</script>
|
|
@@ -536,7 +547,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
536
547
|
<svg viewBox="0 0 720 200">…</svg>
|
|
537
548
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
538
549
|
</figure>
|
|
539
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
550
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
540
551
|
```
|
|
541
552
|
|
|
542
553
|
### Audio / Video Sync
|
package/docs/acting.md
CHANGED
|
@@ -172,7 +172,8 @@ shoots up and curls on landing. At 0 the figure is drawn exactly as before.
|
|
|
172
172
|
How a figure walks is data: `GAITS` has `walk` (the plain walk, the same as
|
|
173
173
|
`walkPose()`), `bouncy`, `doubleBounce` (two bobs a step), `sneak` (tiptoe in
|
|
174
174
|
a crouch, paws up), `strut` (chest out), `tired` (slumped and dragging) and
|
|
175
|
-
`run` (knees high, arms pumping,
|
|
175
|
+
`run` (knees high, arms pumping, in the air with the legs apart and landing
|
|
176
|
+
on a bent knee as they pass).
|
|
176
177
|
|
|
177
178
|
```js
|
|
178
179
|
gaitPose('sneak', phase, base) // a pose at a phase of the cycle
|
|
@@ -181,8 +182,12 @@ gaitStrideLength('sneak', height) // ground per cycle, so feet stay plante
|
|
|
181
182
|
|
|
182
183
|
A gait is a handful of numbers (`swing`, `knee`, `arm`, `elbow`, `forearm`,
|
|
183
184
|
`shoulder`, `lean`, `bend`, `headTilt`, `bounce`, `bounces`, `squash`,
|
|
184
|
-
`crouch`, `tiptoe`, `sway`), so you can write your own and
|
|
185
|
-
a name.
|
|
185
|
+
`crouch`, `tiptoe`, `sway`, `flight`, `give`), so you can write your own and
|
|
186
|
+
pass it in place of a name. `flight: true` puts the bounce's peak where the
|
|
187
|
+
legs are furthest apart (a run) instead of where they pass (a walk), and
|
|
188
|
+
`give` (degrees) bends the knee of the leg carrying the weight. Swinging arms
|
|
189
|
+
hang plumb however far the gait leans, so `shoulder` (paws held up) is
|
|
190
|
+
measured from the vertical. On a `stickFigureTarget` the `gait` prop picks one, and a string track
|
|
186
191
|
switches it: `{ property: 'gait', keyframes: [{ time: 0, value: 'walk' }, { time: 3000, value: 'run' }] }`.
|
|
187
192
|
|
|
188
193
|
## Lip-sync
|
|
@@ -563,8 +563,9 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
|
|
|
563
563
|
the legs, join the body without a seam: their outline is left out where it
|
|
564
564
|
lies inside the body at the root, so the fills flow together. Under a tee or
|
|
565
565
|
trousers the hem shows instead.
|
|
566
|
-
- Painter order (`joints.parts[id].order`): the back arm, the legs
|
|
567
|
-
|
|
566
|
+
- Painter order (`joints.parts[id].order`): the back arm, the legs (and a
|
|
567
|
+
skirt over both), the neck, the body (with its drape, and coat), the near
|
|
568
|
+
arm and the head (and fedora). A limb reaching toward the viewer
|
|
568
569
|
(hands on the knees, seated thighs) draws over the body.
|
|
569
570
|
- `bean: { limbs, torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves, trousers, shoes }`:
|
|
570
571
|
`limbs: 'tube'` (default, outlined noodles) or `'line'` (bare round-capped
|
|
@@ -583,6 +584,26 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
|
|
|
583
584
|
(big dark aviator lenses in place of the eyes, the brows still showing,
|
|
584
585
|
so the face keeps its expression; the same as `face: { shades: true }` on
|
|
585
586
|
any oval-eyed face). `castMember('beanDetective', 400)` wears all three.
|
|
587
|
+
- Household clothes (all off by default):
|
|
588
|
+
- `skirt`: a colour (a sari or long skirt, ending just above the ankle so
|
|
589
|
+
the shoes show) or `{ color, length }`, `length` 0.1–1 of the way from
|
|
590
|
+
the hips to the ankles (about 0.45 for a kurta's hem over trousers). It
|
|
591
|
+
follows the legs: standing or walking it is one flared shape outside both
|
|
592
|
+
legs with two soft pleats; seated (`beanStanding(joints)` is false) it
|
|
593
|
+
lies along each thigh to the knees and shins, its ends kept above the
|
|
594
|
+
floor. Under a skirt the legs draw before the body, so the body covers
|
|
595
|
+
the waist.
|
|
596
|
+
- `drape`: a pallu or dupatta in that colour, a band from the shoulder by
|
|
597
|
+
the neck across the chest to the far hip, inside the body's outline.
|
|
598
|
+
- `bangles`: their colour; three thin rings across each forearm near the
|
|
599
|
+
wrist (`BEAN_BANGLE_STOPS`), over any sleeve.
|
|
600
|
+
- `castMember('beanSari', 400)` wears all three, with a blouse (`shirt`),
|
|
601
|
+
a low bun and dark shoes.
|
|
602
|
+
|
|
603
|
+
```js
|
|
604
|
+
const kurta = character({ figure: 'bean', height: 400, hair: { style: 'bob', color: '#222' },
|
|
605
|
+
bean: { shirt: '#0e7490', skirt: { color: '#0e7490', length: 0.45 }, trousers: '#f5f5f4', drape: '#fbbf24', bangles: '#dc2626' } })
|
|
606
|
+
```
|
|
586
607
|
- Defaults: ink `#111111`, white skin, `hands: 'mitten'`, shoulders 0.04 and
|
|
587
608
|
hips 0.02 of the height, `face: { style: 'oval', projection: 'volume', teeth: true, tongue: true }`.
|
|
588
609
|
The bean is always drawn in the clean look (its outline is the look).
|
|
@@ -594,12 +615,16 @@ const stick = character(castMember('beanStick', 400)) // bare line limbs
|
|
|
594
615
|
big eyes; `face.shades` puts aviators in their place.
|
|
595
616
|
- `hands: 'mitten'` (any figure) is a plain oval mitten along the forearm.
|
|
596
617
|
- Presets in `BEAN_CAST` (also in `CHARACTER_CAST`, group `bean`):
|
|
597
|
-
`beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective
|
|
598
|
-
`beanStick` (bare lines).
|
|
618
|
+
`beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective`,
|
|
619
|
+
`beanStick` (bare lines) and `beanSari` (a sari with a pallu and bangles).
|
|
599
620
|
- Helpers for your own layers: `beanTorso(bean, joints)` and
|
|
600
621
|
`beanTorsoOutline(torso)` (the body's shape), `beanLimbLine(root, joint, end)`
|
|
601
622
|
(a limb's centre line), `mittenAt`, `beanShoeAt`, `beanOrder`, `beanOverBody`,
|
|
602
|
-
`drawBeanFedora
|
|
623
|
+
`drawBeanFedora`, `beanAlongLeg(joints, side, f)` (a point along a leg) and
|
|
624
|
+
`beanStanding(joints)`.
|
|
625
|
+
- For detective and noir scenes around these figures (rain, blinds, torch
|
|
626
|
+
beams, clue markers, name cards, a case board), see
|
|
627
|
+
[Noir and Detective Scenes](noir-detective.md).
|
|
603
628
|
|
|
604
629
|
### Young adult manga cast
|
|
605
630
|
|
package/docs/editor-guide.md
CHANGED
|
@@ -1143,7 +1143,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
|
|
|
1143
1143
|
**Steps to embed:**
|
|
1144
1144
|
1. Build the player: `npm run build:player`
|
|
1145
1145
|
2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
|
|
1146
|
-
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
1146
|
+
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-player.iife.js`
|
|
1147
1147
|
instead; see [Deployment](DEPLOYMENT.md))
|
|
1148
1148
|
3. Copy the generated code into your HTML
|
|
1149
1149
|
4. Adjust the script `src` path if needed
|
package/docs/examples.md
CHANGED
|
@@ -11,6 +11,17 @@ its own controls and scrolling in a full viewport; gallery panels and code
|
|
|
11
11
|
sections remain in the original tab. **Copy code** exports the same standalone
|
|
12
12
|
HTML. [Try the manga example](https://tinyfly.app/examples/live-manga-cast/full).
|
|
13
13
|
|
|
14
|
+
## Noir Case File
|
|
15
|
+
|
|
16
|
+
[Noir Case File](https://tinyfly.app/examples/live-noir-case-file) plays a
|
|
17
|
+
detective scene from the noir kit: rain on the window, street light through
|
|
18
|
+
the blinds, a torch beam in the dark, the red clue magnifier, a speech
|
|
19
|
+
bubble, a freeze-frame name card, a narration box and a time chip. Switch to
|
|
20
|
+
the case board, where cards are pinned up, red string stretches between them
|
|
21
|
+
and the marker crosses out, strikes, scribbles out and rings them. The bean
|
|
22
|
+
cast wears a trench coat and a sari with a pallu and bangles. See
|
|
23
|
+
[Noir and Detective Scenes](noir-detective.md).
|
|
24
|
+
|
|
14
25
|
## Young Adult Manga Cast
|
|
15
26
|
|
|
16
27
|
[Young Adult Manga Cast](https://tinyfly.app/examples/live-manga-cast) shows
|
|
@@ -743,7 +754,7 @@ For simple website embedding without a build system.
|
|
|
743
754
|
</html>
|
|
744
755
|
```
|
|
745
756
|
|
|
746
|
-
Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
757
|
+
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.124.0/cdn/tinyfly-player.iife.js`.
|
|
747
758
|
|
|
748
759
|
---
|
|
749
760
|
|
package/docs/getting-started.md
CHANGED
|
@@ -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.
|
|
188
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
|
|
189
189
|
<script>
|
|
190
190
|
tinyfly.to('.box', { x: 200, duration: 1 })
|
|
191
191
|
</script>
|
package/docs/gsap-compat.md
CHANGED
|
@@ -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.
|
|
77
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
|
|
78
78
|
<script>
|
|
79
79
|
tinyfly.to('.box', { x: 200, duration: 1 })
|
|
80
80
|
</script>
|
package/docs/llm-guide.md
CHANGED
|
@@ -223,6 +223,17 @@ lines (`bean: { limbs: 'tube' | 'line' }`), a shaped body (`bean.torso` fullness
|
|
|
223
223
|
(`face.style: 'oval'`, usable on any figure), `hands: 'mitten'` and cartoon shoes; colours from
|
|
224
224
|
`bean: { shirt, sleeves, trousers, shoes }` or an `outfit`; detective gear `bean: { coat, fedora, shades: true }`
|
|
225
225
|
(aviators replace the eyes, brows still show); `halo` gives line limbs a pale edge. A bean is always drawn clean.
|
|
226
|
+
Household clothes on a bean: `bean: { skirt: '#c2410c' }` (a sari to the ankle) or
|
|
227
|
+
`skirt: { color, length: 0.45 }` (a kurta hem; pair it with `trousers`), `drape` (a pallu or dupatta sash)
|
|
228
|
+
and `bangles`; preset `beanSari`. The skirt follows the legs (flared standing, along the thighs seated).
|
|
229
|
+
For detective / noir scenes use the canvas kit (docs/noir-detective.md): `drawRain(ctx, time, box)`,
|
|
230
|
+
`drawBlinds`, `drawDarkness(ctx, { amount, cones: [{ x, y, angle /* degrees */, length, width }], holes })`,
|
|
231
|
+
`drawGlow`, `drawVignette`, `drawClueMarker(ctx, time, { x, y, at })`, `drawNameCard(ctx, time, { name, role, at, anchor })`,
|
|
232
|
+
`drawNarrationBox(ctx, time, { text, start, end, speaker })`, `drawSpeechBubble(ctx, time, { text, start, end, tail })`,
|
|
233
|
+
`drawTimeChip`, `drawClockFace`, `drawEvidenceFolder`, and a case board as data:
|
|
234
|
+
`drawCaseBoard(ctx, caseBoard({ x, y, width, height, cards, strings, marks }), time, { drawCard })`
|
|
235
|
+
(marks `cross | strike | scribble | circle`; it returns the marker nib). All times are ms and every
|
|
236
|
+
function is a pure function of time; never use `Math.random` for rain or grain. Text is yours (any script).
|
|
226
237
|
The `look` values are `clean`, `pencil`, `silhouette` and `illustrated`
|
|
227
238
|
(inked and painted, tuned with `illustrated: { light, weight, taper, shadow, highlight }`).
|
|
228
239
|
Age is proportions, hair, creases and clothes, never a stoop; a `cane` in a hand or
|
|
@@ -295,7 +306,10 @@ Write new actions with `defineAction()` (from beats, or as timed pose steps),
|
|
|
295
306
|
new gaits with `defineGait()`, and characters with `persona()`. Pass them where
|
|
296
307
|
they are used; `persona.describe()` and `capabilities(version, cast)` list them,
|
|
297
308
|
and the checks accept them. See "Your own actions, gaits and personas" in
|
|
298
|
-
`docs/acting.md`.
|
|
309
|
+
`docs/acting.md`. In a gait, swinging arms hang plumb whatever the `lean` and
|
|
310
|
+
`bend` (so `shoulder` is from the vertical); a run-like gait wants
|
|
311
|
+
`flight: true` (airborne with the legs apart, grounded as they pass) and a
|
|
312
|
+
knee `give` of 20–30 so it lands on a bent knee.
|
|
299
313
|
|
|
300
314
|
## 2. Ask a target what it can do
|
|
301
315
|
|
package/docs/maps.md
CHANGED
|
@@ -14,8 +14,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
|
|
|
14
14
|
adds to the same `tinyfly` global:
|
|
15
15
|
|
|
16
16
|
```html
|
|
17
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
18
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly.iife.js"></script>
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-maps.iife.js"></script>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
It is a separate script because the offline world map it carries adds about
|
package/docs/math.md
CHANGED
|
@@ -258,7 +258,7 @@ lesson's step options (`duration`, `easing`, `delay`).
|
|
|
258
258
|
<figcaption>The determinant is the area of the unit square after the map.</figcaption>
|
|
259
259
|
</figure>
|
|
260
260
|
|
|
261
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
261
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
The figure draws itself into an SVG and redraws from the timeline whenever the
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Noir and Detective Scenes
|
|
2
|
+
|
|
3
|
+
A kit for detective stories and film-noir moods on a canvas: rain on the
|
|
4
|
+
window, street light through venetian blinds, a dark room with a torch beam,
|
|
5
|
+
soft pools of light and a vignette; the red magnifier that marks a clue, an
|
|
6
|
+
evidence folder, a wall clock and a time chip, a freeze-frame name card for a
|
|
7
|
+
suspect, a first-person narration box and speech bubbles; and a case board
|
|
8
|
+
with pinned cards, red string and the marker's cross-outs and scribble-outs.
|
|
9
|
+
|
|
10
|
+
Every function draws on a Canvas 2D context, takes the time in ms and plain
|
|
11
|
+
options, and draws the same thing for the same input: rain comes from a
|
|
12
|
+
seeded generator, never `Math.random`, so a frame looks the same whether it
|
|
13
|
+
is rendered in order, out of order or scrubbed to. Text is always yours (any
|
|
14
|
+
language or script) and so are the fonts (`font` is a CSS family list).
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { character, castMember, drawCharacter, humanPose, HUMAN_POSES,
|
|
18
|
+
drawRain, drawBlinds, drawDarkness, drawVignette, drawClueMarker,
|
|
19
|
+
drawNameCard, drawNarrationBox, drawTimeChip } from '@algorisys/tinyfly/characters'
|
|
20
|
+
|
|
21
|
+
const detective = character(castMember('beanDetective', 460))
|
|
22
|
+
|
|
23
|
+
function frame(ctx, time) {
|
|
24
|
+
ctx.fillStyle = '#232b37'
|
|
25
|
+
ctx.fillRect(0, 0, 1920, 1080)
|
|
26
|
+
drawRain(ctx, time, { x: 1500, y: 160, width: 340, height: 440 }) // the window
|
|
27
|
+
drawBlinds(ctx, { x: 0, y: 0, width: 1920, height: 1080, opacity: 0.08 })
|
|
28
|
+
ctx.save(); ctx.translate(560, 880)
|
|
29
|
+
drawCharacter(ctx, detective, humanPose({ ...HUMAN_POSES.think, turn: 0.45 }), time)
|
|
30
|
+
ctx.restore()
|
|
31
|
+
drawDarkness(ctx, { amount: 1, cones: [{ x: 640, y: 520, angle: 15, length: 760, width: 190 }] })
|
|
32
|
+
drawClueMarker(ctx, time, { x: 900, y: 680, at: 1500 })
|
|
33
|
+
drawNameCard(ctx, time, { name: 'The witness', role: 'heard footsteps', at: 6800, anchor: { x: 1340, y: 470 } })
|
|
34
|
+
drawVignette(ctx, { width: 1920, height: 1080 })
|
|
35
|
+
drawTimeChip(ctx, time, { x: 50, y: 40, text: 'Tuesday · 9:40 PM' })
|
|
36
|
+
drawNarrationBox(ctx, time, { text: 'It rained all night.', start: 300, end: 3400, speaker: 'Case file #1' })
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The [Noir Case File](https://tinyfly.app/examples/live-noir-case-file)
|
|
41
|
+
example plays a whole scene and its case board.
|
|
42
|
+
|
|
43
|
+
## Atmosphere
|
|
44
|
+
|
|
45
|
+
| Function | What it draws |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `drawRain(ctx, time, { x, y, width, height, drops?, opacity?, color?, speed?, length?, slant?, lineWidth?, seed? })` | Streaks falling in a box (a window, or the whole frame), clipped to it. 70 drops at 900–1440 px/s by default; `seed` moves them. |
|
|
48
|
+
| `drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })` | Key light through venetian blinds: parallel slanted bands (`slope` 0.35, every 52 px, 24 px thick). |
|
|
49
|
+
| `drawDarkness(ctx, { amount, cones?, holes?, bounds?, color?, opacity?, beam?, beamOpacity? })` | A dark overlay (`amount` 0–1) with torch beams and round holes cut out. A cone is `{ x, y, angle, length, width }`: from its apex toward `angle` degrees (0 right, 90 down), `width` half-wide at its end; a hole is `{ x, y, radius }`. Beams keep a little of the dark and a faint warm tint (`beam: null` for none). `coneCorners(cone)` gives a beam's corners. |
|
|
50
|
+
| `drawGlow(ctx, { x, y, radius, color?, opacity? })` | A soft pool of light (a lamp, a lit window): a radial gradient to clear. |
|
|
51
|
+
| `drawVignette(ctx, { width, height, x?, y?, inner?, outer?, opacity?, color? })` | The frame's edges fall into dark, from `inner` to `outer` of the half-diagonal. |
|
|
52
|
+
| `lightningFlash(time, strikes, decay?)` | Flash brightness 0–1 from strike times; fill the frame with a pale blue at about 0.25 × this. |
|
|
53
|
+
| `lightFlicker(time, strength?)` | A failing bulb: 0 or `strength`, in an irregular but repeatable rhythm; darken the room by it. |
|
|
54
|
+
|
|
55
|
+
Colours may be `#rgb`, `#rrggbb`, `rgb()` or `rgba()`; opacities multiply in.
|
|
56
|
+
|
|
57
|
+
## Detective overlays
|
|
58
|
+
|
|
59
|
+
| Function | What it draws |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `drawClueMarker(ctx, time, { x, y, radius?, at, duration?, color?, lineWidth? })` | The red magnifier over a clue (or a red herring): pops on at `at`, pulses, fades out over the last 400 ms of `duration` (3000). Returns its opacity; `clueMarkerAt(time, { at, duration })` gives `{ opacity, scale }`. |
|
|
62
|
+
| `drawEvidenceFolder(ctx, { x, y, scale?, angle?, color?, ink?, label?, font? })` | A tabbed folder (68 × 48 px at scale 1), tilted `angle` degrees, with an optional short label. |
|
|
63
|
+
| `drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })` | A wall clock showing a time; `clockHandAngles(hours, minutes)` gives the hands. |
|
|
64
|
+
| `drawTimeChip(ctx, time, { x, y, text, size?, font?, color?, background?, at? })` | A time or place chip (amber on black) that fades in; returns its width. |
|
|
65
|
+
| `drawNameCard(ctx, time, { name, role?, at, duration?, anchor, side?, frame?, dim?, color?, nameSize?, roleSize?, font?, tilt? })` | The freeze-frame suspect card: the frame dims (`dim` 0.35) and a slanted red band names them beside their head (`anchor`), on the side with room (`side: 'auto'`). Returns its opacity. |
|
|
66
|
+
| `drawNarrationBox(ctx, time, { text, start, end, speaker?, x?, width?, bottom?, size?, font?, background?, ink?, tagColor?, typeDuration? })` | A first-person narration box along the bottom: cream paper, the narrator's tag, the words typed on a whole word at a time (so every script types cleanly). `lineReveal(time, start, end)` gives `{ opacity, reveal }`. |
|
|
67
|
+
| `drawSpeechBubble(ctx, time, { text, start, end, tail, speaker?, maxWidth?, size?, font?, bounds?, maxCenterY?, gap?, fill?, ink? })` | A crisp comic bubble above the speaker, its tail to `tail` (their head), kept inside `bounds`; pops on at `start`, shrinks away after `end`. |
|
|
68
|
+
|
|
69
|
+
The defaults fit a 1920 × 1080 frame; pass `frame`, `bounds` or `x`/`width`
|
|
70
|
+
for another size. Draw overlays after the camera's transform is undone (in
|
|
71
|
+
screen space) and map heads with your camera, as `cameraPoint` does.
|
|
72
|
+
|
|
73
|
+
## The case board
|
|
74
|
+
|
|
75
|
+
A board is plain data: cards (photos of suspects, notes about clues), strings
|
|
76
|
+
between them and the marker's work, each with a time.
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import { caseBoard, drawCaseBoard, caseBoardMarkerTip, drawCharacter, humanPose } from '@algorisys/tinyfly/characters'
|
|
80
|
+
|
|
81
|
+
const board = caseBoard({
|
|
82
|
+
x: 60, y: 110, width: 1800, height: 900,
|
|
83
|
+
cards: [
|
|
84
|
+
{ id: 'title', x: 900, y: 40, kind: 'note', title: 'WHO CUT THE ALARM?', width: 520, height: 96 },
|
|
85
|
+
{ id: 'lift', x: 900, y: 300, title: 'Lift 2', note: 'stuck at 9:40' },
|
|
86
|
+
{ id: 'guard', x: 330, y: 540, title: 'The guard', note: 'had the key', at: 700 },
|
|
87
|
+
{ id: 'wire', x: 1450, y: 220, kind: 'note', title: 'alarm wire: cut', at: 1400 },
|
|
88
|
+
],
|
|
89
|
+
strings: [{ from: 'lift', to: 'guard', at: 1000 }, { from: 'lift', to: 'wire', at: 1400 }],
|
|
90
|
+
marks: [
|
|
91
|
+
{ on: 'guard', kind: 'cross', at: 3200 },
|
|
92
|
+
{ on: 'title', kind: 'scribble', at: 6000, duration: 1200 },
|
|
93
|
+
],
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const nib = drawCaseBoard(ctx, board, time, {
|
|
97
|
+
drawCard: (ctx, card, area) => { /* draw a portrait inside area (clipped), in the card's frame */ },
|
|
98
|
+
})
|
|
99
|
+
if (nib) drawMarkerHand(ctx, nib) // your own hand or pen, at the marker's nib
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- **Cards**: `{ id, x, y, kind?, title?, note?, width?, height?, angle?, color?, at?, highlight? }`.
|
|
103
|
+
`x`, `y` is where the card is pinned (its top centre), relative to the
|
|
104
|
+
board. `kind: 'photo'` (default, 220 × 260) is a print with a dark picture
|
|
105
|
+
area, a bold title and a red note; `kind: 'note'` (220 × 124) is a yellow
|
|
106
|
+
slip with the title and note in `handFont`. A card pops up onto its pin at
|
|
107
|
+
`at`; `highlight: { at, duration }` pulses an amber outline round it. Tilts
|
|
108
|
+
default to a small seeded angle.
|
|
109
|
+
- **Strings**: `{ from, to, at?, duration?, color? }`, red string stretching
|
|
110
|
+
from one pin to the other over `duration` (600 ms), under the cards.
|
|
111
|
+
- **Marks**: `{ on, kind, at, duration?, color?, width? }`, the marker drawn
|
|
112
|
+
on over `duration` (1400 ms): `cross` (two diagonals, one after the
|
|
113
|
+
other: ruled out), `strike` (one diagonal: half ruled out), `scribble` (a
|
|
114
|
+
zigzag across the card: scribbled out) and `circle` (a loose ring round
|
|
115
|
+
it). Marks stay once drawn.
|
|
116
|
+
- `caseBoard` checks the board and resolves every default; an unknown card
|
|
117
|
+
id or kind throws with a did-you-mean.
|
|
118
|
+
- `drawCaseBoard(ctx, board, time, { drawCard })` returns the marker's nib
|
|
119
|
+
while a mark is being drawn (else null), as does
|
|
120
|
+
`caseBoardMarkerTip(board, time)`: put a hand there. `caseCardBox(board, id)`
|
|
121
|
+
gives a card's pin, centre and corners; `caseMarkPath(board, mark)` a
|
|
122
|
+
mark's stroke points; `drawPushPin` and `drawMarkerStroke(ctx, points,
|
|
123
|
+
progress)` draw single pieces for your own boards.
|
|
124
|
+
|
|
125
|
+
## With the characters
|
|
126
|
+
|
|
127
|
+
The [bean figures](character-appearance.md#bean-figures-white-outlined-stick-figures)
|
|
128
|
+
come dressed for it: `castMember('beanDetective')` wears a trench coat, a
|
|
129
|
+
fedora and aviator shades, and household clothes (`skirt`, `drape`,
|
|
130
|
+
`bangles`; `castMember('beanSari')`) dress the witnesses. Draw a suspect in a
|
|
131
|
+
photo card through `drawCard`, and anchor a name card or a speech bubble at a
|
|
132
|
+
figure's head from `characterJoints`.
|
|
133
|
+
|
|
134
|
+
## In the catalog
|
|
135
|
+
|
|
136
|
+
`npx tinyfly capabilities` lists the kit under "Noir / detective kit";
|
|
137
|
+
`capabilities().noir` has it as data (`NOIR_KIT`).
|
package/docs/teaching.md
CHANGED
|
@@ -25,7 +25,7 @@ path for all of that:
|
|
|
25
25
|
</figure>
|
|
26
26
|
|
|
27
27
|
<!-- once, anywhere on the page (a site-wide footer is fine) -->
|
|
28
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.124.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
|