@algorisys/tinyfly 0.108.0 → 0.110.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 +10 -5
- package/docs/character-appearance.md +5 -2
- package/docs/cricket.md +181 -0
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +44 -0
- package/docs/maps.md +2 -2
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +4830 -8847
- package/lib/addons/cricket-camera-tMg3Ag3F.js +4221 -0
- package/lib/addons/scene-3d.js +436 -540
- package/lib/addons/shots-DR_ViiAC.js +125 -0
- package/lib/addons/sports.js +445 -0
- package/lib/browser/tinyfly.iife.js +12 -12
- package/lib/browser/tinyfly.js +8253 -7707
- package/lib/browser/tinyfly.umd.js +12 -12
- package/lib/types/browser/index.d.ts +1 -0
- package/lib/types/characters/capabilities.d.ts +14 -0
- package/lib/types/sports/ball-flight.d.ts +22 -0
- package/lib/types/sports/cricket/cricket-action.d.ts +7 -0
- package/lib/types/sports/cricket/cricket-camera.d.ts +15 -0
- package/lib/types/sports/cricket/cricket-field.d.ts +13 -0
- package/lib/types/sports/cricket/cricket-motion.d.ts +43 -0
- package/lib/types/sports/cricket/cricket-types.d.ts +98 -0
- package/lib/types/sports/cricket/index.d.ts +5 -0
- package/lib/types/sports/index.d.ts +3 -0
- package/llms-full.txt +268 -10
- package/llms.txt +30 -29
- package/package.json +5 -1
- package/skills/tinyfly/SKILL.md +40 -0
package/README.md
CHANGED
|
@@ -54,7 +54,11 @@ 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
|
-
- **
|
|
57
|
+
- **Cricket stories** - Public `@algorisys/tinyfly/sports` builders create an organic adult/child cast, standard pitch, full fielding side, wickets and boundary. Sixteen authored plays cover deliveries, strokes, running, boundaries, catches, fielding, throws, dismissals, no-balls and wides for Test, ODI and T20. Exact contact keys, captions and results are JSON; eight camera views include a 360° ground orbit and ball follow, with 25%–400% review zoom and reset. Fielders watch the bowler, track the incoming delivery through its bounce, then follow the struck ball. Body turns stay continuous from strokes into batter runs, into collection runs and while following return throws. A side-on right-handed stance and Adults/Men/Children/Mixed casts reuse the organic rig. Keeper-bound misses clear the native legs and intact stumps before palm collection. Public `CRICKET_FIELDING_POSITIONS` labels name all eleven stock fielders, including Extra cover; the Teams and field positions guide explains the two on-field batters, nine waiting teammates and mid-on/long-on. Playback, scrubbing and camera controls sit beside the scene (above it on phones). Try [Cricket Stories](https://tinyfly.app/examples/live-cricket-story), download its scene/action/camera JSON, or render the headless example. See [the cricket guide](docs/cricket.md).
|
|
58
|
+
Wide camera clipping scales for boundaries up to 250 m, and ball-follow generation reads only ball channels. Local full-page previews include add-ons before publication; copied pages keep their versioned CDN bundles.
|
|
59
|
+
Defensive blocks meet the blade with both hands on the bat. Keeper-bound deliveries pass outside the off stump with clearance for the displayed ball before collection.
|
|
60
|
+
|
|
61
|
+
- **Soft cartoon story characters** - Opt-in `figure: 'organic'` adds filled shoulders, chest/waist/hip contours, supple limbs, small posed hands and deterministic cel shading on the existing rig. JSON body profiles keep anatomy independent of outline width; one skin colour covers body, face and hands under scene lighting and fog, and cel shading respects inherited opacity. Rear scalp hair and hats stay with the head through camera-sorted turns and nods. Foreground arms stay over waist garments in 2D and globally sorted 3D scenes, with only foreground arms promoted to garment depths so leaning head, neck, torso and legs retain world-object occlusion. Transparent organic skin keeps exposed body, head and both hand variants outline-only in every look. Editor Skin and Line controls resolve and edit imported body colour overrides. Leaf garment options are validated and copied at construction. Actor names are checked at runtime, and each head contour is reused for filling, shading and face clipping within a draw. Editable adult and child `softCartoonCharacter` presets, flowing hair, editable everyday/formal/casual/leaf clothing and the existing script, reach and lip-sync APIs support original stories. Try [**Soft Cartoon Characters**](https://tinyfly.app/examples/live-organic-characters): adults, children or an adult and child, with seven actions, face/hair controls and independent outfit editing. `outfitPreset()` supplies JSON wardrobe defaults; shirts, T-shirts, blouses, dresses, trousers, jeans, cargo, shorts, skirts, sleeves, collars, ties and colours remain editable. See [the appearance guide](docs/character-appearance.md).
|
|
58
62
|
- **Characters** - A poseable stick figure (`@algorisys/tinyfly/characters`): named poses, facial expressions (brows, eyes that widen, close and look around, mouth shapes), squash and stretch, rubber-hose limbs, blending, walk cycles and talking, all driven by timeline tracks. **Characters v2**: one skeleton in 3D drawn flat, turning front to side to back, resting on whatever touches the ground, reaching for points, in clean, pencil or silhouette looks, and a 🧍 Character element in the editor you pose and keyframe. **Character appearance**: 41 hairstyles, including soft sweeps, flowing bobs and cascading waves with scalp-attached curved locks and individual flexibility, 20 facial-hair styles, glasses, hats and ears as plain data on the head (they turn with it through all eight views), builds from toddler to tall, a recurring cast (`castMember`), 30 expressions with blush, tears and sweat, and hair that swings after a turn or a run and settles (`hairFollowTracks` keys the lag from the character's own tracks, so drawing stays stateless); four-legged animals' ears lay back on a run the way their tails already trail. Clothes are data too (`outfit.over`: an apron, a lab coat, a hoodie, a cardigan, overalls, a sari; boots), a mouth opens on teeth and a tongue, feet come in shapes, two people hug and help each other up (`embrace`, `helpUp`), and a cane in the hand or a wheelchair to ride are accessories any character can have, not part of an age ([guide](docs/character-appearance.md))
|
|
59
63
|
- **Dance and flips** - The stick figure dances disco, hip hop, breaking toprock, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap (foot strikes as data, for tap sounds) and popping (side glide, moonwalk, forward glide, which travel with the planted foot staying put), and does front, back, layout, scissor and side flips, cartwheels, back handsprings, split leaps, toe touches and full splits. Wrists, ankles, foot turn-out, whole-body `spin` and `rise` are pose fields; moves are keyed in beats, so any tempo plays them; styles, grooves and routines are plain JSON (`danceFrame()`, `danceTracks()`, `flipPose()`, `flipTracks()`). In the editor a 🧍 Character dances from the playhead, in time with the music: an Audio element's tempo is detected (`detectTempo()`) or tapped, the timeline shows its beats and bars, and keyframes snap to them. Native v2 garba (two/three clap) and dandiya add body-local poses, circle formations with planted toes, paired stick-tip contacts, and timed full spins (`humanDanceFrame`, `danceCircleTracks`, `meetDandiya`, `characterScript3D`). Sparse custom keys keep numeric hand and pose values through JSON playback; rolled circles preserve native yaw-before-roll and foot grounding. Foot IK preserves authored hip turn-out for ankle and toe plants. Scripted dance entry preserves relaxed or explicitly posed hands through preceding holds. Script action boundaries retain preceding easing; festive examples solve contacts with their rendered body options. See [docs/dance.md](docs/dance.md)
|
|
60
64
|
- **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
|
|
@@ -229,6 +233,7 @@ for what you import:
|
|
|
229
233
|
| `@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) |
|
|
230
234
|
| `@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 |
|
|
231
235
|
| `@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) |
|
|
236
|
+
| `@algorisys/tinyfly/sports` | `cricketPlayer`, `cricketField`, `cricketAction`, `cricketClip`, `cricketCameraTracks`, `cricketEventAt`, shared `ballFlightTracks`; authored organic cricket stories and a 360° ground camera | Browser, Worker, Node; scene rendering through adapters |
|
|
232
237
|
| `@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 |
|
|
233
238
|
|
|
234
239
|
```js
|
|
@@ -275,7 +280,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
|
275
280
|
itself.
|
|
276
281
|
|
|
277
282
|
```html
|
|
278
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
283
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.0/cdn/tinyfly.iife.js"></script>
|
|
279
284
|
<script>
|
|
280
285
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
281
286
|
|
|
@@ -311,7 +316,7 @@ A teaching figure needs no code at all:
|
|
|
311
316
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
312
317
|
<figcaption>Appending to a full slice</figcaption>
|
|
313
318
|
</figure>
|
|
314
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
319
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
315
320
|
```
|
|
316
321
|
|
|
317
322
|
See [Teaching Animations](docs/teaching.md).
|
|
@@ -410,7 +415,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
|
|
|
410
415
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
411
416
|
</div>
|
|
412
417
|
|
|
413
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
418
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.0/cdn/tinyfly-player.iife.js"></script>
|
|
414
419
|
<script>
|
|
415
420
|
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
416
421
|
</script>
|
|
@@ -519,7 +524,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
519
524
|
<svg viewBox="0 0 720 200">…</svg>
|
|
520
525
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
521
526
|
</figure>
|
|
522
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
527
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
523
528
|
```
|
|
524
529
|
|
|
525
530
|
### Audio / Video Sync
|
|
@@ -187,8 +187,11 @@ off the head, how far it hangs), drawn wherever the head's `turn`, `head.turn`,
|
|
|
187
187
|
shoulders seen from the front, and a bob shows beside the face;
|
|
188
188
|
- the part facing the viewer is drawn over the head, so a fringe crosses the
|
|
189
189
|
forehead and, from behind, the hair covers the whole head;
|
|
190
|
-
- turned away (past about `turn` 1.2),
|
|
191
|
-
over an arm at the side;
|
|
190
|
+
- in a whole-figure 2D draw, turned away (past about `turn` 1.2), hair is
|
|
191
|
+
drawn after the body, over an arm at the side;
|
|
192
|
+
- in a camera-sorted 3D scene, rear hair and hats draw with the head's own
|
|
193
|
+
part, after its skin. They remain attached through independent head turns
|
|
194
|
+
and nods, without another body's draw order exposing the scalp;
|
|
192
195
|
- a parting, a side ponytail or a braid stays on the character's own side
|
|
193
196
|
through a turn: left and right are the character's, never mirrored.
|
|
194
197
|
|
package/docs/cricket.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Cricket stories
|
|
2
|
+
|
|
3
|
+
Build a cricket scene and a play as JSON with `@algorisys/tinyfly/sports`.
|
|
4
|
+
The same data runs in a browser, Worker or Node. Players use tinyfly's
|
|
5
|
+
existing organic adult and child rig. Try the [interactive cricket example](https://tinyfly.app/examples/live-cricket-story)
|
|
6
|
+
or its [full-page view](https://tinyfly.app/examples/live-cricket-story/full).
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { Timeline } from '@algorisys/tinyfly'
|
|
10
|
+
import { cricketClip, cricketCameraTracks, cricketEventAt } from '@algorisys/tinyfly/sports'
|
|
11
|
+
import { characterObjects } from '@algorisys/tinyfly/characters'
|
|
12
|
+
import { loadScene3D, drawScene3D } from '@algorisys/tinyfly/scene-3d'
|
|
13
|
+
|
|
14
|
+
const clip = cricketClip({ format: 't20', action: 'stumping', cast: 'mixed' })
|
|
15
|
+
const tracks = [...clip.timeline.tracks, ...cricketCameraTracks(clip, { view: 'keeper' })]
|
|
16
|
+
const timeline = new Timeline({ ...clip.timeline, tracks })
|
|
17
|
+
const scene = loadScene3D(clip.scene, { kinds: [characterObjects] })
|
|
18
|
+
// Your explicit clock supplies time in milliseconds.
|
|
19
|
+
function draw(ctx, time) {
|
|
20
|
+
drawScene3D(ctx, scene, timeline.getStateAtTime(time).values,
|
|
21
|
+
{ width: 1280, height: 720, time })
|
|
22
|
+
const caption = cricketEventAt(clip.events, time)?.caption
|
|
23
|
+
return caption
|
|
24
|
+
}
|
|
25
|
+
const json = JSON.stringify({ ...clip, timeline: { ...clip.timeline, tracks } })
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
With script tags, load `tinyfly.iife.js` and the scene-3d add-on. Sports builders
|
|
29
|
+
and characters are available on `tinyfly`; scene rendering uses the add-on.
|
|
30
|
+
See [getting started](getting-started.md) for the versioned CDN URLs.
|
|
31
|
+
|
|
32
|
+
## Builders
|
|
33
|
+
|
|
34
|
+
| API | Result |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `cricketPlayer({ id, role, preset?, format?, height?, position?, color?, headwear?, appearance? })` | An owned JSON `character` scene object. Roles: batter, bowler, keeper, fielder, umpire. Presets include youngMan, youngWoman, childBoy, childGirl. |
|
|
37
|
+
| `cricketField({ id?, format?, cast?, boundaryRadius?, battingColor?, fieldingColor? })` | `scene`, `format`, `boundaryRadius`, `landmarks`; stock fielders have human-readable JSON `name` labels. A 20.12 × 3.05 metre pitch, standard creases, wickets/bails, two bats, ball, boundary, eleven fielding players, two batters and two umpires. |
|
|
38
|
+
| `cricketAction(field, { action?, duration?, every? })` | A JSON timeline, timed events/captions and declared example result. Does not modify the field. |
|
|
39
|
+
| `cricketClip(options)` | Combines field and action; default T20, adult cast, pace bowling, 6000 ms. |
|
|
40
|
+
| `cricketCameraTracks(clip, { view?, yaw?, every? })` | Ordinary scene camera tracks. Merge these with the action tracks. |
|
|
41
|
+
| `cricketEventAt(events, time)` | Most recent event at that time, including when seeking backward. |
|
|
42
|
+
| `ballFlightPoint(options, time)`, `ballFlightTracks(options)` | Shared sampled arcs for other sports too. `from`, `to`, `arc`, `curve`, `start`, `end`, `target`; exact endpoints. |
|
|
43
|
+
|
|
44
|
+
Units are metres, milliseconds and degrees. `cast` is `adults`, `men`, `children` or
|
|
45
|
+
`mixed`; `CRICKET_CASTS` exports their labels. `men` uses the existing youngMan
|
|
46
|
+
organic preset for every role; adults/children/mixed retain their varied casts; `format` is `test`, `odi` or `t20`. `boundaryRadius` defaults to 64 m
|
|
47
|
+
and accepts 24–250 m. A boundary is venue dependent. Sampling defaults to 40 ms,
|
|
48
|
+
accepts 16–1000 ms and always includes play contact events. Durations accept
|
|
49
|
+
4000–60000 ms; changing duration scales the whole play. Player height accepts
|
|
50
|
+
0.5–3 m. Bare heads are the default; optional `headwear` is `none`, `cap` or
|
|
51
|
+
`sun-hat`. Appearance is JSON data, without canvas hooks or rig callbacks.
|
|
52
|
+
|
|
53
|
+
The standard action builder expects the named actors/equipment from
|
|
54
|
+
`cricketField`; required actors must be unparented with no object rotation or
|
|
55
|
+
scale. It owns poses and paths for that layout. Customize appearance and
|
|
56
|
+
uniforms before compiling; author your own scene tracks for a different layout.
|
|
57
|
+
|
|
58
|
+
Fielders watch the bowler during the run-up, smoothly pick up the moving ball
|
|
59
|
+
after release, track its flight and bounce, then follow it after contact or a miss. Head turns
|
|
60
|
+
use the rig's neck frame, including torso lean, and are independent of the
|
|
61
|
+
camera. Stationary fielders turn their bodies toward the play; running players
|
|
62
|
+
face their travel and collectors keep their catch/throw poses. The striker uses
|
|
63
|
+
a side-on right-handed guard: left shoulder and front foot toward the bowler,
|
|
64
|
+
soft knees, both feet supported, left hand above the right on the handle and a
|
|
65
|
+
bat resting near the back foot. These authored poses also fit the child rig.
|
|
66
|
+
|
|
67
|
+
The live example keeps cast/action/camera selection and playback/scrubbing in a
|
|
68
|
+
panel beside the scene, or above it on narrow screens. Select **Men** in Cast for
|
|
69
|
+
the male team; individual players remain editable through `cricketPlayer`.
|
|
70
|
+
|
|
71
|
+
## Teams and stock field positions
|
|
72
|
+
|
|
73
|
+
Each team has eleven players. `cricketField` shows all eleven of the fielding
|
|
74
|
+
XI, two on-field batters (striker and non-striker) and two umpires. The other
|
|
75
|
+
nine members of the batting XI wait off-field.
|
|
76
|
+
|
|
77
|
+
`CRICKET_FIELDING_POSITIONS` exports the stock actor IDs and labels as plain
|
|
78
|
+
JSON data. Each corresponding scene object also carries the label in `name`:
|
|
79
|
+
Bowler, Wicketkeeper, Extra cover (`fielder`, the collecting actor), Slip,
|
|
80
|
+
Point, Cover, Mid-off, Mid-on, Square leg, Fine leg and Third man. IDs used by
|
|
81
|
+
action tracks remain stable. These are illustrative placements, not a roster
|
|
82
|
+
or automatic field-setting system.
|
|
83
|
+
|
|
84
|
+
For this right-handed striker, the off side is in front of the chest (+x),
|
|
85
|
+
and the on or leg side is behind the back (−x). Mid-on stands on the leg side
|
|
86
|
+
closer to the pitch toward the bowler; long-on is its deeper boundary
|
|
87
|
+
alternative. Long-on is not an additional stock fielder. Choose a different
|
|
88
|
+
layout by authoring your own scene and tracks.
|
|
89
|
+
|
|
90
|
+
Wicketkeeper and slip stand behind the striker. Their attention follows the
|
|
91
|
+
actual delivery through its flight and bounce rather than turning to the batter
|
|
92
|
+
before the ball arrives. Their native head poses aim at world targets,
|
|
93
|
+
independently of their body yaw and camera selection. The live example's
|
|
94
|
+
**Teams and field positions** disclosure uses the scene's JSON labels.
|
|
95
|
+
|
|
96
|
+
## Review zoom
|
|
97
|
+
|
|
98
|
+
Pass `zoom` to `cricketCameraTracks(clip, { view: 'batter', zoom: 2 })` for
|
|
99
|
+
2× magnification. All eight views support 0.25–4 (default 1), including orbit
|
|
100
|
+
and ball follow. Zoom changes the field of view while preserving camera position,
|
|
101
|
+
look target, clipping distances, player motion and current story time. Invalid
|
|
102
|
+
or non-finite zoom values throw. The generated camera tracks are ordinary JSON.
|
|
103
|
+
|
|
104
|
+
The example provides a 25%–400% slider, zoom-in/out buttons and **Reset**.
|
|
105
|
+
Zoom persists while choosing another play, cast or view, and downloaded story
|
|
106
|
+
JSON includes the selected magnification. Native range controls support keyboard
|
|
107
|
+
and touch review; zooming does not seek, pause or restart playback.
|
|
108
|
+
|
|
109
|
+
## Plays and cameras
|
|
110
|
+
|
|
111
|
+
`CRICKET_ACTIONS` contains sixteen plays:
|
|
112
|
+
|
|
113
|
+
- `bowling`, `spin`: run-up, delivery, bounce and keeper collection.
|
|
114
|
+
- `batting`, `defend`: drive or block with two hands gripping the bat.
|
|
115
|
+
- `running`: batters change ends for one illustrated run.
|
|
116
|
+
- `four`, `six`: grounded boundary or boundary crossed in the air, with signals.
|
|
117
|
+
- `catch`, `fielding`, `throw`: aerial catch, ground collection or return throw.
|
|
118
|
+
- `bowled`, `lbw`, `stumping`, `run-out`: distinct authored dismissal examples.
|
|
119
|
+
- `no-ball`, `wide`: extra, umpire signal and an uncounted delivery.
|
|
120
|
+
|
|
121
|
+
The ball releases from a rendered palm, meets the blade at contact, and follows
|
|
122
|
+
the collecting hand. Bails move after the relevant wicket break. Bats scale
|
|
123
|
+
with child proportions. Events carry `id`, `time`, `kind`, `label`, `caption`;
|
|
124
|
+
the timeline also contains matching markers and English captions.
|
|
125
|
+
Drive and ground-fielding plays use distinct collection positions, with the
|
|
126
|
+
ball and fielder keyed to the same palm contact.
|
|
127
|
+
Defensive blocks retain their downward two-hand bat pose and emit the `contact`
|
|
128
|
+
event with the “Bat contact” label. Pace, spin, no-ball and stumping deliveries
|
|
129
|
+
pass outside the off stump on the side away from the batter, allowing for the
|
|
130
|
+
displayed ball and stump radii before collection. Their positive-x clearance
|
|
131
|
+
path also avoids both native legs throughout the delivery, including the
|
|
132
|
+
striker’s movement during stumping. Bowled keeps its intentional
|
|
133
|
+
wicket collision; stumping keeps the later hand-held wicket break.
|
|
134
|
+
|
|
135
|
+
`CRICKET_VIEWS` offers `pitch`, `batter`, `bowler`, `keeper`, `field`, `overhead`,
|
|
136
|
+
`orbit` and `follow-ball`. `yaw` chooses any azimuth; `orbit` adds a complete
|
|
137
|
+
360° revolution over the play. `CRICKET_CAMERA_ANGLES` provides suggested
|
|
138
|
+
starting angles. Equivalent azimuths such as 0° and 360° use identical geometry.
|
|
139
|
+
The field camera's clipping range scales with the boundary radius so wide views
|
|
140
|
+
include the full supported ground. Following the ball samples only its three
|
|
141
|
+
position channels with forward keyframe cursors, using the requested camera
|
|
142
|
+
spacing without evaluating actor tracks.
|
|
143
|
+
|
|
144
|
+
Development full-page previews load the local browser API and scene add-ons;
|
|
145
|
+
production previews and copied HTML retain the versioned CDN bundles.
|
|
146
|
+
|
|
147
|
+
## Teaching scope
|
|
148
|
+
|
|
149
|
+
These are authored visual demonstrations. Arcs, the enlarged ball, timings,
|
|
150
|
+
field placements and results are illustrative. The API does not infer a
|
|
151
|
+
cricket decision from collisions, enforce every law, simulate ball physics,
|
|
152
|
+
manage an innings or supply lesson navigation/quizzes. `result` declares
|
|
153
|
+
`runs`, `extras`, `wickets`, `legalBall`, `freeHitNext` and optional `dismissal`.
|
|
154
|
+
Use it with your own tutorial, narration, scoring or lesson system.
|
|
155
|
+
|
|
156
|
+
`CRICKET_FORMATS` records basic Test, ODI and T20 differences. Test has two
|
|
157
|
+
innings per side and no innings over limit; ODI/T20 have one innings per side
|
|
158
|
+
and maximum 50/20 overs respectively. See the [ICC format overview](https://www.icc-cricket.com/about/cricket/game-formats/the-three-formats).
|
|
159
|
+
No-balls and wides each add one extra and do not count as legal over balls.
|
|
160
|
+
The stumping example uses a legal delivery and a batter outside their ground,
|
|
161
|
+
without an attempted run. The LBW caption explicitly leaves a full decision's
|
|
162
|
+
pitching, impact and bat-contact checks to the author. Consult the
|
|
163
|
+
[MCC Laws, 2026 edition](https://www.lords.org/getmedia/a4ef9f77-2a25-4f5b-a286-4601f08e6334/Laws-of-Cricket-2017-Code-4th-Edition-(2026)_5.pdf).
|
|
164
|
+
ODI/T20 no-balls lead to a free hit on the next legitimate delivery; Test
|
|
165
|
+
does not add this automatically. Competition rules and effective dates matter:
|
|
166
|
+
see [ICC playing conditions](https://www.icc-cricket.com/about/cricket/rules-and-regulations/playing-conditions)
|
|
167
|
+
and the [October 2026 changes](https://www.icc-cricket.com/news/key-changes-across-formats-with-new-icc-playing-conditions).
|
|
168
|
+
|
|
169
|
+
## Headless video
|
|
170
|
+
|
|
171
|
+
After `npm run build:libs`:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
node bin/tinyfly.mjs video examples/headless-video/cricket-story.mjs --stills /tmp/cricket-story
|
|
175
|
+
node bin/tinyfly.mjs video examples/headless-video/cricket-story.mjs -o /tmp/cricket-story.mp4
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The example consumes the same public clip, camera and scene APIs. JSON download
|
|
179
|
+
in the interactive example includes the selected camera tracks, ready to sample
|
|
180
|
+
again after parsing. Other sports can reuse `ballFlightTracks`, character rigs
|
|
181
|
+
and scene cameras; cricket-specific motion remains in the sports add-on.
|
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.110.0/cdn/tinyfly-player.iife.js`
|
|
1147
1147
|
instead; see [Deployment](DEPLOYMENT.md))
|
|
1148
1148
|
3. Copy the generated code into your HTML
|
|
1149
1149
|
4. Adjust the script `src` path if needed
|
package/docs/examples.md
CHANGED
|
@@ -743,7 +743,7 @@ For simple website embedding without a build system.
|
|
|
743
743
|
</html>
|
|
744
744
|
```
|
|
745
745
|
|
|
746
|
-
Build the player with `npm run build:player` to generate `lib/player/tinyfly-player.iife.js`, or load it from the CDN: `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
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.110.0/cdn/tinyfly-player.iife.js`.
|
|
747
747
|
|
|
748
748
|
---
|
|
749
749
|
|
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.110.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.110.0/cdn/tinyfly.iife.js"></script>
|
|
78
78
|
<script>
|
|
79
79
|
tinyfly.to('.box', { x: 200, duration: 1 })
|
|
80
80
|
</script>
|
package/docs/llm-guide.md
CHANGED
|
@@ -88,6 +88,47 @@ bakes. See `docs/dance.md`.
|
|
|
88
88
|
|
|
89
89
|
## Characters with a look
|
|
90
90
|
|
|
91
|
+
For cricket tutorials, import `cricketClip`, `cricketCameraTracks` and
|
|
92
|
+
`cricketEventAt` from `@algorisys/tinyfly/sports`. The clip is an owned scene,
|
|
93
|
+
JSON timeline, timed captions and declared result. Choose `test | odi | t20`,
|
|
94
|
+
`adults | men | children | mixed`, and a play from `CRICKET_ACTIONS`. Merge camera
|
|
95
|
+
tracks with action tracks; render with scene-3d plus `[characterObjects]`.
|
|
96
|
+
The UI is a consumer of these APIs. `orbit` covers the full ground in 360°;
|
|
97
|
+
`follow-ball` keys against the same ball tracks. Contacts are sampled exactly,
|
|
98
|
+
including two-hand bat grip, release, catch and wicket break. These are authored
|
|
99
|
+
demonstrations, not collision-based umpiring or an innings simulator. Do not
|
|
100
|
+
infer new outcomes from the illustrative arcs. See `docs/cricket.md` and
|
|
101
|
+
`examples/headless-video/cricket-story.mjs`; `/examples/live-cricket-story`
|
|
102
|
+
has event seeking and downloadable scene/action/camera JSON.
|
|
103
|
+
`CRICKET_FIELDING_POSITIONS` maps the eleven stock fielding IDs to public labels;
|
|
104
|
+
scene objects carry them in `name`. `fielder` is Extra cover. Keep eleven fielders,
|
|
105
|
+
two on-field batters and two umpires; nine batting teammates wait off-field.
|
|
106
|
+
Mid-on is closer to the pitch; long-on is its deeper boundary alternative, not
|
|
107
|
+
an extra stock player. For the right-handed striker, +x is off side and −x is
|
|
108
|
+
on/leg side. Keeper/slip stand behind the striker; track the actual incoming delivery,
|
|
109
|
+
never force their heads toward a screen direction or the camera.
|
|
110
|
+
`cricketCameraTracks(clip, { view, zoom })` supports optical zoom 0.25–4
|
|
111
|
+
(default 1) for every view, preserving the camera path and story state. Merge
|
|
112
|
+
the returned field-of-view track into exported JSON; do not CSS-scale the canvas.
|
|
113
|
+
In camera-sorted character rendering, rear hair and hats belong to the head
|
|
114
|
+
pass; attaching them to the final body part lets the skin paint over them.
|
|
115
|
+
`CRICKET_CASTS` supplies cast labels; `men` uses the existing youngMan organic
|
|
116
|
+
preset for every role. Standard actions include camera-independent fielding
|
|
117
|
+
attention: bowler during run-up, moving delivery after release and through the
|
|
118
|
+
bounce, then the ball after contact/miss. Do not switch to the batter early.
|
|
119
|
+
The right-handed guard is side-on with the left hand above the right; preserve
|
|
120
|
+
these world-facing poses instead of rotating players toward the camera.
|
|
121
|
+
Keeper-bound misses pass on positive x, clear of the native legs and stumps
|
|
122
|
+
through every ball segment, including sparse keys and scaled durations. Keep
|
|
123
|
+
keeper palm contacts and intentional LBW pad contact.
|
|
124
|
+
Wide cameras support the full 24–250 m boundary range; equivalent yaw angles
|
|
125
|
+
use identical geometry. Ball-follow cameras sample only ball position channels.
|
|
126
|
+
Render the headless example with `tinyfly video <scene.mjs> -o <output.mp4>`.
|
|
127
|
+
Preserve the defensive block's two-hand blade contact and `contact` event.
|
|
128
|
+
Keeper-bound pace/spin/no-ball/stumping paths clear the off stump with the
|
|
129
|
+
displayed ball radius included, before palm collection. Keep bowled contact
|
|
130
|
+
and the later stumping wicket break intentional when editing these paths.
|
|
131
|
+
|
|
91
132
|
For original soft cartoon story characters, opt into `figure: 'organic'`.
|
|
92
133
|
Its default `face.projection: 'volume'` moves eyes/mouth around the head and
|
|
93
134
|
lets hair occlude them, with a flatter profile facial plane and a nose above
|
|
@@ -329,3 +370,6 @@ new-tab player using the same standalone HTML as Copy code. Live demos,
|
|
|
329
370
|
timeline examples and editable sample scenes play with their own controls
|
|
330
371
|
and scrolling, without the gallery panels. Use these URLs when sharing an
|
|
331
372
|
example for visual review.
|
|
373
|
+
Development live previews load the local browser API and required add-ons, so
|
|
374
|
+
unpublished APIs work before release. Production previews and copied pages
|
|
375
|
+
keep the versioned CDN URLs.
|
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.110.0/cdn/tinyfly.iife.js"></script>
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.0/cdn/tinyfly-maps.iife.js"></script>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
It is a separate script because the offline world map it carries adds about
|
package/docs/teaching.md
CHANGED
|
@@ -25,7 +25,7 @@ path for all of that:
|
|
|
25
25
|
</figure>
|
|
26
26
|
|
|
27
27
|
<!-- once, anywhere on the page (a site-wide footer is fine) -->
|
|
28
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.110.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
|