@algorisys/tinyfly 0.120.0 → 0.122.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 +13 -6
- package/docs/character-appearance.md +62 -1
- 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 +8 -1
- package/docs/maps.md +2 -2
- package/docs/math.md +26 -4
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +1397 -1342
- package/lib/addons/cricket-play-BRehNToP.js +5506 -0
- package/lib/addons/math.js +1349 -1275
- package/lib/addons/sports.js +1 -1
- package/lib/browser/tinyfly-math.iife.js +4 -4
- package/lib/browser/tinyfly.iife.js +12 -12
- package/lib/browser/tinyfly.js +6500 -6171
- package/lib/browser/tinyfly.umd.js +12 -12
- package/lib/types/characters/body/bean-figure.d.ts +154 -0
- package/lib/types/characters/cast.d.ts +204 -2
- package/lib/types/characters/character.d.ts +21 -5
- package/lib/types/characters/head/face.d.ts +22 -2
- package/lib/types/characters/index.d.ts +2 -1
- package/lib/types/math/index.d.ts +1 -0
- package/lib/types/math/ml/loss-surface.d.ts +118 -0
- package/llms-full.txt +110 -17
- package/llms.txt +31 -31
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +7 -1
- package/lib/addons/cricket-play-C5CkNOc6.js +0 -5219
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
|
|
|
47
47
|
- **Full screen** - `data-fullscreen="true"` adds a button that fills the screen with the figure, through the Fullscreen API or, on iPhone, an overlay; the drawing scales to the screen whatever the page's figure CSS says
|
|
48
48
|
- **Scenarios** - Several timelines on one figure, and the reader chooses which plays: a group of options, a stepped slider, or clickable parts of the SVG (`data-tinyfly-choose`). Switching undoes the previous scenario's drawing and keeps the reader at the same step
|
|
49
49
|
- **Authoring kit** - `lesson()` step builder and diagram primitives (array cells, pointer, stack, queue / channel, table, pipeline) in `@algorisys/tinyfly/teach`
|
|
50
|
-
- **Maths animations** - `@algorisys/tinyfly/math`: figures as JSON (a grid a matrix warps, î and ĵ, vectors, function plots that break at asymptotes, polygons whose area shows the determinant, eigenlines, TeX labels; calculus: tangents and secants with exact slopes, Riemann sums, signed areas, Taylor polynomials from symbolic derivatives, limits; probability: seeded histograms, distributions with shaded probabilities, a Galton board, the central limit theorem, Monte Carlo π, regression and Bayes as areas; discrete: graphs searched step by step (BFS, DFS, Dijkstra) with their queue or stack, recursion trees, Venn diagrams of any set expression, clock arithmetic; AI/ML: neural networks with activations flowing, gradient descent on contoured loss surfaces, attention heatmaps, logistic regression finding its decision boundary, k-means), a built-in TeX subset (fractions, roots, sums and integrals with limits, matrices, Greek, live values) whose equations rewrite step by step with terms gliding, and ready linear algebra, calculus, probability, discrete maths and AI/ML figures. A figure is also a surface (`mathSurface`): characters point at `tip:basis.j` or `term:eq:2x` and change the figure as they speak, with `surfaceScript`. One layout feeds lesson-page embeds (`<figure data-tinyfly-math>`, stepped with captions and questions), explorables where readers drag î and ĵ, and 9:16 or 16:9 videos ([guide](docs/math.md))
|
|
50
|
+
- **Maths animations** - `@algorisys/tinyfly/math`: figures as JSON (a grid a matrix warps, î and ĵ, vectors, function plots that break at asymptotes, polygons whose area shows the determinant, eigenlines, TeX labels; calculus: tangents and secants with exact slopes, Riemann sums, signed areas, Taylor polynomials from symbolic derivatives, limits; probability: seeded histograms, distributions with shaded probabilities, a Galton board, the central limit theorem, Monte Carlo π, regression and Bayes as areas; discrete: graphs searched step by step (BFS, DFS, Dijkstra) with their queue or stack, recursion trees, Venn diagrams of any set expression, clock arithmetic; AI/ML: neural networks with activations flowing, gradient descent on contoured loss surfaces, attention heatmaps, logistic regression finding its decision boundary, k-means, and a 3D loss surface with the ball rolling down it), a built-in TeX subset (fractions, roots, sums and integrals with limits, matrices, Greek, live values) whose equations rewrite step by step with terms gliding, and ready linear algebra, calculus, probability, discrete maths and AI/ML figures. A figure is also a surface (`mathSurface`): characters point at `tip:basis.j` or `term:eq:2x` and change the figure as they speak, with `surfaceScript`. One layout feeds lesson-page embeds (`<figure data-tinyfly-math>`, stepped with captions and questions), explorables where readers drag î and ĵ, and 9:16 or 16:9 videos ([guide](docs/math.md))
|
|
51
51
|
- **Build tools** - `npx @algorisys/tinyfly validate` catches broken figures in CI; `render` writes a frame to static SVG for RSS, email and print
|
|
52
52
|
|
|
53
53
|
### Video from Code
|
|
@@ -155,6 +155,13 @@ Coloured irises, highlights, lids and age creases use the same expressions,
|
|
|
155
155
|
head turns and motion APIs. Choose a preset in the editor's Cast picker or
|
|
156
156
|
use `character(castMember('animeYoungWoman', 300))` in code.
|
|
157
157
|
|
|
158
|
+
**Bean figures**: `figure: 'bean'` draws the white outlined stick-figure style natively:
|
|
159
|
+
smooth outlined noodle limbs with no seams at the elbows, knees, shoulders, neck or hips (or
|
|
160
|
+
bare line limbs with `bean: { limbs: 'line' }`), a shaped body, big oval eyes (`face.style: 'oval'`),
|
|
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
|
+
Try `character(castMember('beanMan', 400))` or the other `BEAN_CAST` presets; see
|
|
163
|
+
[the appearance guide](docs/character-appearance.md#bean-figures-white-outlined-stick-figures).
|
|
164
|
+
|
|
158
165
|
The [Young Adult Manga Cast](https://tinyfly.app/examples/live-manga-cast)
|
|
159
166
|
adds four original presets with angular jaws, tapered chins, narrower eyes
|
|
160
167
|
and pointed hair tufts. Use `MANGA_CAST` or `castMember('mangaYoungMan', 300)`;
|
|
@@ -284,7 +291,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
|
284
291
|
itself.
|
|
285
292
|
|
|
286
293
|
```html
|
|
287
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
294
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly.iife.js"></script>
|
|
288
295
|
<script>
|
|
289
296
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
290
297
|
|
|
@@ -321,7 +328,7 @@ A teaching figure needs no code at all:
|
|
|
321
328
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
322
329
|
<figcaption>Appending to a full slice</figcaption>
|
|
323
330
|
</figure>
|
|
324
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
331
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
325
332
|
```
|
|
326
333
|
|
|
327
334
|
See [Teaching Animations](docs/teaching.md).
|
|
@@ -420,7 +427,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
|
|
|
420
427
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
421
428
|
</div>
|
|
422
429
|
|
|
423
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
430
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-player.iife.js"></script>
|
|
424
431
|
<script>
|
|
425
432
|
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
426
433
|
</script>
|
|
@@ -529,7 +536,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
529
536
|
<svg viewBox="0 0 720 200">…</svg>
|
|
530
537
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
531
538
|
</figure>
|
|
532
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
539
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
533
540
|
```
|
|
534
541
|
|
|
535
542
|
### Audio / Video Sync
|
|
@@ -839,7 +846,7 @@ Characters browser suite checks 74 desktop/mobile scenarios per browser.
|
|
|
839
846
|
| Docs viewer and `llms.txt` (`src/docs`) | 18 |
|
|
840
847
|
| Embeds, teaching kit, framework hooks, landing (`src/embed`, `src/teach`, `src/frameworks`, `src/landing`) | 33 |
|
|
841
848
|
| Headless rendering and audio (`src/headless`) | 63 |
|
|
842
|
-
| Maths figures, TeX, calculus, probability, discrete maths, AI/ML, presenter surfaces, equation steps, embeds and explorables (`src/math`) |
|
|
849
|
+
| Maths figures, TeX, calculus, probability, discrete maths, AI/ML, presenter surfaces, equation steps, embeds and explorables (`src/math`) | 128 |
|
|
843
850
|
| Entry boundaries | 3 |
|
|
844
851
|
|
|
845
852
|
## Contributing
|
|
@@ -497,7 +497,7 @@ cast member at an adult `height` (each stands at their own scale of it). The
|
|
|
497
497
|
family: `boy`, `girl`, `youngMan`, `youngWoman`, `man`, `woman`, `grandpa`,
|
|
498
498
|
`grandma`; at work (from the occupations sheet): `doctor`, `cook`, `builder`,
|
|
499
499
|
`courier`, `teacher`, `farmer`. `CHARACTER_CAST` has each one's `label`,
|
|
500
|
-
`group` (`family`, `work`, `anime` or `
|
|
500
|
+
`group` (`family`, `work`, `anime`, `manga` or `bean`), `scale` and `options`.
|
|
501
501
|
|
|
502
502
|
```js
|
|
503
503
|
const family = ['man', 'woman', 'girl', 'grandma'].map((name) => character(castMember(name, 280)))
|
|
@@ -540,6 +540,67 @@ face close-ups and a complete turnaround. Both the Character and 3D Scene
|
|
|
540
540
|
editors offer these presets in their Cast picker. The Character editor also
|
|
541
541
|
has Face style, Iris colour, Eyelashes and Age creases controls, saved in project JSON.
|
|
542
542
|
|
|
543
|
+
### Bean figures (white outlined stick figures)
|
|
544
|
+
|
|
545
|
+
`figure: 'bean'` draws the common white outlined stick-figure style: a white
|
|
546
|
+
figure with a thick black outline, smooth noodle limbs, a shaped body (rounded
|
|
547
|
+
shoulders, a slight waist, fuller hips and a rounded seat), a round head with
|
|
548
|
+
big white oval eyes, small pupils and heavy brows, white mittens and big
|
|
549
|
+
cartoon shoes (a flat sole on the ground, a rounded toe cap, a low heel). The
|
|
550
|
+
rig solves the pose as for every figure, so every pose, gait, dance, reach,
|
|
551
|
+
turn and lip-sync works on it.
|
|
552
|
+
|
|
553
|
+
```js
|
|
554
|
+
const hero = character({ figure: 'bean', height: 400, hair: { style: 'spiky', color: '#111' },
|
|
555
|
+
bean: { shirt: '#ef4444', trousers: '#1e3a5f' } })
|
|
556
|
+
drawCharacter(ctx, hero, humanPose({ ...HUMAN_POSES.point, ...HUMAN_EXPRESSIONS.happy, turn: 0.5 }))
|
|
557
|
+
const stick = character(castMember('beanStick', 400)) // bare line limbs
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
- Each limb is one smooth curve through its joints, stroked in the ink and
|
|
561
|
+
stroked again, narrower, in the fill, with round caps and joins: elbows and
|
|
562
|
+
knees never show a seam. The front arm, and on a plain figure the neck and
|
|
563
|
+
the legs, join the body without a seam: their outline is left out where it
|
|
564
|
+
lies inside the body at the root, so the fills flow together. Under a tee or
|
|
565
|
+
trousers the hem shows instead.
|
|
566
|
+
- Painter order (`joints.parts[id].order`): the back arm, the legs, the neck,
|
|
567
|
+
the body (and coat), the near arm and the head (and fedora). A limb reaching toward the viewer
|
|
568
|
+
(hands on the knees, seated thighs) draws over the body.
|
|
569
|
+
- `bean: { limbs, torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves, trousers, shoes }`:
|
|
570
|
+
`limbs: 'tube'` (default, outlined noodles) or `'line'` (bare round-capped
|
|
571
|
+
ink lines for the arms, legs and neck; the body, eyes, mittens and shoes
|
|
572
|
+
stay; `halo: '#f5f5f4'` adds a pale edge so they read on a dark set); the
|
|
573
|
+
near arm is in front of the body in both modes; `torso` body fullness
|
|
574
|
+
(1; 1.3 chubby, 0.85 thin); widths as fractions of the height (0.024 tube,
|
|
575
|
+
0.017 line, 0.0105 outline; `lineWidth` on the character also sets the
|
|
576
|
+
outline); `fill` (white); a `shirt` colour with `sleeves: 'short' | 'long' | 'none'`;
|
|
577
|
+
`trousers`; `shoes` (the fill; a dark shoe gets a shine and a dark sole).
|
|
578
|
+
An `outfit`'s `shirt`, `trousers` and `sleeves` colour the bean too (its
|
|
579
|
+
layers are not used).
|
|
580
|
+
- Detective gear: `coat` (a trench coat in that colour: lapels, a belt and
|
|
581
|
+
buckle, double-breasted buttons, a hem at the knee and sleeves to the
|
|
582
|
+
wrist), `fedora` (a brim, a pinched crown and a band) and `shades: true`
|
|
583
|
+
(big dark aviator lenses in place of the eyes, the brows still showing,
|
|
584
|
+
so the face keeps its expression; the same as `face: { shades: true }` on
|
|
585
|
+
any oval-eyed face). `castMember('beanDetective', 400)` wears all three.
|
|
586
|
+
- Defaults: ink `#111111`, white skin, `hands: 'mitten'`, shoulders 0.04 and
|
|
587
|
+
hips 0.02 of the height, `face: { style: 'oval', projection: 'volume', teeth: true, tongue: true }`.
|
|
588
|
+
The bean is always drawn in the clean look (its outline is the look).
|
|
589
|
+
- `face.style: 'oval'` works on any figure: big white oval eyes almost
|
|
590
|
+
touching, a small pupil following `lookX`/`lookY`, lids in the skin for
|
|
591
|
+
`lid`, a blink or a half-open `eye.*`, a lid line when shut (arched up in a
|
|
592
|
+
laugh), heavy brows for `brow.left`/`brow.right` and `browTilt`, and
|
|
593
|
+
bigger eyes for `eye.*` above 1 and `bulge`. Glasses grow to fit round the
|
|
594
|
+
big eyes; `face.shades` puts aviators in their place.
|
|
595
|
+
- `hands: 'mitten'` (any figure) is a plain oval mitten along the forearm.
|
|
596
|
+
- Presets in `BEAN_CAST` (also in `CHARACTER_CAST`, group `bean`):
|
|
597
|
+
`beanMan`, `beanWoman`, `beanKid`, `beanBoss`, `beanDetective` and
|
|
598
|
+
`beanStick` (bare lines).
|
|
599
|
+
- Helpers for your own layers: `beanTorso(bean, joints)` and
|
|
600
|
+
`beanTorsoOutline(torso)` (the body's shape), `beanLimbLine(root, joint, end)`
|
|
601
|
+
(a limb's centre line), `mittenAt`, `beanShoeAt`, `beanOrder`, `beanOverBody`,
|
|
602
|
+
`drawBeanFedora`.
|
|
603
|
+
|
|
543
604
|
### Young adult manga cast
|
|
544
605
|
|
|
545
606
|
`MANGA_CAST` supplies four original archetypes: `mangaYoungMan`,
|
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.122.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.122.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.122.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.122.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
|
@@ -217,6 +217,12 @@ from. The eight presets in `ANIME_CAST` (`animeBoy`, `animeGirl`,
|
|
|
217
217
|
Use `face: { style: 'anime', iris: '#4b7fce', lashes: true, ageLines: 0.6 }`
|
|
218
218
|
for coloured expressive eyes and optional creases; this is a face style,
|
|
219
219
|
not a `look` value. It uses the same expressions, blink, gaze and turn fields.
|
|
220
|
+
White outlined stick figures are `figure: 'bean'` (presets `beanMan`, `beanWoman`,
|
|
221
|
+
`beanKid`, `beanBoss`, `beanDetective`, `beanStick` in `BEAN_CAST`): seamless outlined noodle limbs or bare
|
|
222
|
+
lines (`bean: { limbs: 'tube' | 'line' }`), a shaped body (`bean.torso` fullness), big oval eyes
|
|
223
|
+
(`face.style: 'oval'`, usable on any figure), `hands: 'mitten'` and cartoon shoes; colours from
|
|
224
|
+
`bean: { shirt, sleeves, trousers, shoes }` or an `outfit`; detective gear `bean: { coat, fedora, shades: true }`
|
|
225
|
+
(aviators replace the eyes, brows still show); `halo` gives line limbs a pale edge. A bean is always drawn clean.
|
|
220
226
|
The `look` values are `clean`, `pencil`, `silhouette` and `illustrated`
|
|
221
227
|
(inked and painted, tuned with `illustrated: { light, weight, taper, shadow, highlight }`).
|
|
222
228
|
Age is proportions, hair, creases and clothes, never a stoop; a `cane` in a hand or
|
|
@@ -280,7 +286,8 @@ lesson page (`<figure data-tinyfly-math>`), an explorable and a video
|
|
|
280
286
|
`contours`, `heatmap` (`softmax: true` for attention), `classifier` (`epochs`), `kmeans`
|
|
281
287
|
(`iteration`); all seeded. For a presenter, `mathSurface(figure, { x, y })` gives the
|
|
282
288
|
figure anchors (`tip:basis.i`, `item:ID`, `term:ID:TEXT`, `node:GRAPH:NODE`) and edits
|
|
283
|
-
(`set` with `value`, `step` with `to`, `drawOn`) for `surfaceScript` beats.
|
|
289
|
+
(`set` with `value`, `step` with `to`, `drawOn`) for `surfaceScript` beats. A 3D loss
|
|
290
|
+
surface: `lossSurface3D({ expr, start, rate })` returns scene-3d JSON and tracks. See `docs/math.md`.
|
|
284
291
|
|
|
285
292
|
## Your own behaviours
|
|
286
293
|
|
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.122.0/cdn/tinyfly.iife.js"></script>
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.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
|
@@ -142,6 +142,26 @@ every time:
|
|
|
142
142
|
pre-mixed with the background, so neighbours never leave seams. Contours are
|
|
143
143
|
traced by marching squares and joined into whole curves.
|
|
144
144
|
|
|
145
|
+
#### A loss surface in 3D
|
|
146
|
+
|
|
147
|
+
`lossSurface3D({ expr, start, rate, momentum?, steps?, region?, height?, orbit? })`
|
|
148
|
+
builds f(x, y) as a 3D scene for `@algorisys/tinyfly/scene-3d`. You get a mesh
|
|
149
|
+
coloured by height, a ball rolling down the exact-gradient path, the path
|
|
150
|
+
appearing behind it, and a slow camera orbit. It returns plain data:
|
|
151
|
+
`{ scene, tracks, duration, path, losses }`. The maths module does not import
|
|
152
|
+
scene-3d.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
import { lossSurface3D } from '@algorisys/tinyfly/math'
|
|
156
|
+
import { loadScene3D, drawScene3D } from '@algorisys/tinyfly/scene-3d'
|
|
157
|
+
import { deserializeTimeline } from '@algorisys/tinyfly'
|
|
158
|
+
|
|
159
|
+
const loss = lossSurface3D({ expr: '(x^2 + 4 y^2) / 4 + sin(1.5 x) / 2', start: [-2.6, 2.2], rate: 0.18, momentum: 0.6 })
|
|
160
|
+
const scene = loadScene3D(loss.scene)
|
|
161
|
+
const timeline = deserializeTimeline({ id: 'loss', config: { duration: loss.duration }, tracks: loss.tracks })
|
|
162
|
+
// each frame: drawScene3D(ctx, scene, timeline.getStateAtTime(t).values, { width, height })
|
|
163
|
+
```
|
|
164
|
+
|
|
145
165
|
The pieces are also available on their own: `seededNetwork`, `forward`,
|
|
146
166
|
`descentPath`, `trainLogistic`, `kmeansHistory`, `contourLines`, `colorAt`.
|
|
147
167
|
|
|
@@ -238,7 +258,7 @@ lesson's step options (`duration`, `easing`, `delay`).
|
|
|
238
258
|
<figcaption>The determinant is the area of the unit square after the map.</figcaption>
|
|
239
259
|
</figure>
|
|
240
260
|
|
|
241
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
261
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.122.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
|
|
242
262
|
```
|
|
243
263
|
|
|
244
264
|
The figure draws itself into an SVG and redraws from the timeline whenever the
|
|
@@ -409,13 +429,15 @@ identity unless `matrix` is given.
|
|
|
409
429
|
**Derivative**, **Riemann Sums**, **Taylor Series**, **Galton Board**, **Central Limit
|
|
410
430
|
Theorem**, **Monte Carlo π**, **Bayes: a Positive Test**, **Graph Search**, **Recursion
|
|
411
431
|
Tree**, **Set Operations**, **Clock Arithmetic**, **Neural Network**, **Gradient Descent**,
|
|
412
|
-
**Decision Boundary**, **K-Means**, **Attention Weights
|
|
432
|
+
**Decision Boundary**, **K-Means**, **Attention Weights**, **Maths Presenter** and
|
|
433
|
+
**Loss Surface in 3D**.
|
|
413
434
|
- Videos: `linear-map-short.mjs`, `riemann-short.mjs`, `galton-short.mjs`,
|
|
414
435
|
`graph-search-short.mjs` and `gradient-descent-short.mjs` (9:16); `eigen-explainer.mjs`,
|
|
415
436
|
`taylor-explainer.mjs`, `clt-explainer.mjs`, `de-morgan-explainer.mjs` and
|
|
416
|
-
`neural-network-explainer.mjs` (16:9),
|
|
437
|
+
`neural-network-explainer.mjs` (16:9); `loss-surface-3d.mjs` (16:9, with scene-3d), in
|
|
438
|
+
`examples/headless-video/`.
|
|
417
439
|
|
|
418
440
|
## Next
|
|
419
441
|
|
|
420
|
-
|
|
442
|
+
See `todo.md` for what is planned next.
|
|
421
443
|
See `todo.md` for their status.
|
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.122.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
|