@algorisys/tinyfly 0.119.1 → 0.121.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.
@@ -29,6 +29,7 @@ export { descentPath, surface } from './ml/descent';
29
29
  export { blobs, trainLogistic, predict, accuracy, logLoss, type LogisticModel } from './ml/classify';
30
30
  export { kmeansHistory, assign, inertia } from './ml/kmeans';
31
31
  export { colorAt, blendOver, COLORMAPS, type Colormap } from './ml/colormap';
32
+ export { lossSurface3D, type LossSurface3D, type LossSurfaceOptions, type LossSurfaceScene, type LossSceneObject } from './ml/loss-surface';
32
33
  export { parseTex, TexError, TEX_COMMANDS, SYMBOLS, type TexNode, type TexClass } from './tex/tex-parser';
33
34
  export { layoutTex, type TexLayout, type TexPiece, type TexGlyph, type TexRule, type TexStroke, type TexLayoutOptions } from './tex/tex-layout';
34
35
  export { morphEquation, type MorphPiece, type PlacedLayout } from './tex/equation-morph';
@@ -43,6 +44,7 @@ export { displayListToSvg, displayListToSvgContent } from './render/display-list
43
44
  export { mathTarget, mathFigureProps, type MathCanvasTarget } from './targets/math-target';
44
45
  export { mathSteps, type MathSteps } from './steps/math-steps';
45
46
  export { mountMath, mountAllMath, type MountedMathFigure } from './embed/mount-math';
47
+ export { mathSurface, MATH_SURFACE, type MathSurface, type MathSurfaceBox, type MathSurfaceEdit } from './surface/math-surface';
46
48
  export { mathExplorable, type MathExplorable, type ExplorableOptions, type SliderControl, type DragHandle } from './embed/explorable';
47
49
  export { linearMapFigure, determinantFigure, eigenFigure, vectorSumFigure, spanFigure, MATRIX_TEX, type PresetOptions, } from './presets/linear-algebra';
48
50
  export { tangentFigure, secantFigure, riemannFigure, areaFigure, taylorFigure, limitFigure, type CalculusOptions } from './presets/calculus';
@@ -0,0 +1,118 @@
1
+ import type { Track } from '../../engine/types';
2
+ import type { Vec2 } from '../linear/vec2';
3
+ import { type Colormap } from './colormap';
4
+ /**
5
+ * A loss surface in 3D, as plain scene JSON for `@algorisys/tinyfly/scene-3d`:
6
+ * f(x, y) as a coloured mesh, a ball rolling down it by gradient descent
7
+ * (the same exact-gradient path the 2D `descent` item draws), the path
8
+ * appearing behind it, and an optional slow camera orbit.
9
+ *
10
+ * const loss = lossSurface3D({ expr: '(x^2 + 3 y^2) / 4', start: [-2.6, 1.8], rate: 0.25 })
11
+ * const scene = loadScene3D(loss.scene) // from @algorisys/tinyfly/scene-3d
12
+ * const timeline = new Timeline({ id: 'loss', config: { duration: loss.duration }, tracks: loss.tracks })
13
+ * drawScene3D(ctx, scene, timeline.getStateAtTime(t).values, { width, height })
14
+ *
15
+ * The maths module does not import scene-3d: the scene is data in its
16
+ * format (metres, y up), so it loads anywhere scene-3d does, Node included.
17
+ * Pure: the same options always give the same scene and tracks.
18
+ */
19
+ export interface LossSurfaceOptions {
20
+ /** f(x, y), an expression (number values come from `scope`) */
21
+ expr: string;
22
+ /** The x and y ranges shown (default [[-3, 3], [-3, 3]]) */
23
+ region?: [[number, number], [number, number]];
24
+ /** Grid cells per side (default 36) */
25
+ resolution?: number;
26
+ /** Height of the highest point above the lowest, metres (default 1.6); the region spans 5 m */
27
+ height?: number;
28
+ /** Where descent starts, and its rate and momentum */
29
+ start: Vec2;
30
+ rate: number;
31
+ momentum?: number;
32
+ /** Steps taken (default 40) and how long each takes, ms (default 250) */
33
+ steps?: number;
34
+ stepDuration?: number;
35
+ /** Degrees the camera turns round the surface over the whole run (default 50; 0 for a fixed camera) */
36
+ orbit?: number;
37
+ colormap?: Colormap;
38
+ /** Scene id: tracks address objects as `<id>/<object>` (default `loss`) */
39
+ id?: string;
40
+ background?: string;
41
+ scope?: Record<string, number>;
42
+ }
43
+ type Vec3 = [number, number, number];
44
+ /** The scene objects this builds, in scene-3d's format. */
45
+ export type LossSceneObject = {
46
+ id: string;
47
+ kind: 'group';
48
+ position?: Vec3;
49
+ rotation?: Vec3;
50
+ } | {
51
+ id: string;
52
+ kind: 'camera';
53
+ parent?: string;
54
+ projection: 'perspective';
55
+ fov: number;
56
+ near: number;
57
+ far: number;
58
+ position: Vec3;
59
+ lookAt: Vec3;
60
+ } | {
61
+ id: string;
62
+ kind: 'light';
63
+ light: 'ambient' | 'directional';
64
+ color: string;
65
+ intensity: number;
66
+ position?: Vec3;
67
+ } | {
68
+ id: string;
69
+ kind: 'mesh';
70
+ material: string;
71
+ position?: Vec3;
72
+ geometry: {
73
+ type: 'mesh';
74
+ positions: number[];
75
+ indices: number[];
76
+ colors: string[];
77
+ } | {
78
+ type: 'sphere';
79
+ radius: number;
80
+ segments?: number;
81
+ };
82
+ } | {
83
+ id: string;
84
+ kind: 'line';
85
+ points: Vec3[];
86
+ color: string;
87
+ width?: number;
88
+ visible?: boolean;
89
+ };
90
+ export interface LossSurfaceScene {
91
+ id: string;
92
+ camera: string;
93
+ background: string;
94
+ materials: Record<string, {
95
+ color: string;
96
+ shading?: 'unlit' | 'flat' | 'lambert' | 'toon';
97
+ doubleSided?: boolean;
98
+ creases?: boolean;
99
+ outline?: {
100
+ width: number;
101
+ color: string;
102
+ };
103
+ }>;
104
+ objects: LossSceneObject[];
105
+ }
106
+ export interface LossSurface3D {
107
+ scene: LossSurfaceScene;
108
+ /** The ball's position, the path appearing, the camera's orbit */
109
+ tracks: Track[];
110
+ /** ms, until the ball has finished */
111
+ duration: number;
112
+ /** The descent path in the function's own (x, y) */
113
+ path: Vec2[];
114
+ /** f along the path */
115
+ losses: number[];
116
+ }
117
+ export declare function lossSurface3D(options: LossSurfaceOptions): LossSurface3D;
118
+ export {};
@@ -0,0 +1,69 @@
1
+ import type { EasingType, Track } from '../../engine/types';
2
+ import type { MathFigureSpec } from '../figure/figure-spec';
3
+ import { type MathCanvasTarget } from '../targets/math-target';
4
+ /**
5
+ * A maths figure as a surface figures act on, the way a code panel or a
6
+ * whiteboard is one: its places have names, so a beat can point at them as
7
+ * plain data, and its edits are recorded on the figure's own props.
8
+ *
9
+ * const fig = mathSurface(linearMapFigure(), { x: 40, y: 40 })
10
+ * surfaceScript('teacher', { fig }, [
11
+ * { do: 'point', target: { surface: 'fig', anchor: 'tip:basis.i' }, say: 'î lands here',
12
+ * then: { surface: 'fig', edit: 'set', anchor: 'value:M', value: [2, 1, 0, 1] } },
13
+ * ], { from: 640, ground: 400 })
14
+ *
15
+ * It has the shape of the characters module's Surface without importing it,
16
+ * so the maths module stays independent of characters. Parts of a figure do
17
+ * not come loose: `piece`, `follow`, `fling` and `move` say so.
18
+ */
19
+ export interface MathSurfaceBox {
20
+ x: number;
21
+ y: number;
22
+ left: number;
23
+ right: number;
24
+ top: number;
25
+ bottom: number;
26
+ width: number;
27
+ height: number;
28
+ }
29
+ export interface MathSurfaceEdit {
30
+ /** When, ms */
31
+ at: number;
32
+ duration?: number;
33
+ easing?: EasingType;
34
+ /** `set`: the new value (a number, [x, y] or [a, b, c, d]); `step`: the equation step */
35
+ value?: number | number[];
36
+ to?: number;
37
+ }
38
+ export interface MathSurface {
39
+ readonly kind: 'math';
40
+ readonly target: MathCanvasTarget;
41
+ readonly box: MathSurfaceBox;
42
+ readonly about: {
43
+ kind: string;
44
+ create: string;
45
+ anchors: Record<string, string>;
46
+ edits: Record<string, string>;
47
+ };
48
+ /** The box round a named place, scene px, as the figure is at `time` (default after every edit) */
49
+ anchor(name: string, time?: number): MathSurfaceBox;
50
+ /** Change the figure at a time (see `about.edits`) */
51
+ edit(name: string, anchor: string | string[], options: MathSurfaceEdit): MathSurface;
52
+ piece(anchor: string): never;
53
+ follow(): never;
54
+ fling(): never;
55
+ move(): never;
56
+ /** Figures standing on a maths figure are not carried: their tracks come back as they are */
57
+ ride(tracks: Track[], target: string, options: {
58
+ ground: number;
59
+ every?: number;
60
+ }): Track[];
61
+ /** The recorded edits as tracks on `target` (the figure's key in the scene) */
62
+ tracks(target: string): Track[];
63
+ }
64
+ export declare const MATH_SURFACE: MathSurface['about'];
65
+ /** A maths figure placed at `x`, `y` (its top-left corner, scene px) as a surface. */
66
+ export declare function mathSurface(figure: MathFigureSpec, place?: {
67
+ x?: number;
68
+ y?: number;
69
+ }): MathSurface;
package/llms-full.txt CHANGED
@@ -591,7 +591,7 @@ with a GSAP-style call (durations are in seconds here):
591
591
  ```html
592
592
  <div class="box" style="width:60px;height:60px;background:#4a9eff"></div>
593
593
 
594
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly.iife.js"></script>
594
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly.iife.js"></script>
595
595
  <script>
596
596
  tinyfly.to('.box', { x: 200, duration: 1 })
597
597
  </script>
@@ -799,7 +799,7 @@ Without a build step, the all-in-one bundle exposes the same functions on a
799
799
  global — `tinyfly.to()`, `tinyfly.timeline()` and so on:
800
800
 
801
801
  ```html
802
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly.iife.js"></script>
802
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly.iife.js"></script>
803
803
  <script>
804
804
  tinyfly.to('.box', { x: 200, duration: 1 })
805
805
  </script>
@@ -2714,7 +2714,7 @@ For simple website embedding without a build system.
2714
2714
  </html>
2715
2715
  ```
2716
2716
 
2717
- 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.119.1/cdn/tinyfly-player.iife.js`.
2717
+ 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.121.0/cdn/tinyfly-player.iife.js`.
2718
2718
 
2719
2719
  ---
2720
2720
 
@@ -7068,7 +7068,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
7068
7068
  **Steps to embed:**
7069
7069
  1. Build the player: `npm run build:player`
7070
7070
  2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
7071
- `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly-player.iife.js`
7071
+ `https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly-player.iife.js`
7072
7072
  instead; see [Deployment](DEPLOYMENT.md))
7073
7073
  3. Copy the generated code into your HTML
7074
7074
  4. Adjust the script `src` path if needed
@@ -8499,7 +8499,10 @@ lesson page (`<figure data-tinyfly-math>`), an explorable and a video
8499
8499
  `graph` (nodes with `at`, or `tree: { root }`; `search` stepped by `step`), `venn` (`highlight: "(A | B)'"`),
8500
8500
  `clock` (`modulus`, `value`). AI/ML: `network` (`flow`), `descent` (`steps`, exact gradient),
8501
8501
  `contours`, `heatmap` (`softmax: true` for attention), `classifier` (`epochs`), `kmeans`
8502
- (`iteration`); all seeded. See `docs/math.md`.
8502
+ (`iteration`); all seeded. For a presenter, `mathSurface(figure, { x, y })` gives the
8503
+ figure anchors (`tip:basis.i`, `item:ID`, `term:ID:TEXT`, `node:GRAPH:NODE`) and edits
8504
+ (`set` with `value`, `step` with `to`, `drawOn`) for `surfaceScript` beats. A 3D loss
8505
+ surface: `lossSurface3D({ expr, start, rate })` returns scene-3d JSON and tracks. See `docs/math.md`.
8503
8506
 
8504
8507
  ## Your own behaviours
8505
8508
 
@@ -8686,7 +8689,7 @@ path for all of that:
8686
8689
  </figure>
8687
8690
 
8688
8691
  <!-- once, anywhere on the page (a site-wide footer is fine) -->
8689
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
8692
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
8690
8693
  ```
8691
8694
 
8692
8695
  Every `[data-tinyfly-embed]` mounts when the page is ready, with no per-post
@@ -9156,6 +9159,26 @@ every time:
9156
9159
  pre-mixed with the background, so neighbours never leave seams. Contours are
9157
9160
  traced by marching squares and joined into whole curves.
9158
9161
 
9162
+ #### A loss surface in 3D
9163
+
9164
+ `lossSurface3D({ expr, start, rate, momentum?, steps?, region?, height?, orbit? })`
9165
+ builds f(x, y) as a 3D scene for `@algorisys/tinyfly/scene-3d`. You get a mesh
9166
+ coloured by height, a ball rolling down the exact-gradient path, the path
9167
+ appearing behind it, and a slow camera orbit. It returns plain data:
9168
+ `{ scene, tracks, duration, path, losses }`. The maths module does not import
9169
+ scene-3d.
9170
+
9171
+ ```js
9172
+ import { lossSurface3D } from '@algorisys/tinyfly/math'
9173
+ import { loadScene3D, drawScene3D } from '@algorisys/tinyfly/scene-3d'
9174
+ import { deserializeTimeline } from '@algorisys/tinyfly'
9175
+
9176
+ 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 })
9177
+ const scene = loadScene3D(loss.scene)
9178
+ const timeline = deserializeTimeline({ id: 'loss', config: { duration: loss.duration }, tracks: loss.tracks })
9179
+ // each frame: drawScene3D(ctx, scene, timeline.getStateAtTime(t).values, { width, height })
9180
+ ```
9181
+
9159
9182
  The pieces are also available on their own: `seededNetwork`, `forward`,
9160
9183
  `descentPath`, `trainLogistic`, `kmeansHistory`, `contourLines`, `colorAt`.
9161
9184
 
@@ -9252,7 +9275,7 @@ lesson's step options (`duration`, `easing`, `delay`).
9252
9275
  <figcaption>The determinant is the area of the unit square after the map.</figcaption>
9253
9276
  </figure>
9254
9277
 
9255
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9278
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly-math.iife.js" data-tinyfly-auto></script>
9256
9279
  ```
9257
9280
 
9258
9281
  The figure draws itself into an SVG and redraws from the timeline whenever the
@@ -9310,6 +9333,50 @@ figure's smaller side, so a figure reads the same as a 600 px card and as a
9310
9333
  1080×1920 short. `mathTarget()` is a canvas custom target: register it on any
9311
9334
  `CanvasAdapter` too, and `describeTarget` / `checkTracks` know its props.
9312
9335
 
9336
+ ## Presenting with characters
9337
+
9338
+ `mathSurface(figure, { x, y })` makes a figure a **surface**, the way a code
9339
+ panel, a whiteboard or a chart is one. Its places have names, so a character's
9340
+ beats can aim at them as plain data. Its edits change the figure when a beat
9341
+ says so, recorded on the figure's own props:
9342
+
9343
+ ```js
9344
+ import { linearMapFigure, mathSurface } from '@algorisys/tinyfly/math'
9345
+ import { surfaceScript } from '@algorisys/tinyfly/characters'
9346
+
9347
+ const fig = mathSurface(linearMapFigure({ width: 400, height: 400 }), { x: 20, y: 20 })
9348
+ const on = (anchor) => ({ surface: 'fig', anchor })
9349
+ const result = surfaceScript('teacher', { fig }, [
9350
+ { do: 'walk', to: 560 },
9351
+ { do: 'point', target: on('tip:basis.j'), say: 'Now slide it over…',
9352
+ then: { surface: 'fig', edit: 'set', anchor: 'value:M', value: [1, 1, 0, 1] } },
9353
+ { do: 'point', target: on('item:square'), say: 'A shear: the area stays 1.' },
9354
+ ], { from: 740, ground: 420, height: 190 })
9355
+ // result.tracks: the figure's and the teacher's tracks; draw fig.target with its props
9356
+ ```
9357
+
9358
+ | Anchor | Names |
9359
+ |---|---|
9360
+ | `box` | the whole figure |
9361
+ | `item:ID` | everything an item draws |
9362
+ | `tip:ID` | the tip of a vector (`tip:basis.i`, `tip:basis.j` for î and ĵ) |
9363
+ | `point:ID` | a point, including one riding a curve |
9364
+ | `node:GRAPH:NODE` | a node of a graph |
9365
+ | `term:ID:TEXT` | glyphs of an equation or label by their text (`term:eq:2x`; `term:eq#2:x` for the second) |
9366
+ | `value:NAME` | a value, for `set` (its box is the whole figure) |
9367
+
9368
+ | Edit | Does |
9369
+ |---|---|
9370
+ | `drawOn`, `erase` | draws an item on, or off (`item:ID`) |
9371
+ | `show`, `hide` | fades an item in or out |
9372
+ | `step` | moves an equation to step `to`, terms gliding |
9373
+ | `set` | tweens a value to `value`: a number, `[x, y]` or `[a, b, c, d]` |
9374
+
9375
+ Anchors are worked out from the figure as it is at that moment, so after a
9376
+ `set` warps the plane, `tip:basis.i` is where î has gone. Parts of a figure do
9377
+ not come loose: `piece`, `fling`, `follow` and `move` explain that edits are
9378
+ the way to change it.
9379
+
9313
9380
  ## Equations
9314
9381
 
9315
9382
  Equations are typeset by a built-in TeX subset, with no KaTeX or MathJax:
@@ -9379,16 +9446,17 @@ identity unless `matrix` is given.
9379
9446
  **Derivative**, **Riemann Sums**, **Taylor Series**, **Galton Board**, **Central Limit
9380
9447
  Theorem**, **Monte Carlo π**, **Bayes: a Positive Test**, **Graph Search**, **Recursion
9381
9448
  Tree**, **Set Operations**, **Clock Arithmetic**, **Neural Network**, **Gradient Descent**,
9382
- **Decision Boundary**, **K-Means** and **Attention Weights**.
9449
+ **Decision Boundary**, **K-Means**, **Attention Weights**, **Maths Presenter** and
9450
+ **Loss Surface in 3D**.
9383
9451
  - Videos: `linear-map-short.mjs`, `riemann-short.mjs`, `galton-short.mjs`,
9384
9452
  `graph-search-short.mjs` and `gradient-descent-short.mjs` (9:16); `eigen-explainer.mjs`,
9385
9453
  `taylor-explainer.mjs`, `clt-explainer.mjs`, `de-morgan-explainer.mjs` and
9386
- `neural-network-explainer.mjs` (16:9), in `examples/headless-video/`.
9454
+ `neural-network-explainer.mjs` (16:9); `loss-surface-3d.mjs` (16:9, with scene-3d), in
9455
+ `examples/headless-video/`.
9387
9456
 
9388
9457
  ## Next
9389
9458
 
9390
- Characters can already stand beside a figure in a video; letting them point at
9391
- named parts of it (a vector's tip, an equation term) is planned. See `todo.md`.
9459
+ See `todo.md` for what is planned next.
9392
9460
  See `todo.md` for their status.
9393
9461
 
9394
9462
  ---
@@ -10341,8 +10409,8 @@ On a page with no build step, load the maps add-on after the browser bundle; it
10341
10409
  adds to the same `tinyfly` global:
10342
10410
 
10343
10411
  ```html
10344
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly.iife.js"></script>
10345
- <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.119.1/cdn/tinyfly-maps.iife.js"></script>
10412
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly.iife.js"></script>
10413
+ <script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.121.0/cdn/tinyfly-maps.iife.js"></script>
10346
10414
  ```
10347
10415
 
10348
10416
  It is a separate script because the offline world map it carries adds about
@@ -15571,7 +15639,7 @@ magnet.addEventListener('pointerleave', () => {
15571
15639
 
15572
15640
  <!-- capabilities: generated from the library -->
15573
15641
 
15574
- # tinyfly capabilities (v0.119.1)
15642
+ # tinyfly capabilities (v0.121.0)
15575
15643
 
15576
15644
  Generated from the library itself: every name below is accepted, and names not listed are rejected (beat scripts, code panels and `checkTracks` say which name was probably meant).
15577
15645
 
@@ -16053,6 +16121,8 @@ A figure is JSON: a plane and items. Tracks on its target animate values by name
16053
16121
  - `mathTarget(spec, { x, y })`: a canvas target for videos and canvas pages; tracks animate its values and item props
16054
16122
  - `mathSteps(lesson, target, spec, { hidden })`: lesson steps: toValue, applyMatrix, drawOn, fadeIn, fadeOut, showStep (equations)
16055
16123
  - `mountMath(element) / mountAllMath()`: lesson-page embeds: <figure data-tinyfly-math> with data-tinyfly-figure and data-tinyfly-timeline JSON scripts, stepped like any embed
16124
+ - `lossSurface3D({ expr, start, rate, momentum?, steps?, orbit? })`: a loss surface as scene-3d JSON with a ball rolling down the descent path: { scene, tracks, duration, path, losses }
16125
+ - `mathSurface(figure, { x, y })`: a figure as a surface for surfaceScript: anchors box, item:ID, tip:ID, point:ID, node:GRAPH:NODE, term:ID:TEXT, value:NAME; edits drawOn, erase, show, hide, step, set
16056
16126
  - `mathExplorable(element, spec, { sliders, drag })`: reader-driven figures: sliders on number values, drag vector tips or matrix columns
16057
16127
  - `mathFigureToSvg(spec, props)`: a standalone SVG of a figure at some values
16058
16128
  - `linearMapFigure, determinantFigure, eigenFigure, vectorSumFigure, spanFigure`: ready linear algebra figures; the matrix is the value M
package/llms.txt CHANGED
@@ -13,49 +13,49 @@ Key facts:
13
13
  - For language models: read the capability catalog first (`npx @algorisys/tinyfly capabilities`, or the end of llms-full.txt). It is generated from the library, so every name in it (poses, expressions, gags, gaits, beat actions, canvas properties, code-panel edits) is accepted, and names not in it are rejected with the name probably meant. Check beat scripts with `npx @algorisys/tinyfly check beats.json`, tracks with `checkTracks(tracks, targets)`, and ask any target what it animates with `describeTarget(target)`. The npm package ships `docs/`, `llms.txt`, `llms-full.txt` and an agent skill (`skills/tinyfly/SKILL.md`); `docs/llm-guide.md` describes the workflow.
14
14
  - Source: https://github.com/algorisys-oss/tinyfly. License: MIT.
15
15
 
16
- All documentation and the interactive course in a single file: [llms-full.txt](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/llms-full.txt)
16
+ All documentation and the interactive course in a single file: [llms-full.txt](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/llms-full.txt)
17
17
 
18
18
  ## Start here
19
19
 
20
- - [Getting Started](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/getting-started.md): What tinyfly is, making a first animation in the editor, and using it from code, a script tag or the CDN.
21
- - [GSAP Compatibility](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/gsap-compat.md): The GSAP-style API (`live.to`, `tf.timeline`): supported vars, motion paths, morphSVG, text, inertia, Draggable, Flip, and where it differs from GSAP.
22
- - [Code Examples](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/examples.md): Recipes with the engine API: fades, loops, colour and bezier easing, loading JSON, canvas and SVG rendering, multi-scene sequences, motion paths and script-tag embeds; a festive garba/dandiya scene with partner contacts, circle travel and spins, also rendered to video.
23
- - [Building Animations with an LLM](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/llm-guide.md): For assistants and the people setting them up: read the capability catalog (`tinyfly capabilities`), ask targets what they animate (`describeTarget`), check beats and tracks with did-you-mean errors (`tinyfly check`, `checkTracks`), render stills to look at, and the agent skill shipped in the package.
20
+ - [Getting Started](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/getting-started.md): What tinyfly is, making a first animation in the editor, and using it from code, a script tag or the CDN.
21
+ - [GSAP Compatibility](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/gsap-compat.md): The GSAP-style API (`live.to`, `tf.timeline`): supported vars, motion paths, morphSVG, text, inertia, Draggable, Flip, and where it differs from GSAP.
22
+ - [Code Examples](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/examples.md): Recipes with the engine API: fades, loops, colour and bezier easing, loading JSON, canvas and SVG rendering, multi-scene sequences, motion paths and script-tag embeds; a festive garba/dandiya scene with partner contacts, circle travel and spins, also rendered to video.
23
+ - [Building Animations with an LLM](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/llm-guide.md): For assistants and the people setting them up: read the capability catalog (`tinyfly capabilities`), ask targets what they animate (`describeTarget`), check beats and tracks with did-you-mean errors (`tinyfly check`, `checkTracks`), render stills to look at, and the agent skill shipped in the package.
24
24
 
25
25
  ## Reference
26
26
 
27
- - [API Reference](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/api-reference.md): Every public engine, player and adapter API: Timeline, tracks, keyframes, easing, drivers, serialization and exports.
28
- - [File Format](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/file-format.md): The JSON animation format: timelines, every track kind, keyframes, easing and the project file — for generating or consuming animations.
27
+ - [API Reference](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/api-reference.md): Every public engine, player and adapter API: Timeline, tracks, keyframes, easing, drivers, serialization and exports.
28
+ - [File Format](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/file-format.md): The JSON animation format: timelines, every track kind, keyframes, easing and the project file — for generating or consuming animations.
29
29
 
30
30
  ## Editor features
31
31
 
32
- - [Editor Guide](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/editor-guide.md): Every panel and feature of the visual editor, from elements and keyframes to text and inertia tracks, preview and export.
33
- - [Shape Morphing](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/shape-morph.md): Tweening one path into another, including shapes with different point counts and several subpaths.
34
- - [Pen Tool](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/pen-tool.md): Drawing custom paths point by point with straight segments and bezier curves.
35
- - [Polygons & Stars](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/polygon-star.md): Parametric polygon and star shapes that stay editable while animating like any path.
36
- - [Grid & Snapping](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/grid-and-snapping.md): The grid overlay, snapping to grid, elements and artboard centre, and alignment guides.
37
- - [Onion Skinning](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/onion-skinning.md): Ghost frames before and after the playhead for judging arcs and easing.
38
- - [Sprite-sheet Export](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/sprite-sheet-export.md): Exporting frames as a PNG grid plus JSON metadata for game engines and canvas players.
32
+ - [Editor Guide](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/editor-guide.md): Every panel and feature of the visual editor, from elements and keyframes to text and inertia tracks, preview and export.
33
+ - [Shape Morphing](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/shape-morph.md): Tweening one path into another, including shapes with different point counts and several subpaths.
34
+ - [Pen Tool](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/pen-tool.md): Drawing custom paths point by point with straight segments and bezier curves.
35
+ - [Polygons & Stars](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/polygon-star.md): Parametric polygon and star shapes that stay editable while animating like any path.
36
+ - [Grid & Snapping](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/grid-and-snapping.md): The grid overlay, snapping to grid, elements and artboard centre, and alignment guides.
37
+ - [Onion Skinning](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/onion-skinning.md): Ghost frames before and after the playhead for judging arcs and easing.
38
+ - [Sprite-sheet Export](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/sprite-sheet-export.md): Exporting frames as a PNG grid plus JSON metadata for game engines and canvas players.
39
39
 
40
40
  ## Guides
41
41
 
42
- - [Cricket Stories](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/cricket.md): Reusable sports APIs, organic adult/child players, sixteen cricket plays, Test/ODI/T20 facts, contact-keyed JSON, captions, headless video and a 360° ground camera.
43
- - [Scroll Animation](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/scroll-animation.md): Scroll-driven and play-when-visible animation with ScrollDriver and VisibilityDriver.
44
- - [Props: Everyday Objects with Behaviours](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/props.md): Cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane: 3D rigs drawn with the characters’ pens (clean, pencil) that turn toward the camera, with beats acted through the 12 principles (anticipation, squash and stretch, follow-through, an exaggeration dial), wheels that roll exactly, effects, and figures riding them.
45
- - [Teaching Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/teaching.md): Step-through explanatory figures: markers, captions in several languages, the teaching player, step controls, one-script declarative embeds, tinyfly/teach diagram primitives, and validate / render for build pipelines.
46
- - [Maths Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/math.md): tinyfly/math: figures as JSON (grids a matrix warps, vectors, function plots, polygons, eigenlines, TeX labels and equations that rewrite step by step), animated by plain tracks, played in lesson-page embeds, explorables and videos from one layout; a built-in TeX subset and ready linear algebra figures.
47
- - [Rendering Video from Code](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/video-rendering.md): Rendering a scene to MP4 without a browser: `tinyfly video`, custom canvas targets drawn by code, timing from narration and recorded voice-over, the stick-figure character, SRT/WebVTT captions, stills, porting Cairo scripts, and a benchmark against pycairo.
48
- - [Animated Maps](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/maps.md): Maps that animate: a camera that flies in to a city, pins that drop in, routes that draw themselves while a marker travels them, on OpenStreetMap tiles or an offline world outline (also in pencil), in the browser and in headless video.
49
- - [Cartoon Hands](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/cartoon-hands.md): A hand you can pose: a palm and five fingers in 3D, posed by numbers (curls, thumb, spread, wrist turn), ready-made shapes from a fist to a pencil grip, left and right, four or five fingers, in clean, pencil and silhouette looks; the animator's hand and character gloves are built on it.
50
- - [Character Appearance](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/character-appearance.md): Hair (34 styles), facial hair (20), glasses, hats and ears for the v2 character as plain data on the head, so they turn with it through all eight views; builds (child, tall, short…), a recurring cast (castMember), expressions with blush, tears and sweat, everyday poses, held items (mug, phone, bags, umbrella, parcel) and two characters’ hands meeting (meetHands: handshake, high five, hand-over).
51
- - [Cartoon Acting](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/acting.md): actTracks(): the same key poses, acted: anticipation, overshoot and settle, overlapping joints, eyes that lead and blink, moving holds and jump squash, in full, snappy or limited styles; gags as data (take, double take, wind-up); a line of action (bend); gaits with personality; lip-sync from text (Latin and Devanagari); beat scripts compiled to acted tracks; your own actions (defineAction), gaits (defineGait) and personas (persona()); acting on code (codePanel lines and words as anchors: leap onto a line, point at it, swipe it away wiped, knocked off or blurred; grab, throw, kick, carry and drop words, push them along their line, write new text in by hand; ride a line as gaps close); camera shots (push in, cut, shake, follow); the cartoon zip; speed lines, dust puffs and impact stars; drawing on twos (a timeline setting); acting, gags, walks and lines in the editor.
52
- - [Dance and Flips](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/dance.md): The stick figure dances disco, hip hop, breaking, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap and popping, and does flips, leaps and splits; native v2 garba (two/three clap) and dandiya add body-local routines, circle formations, world foot plants, paired stick-tip contacts and signed spins; JSON bakes, timing, contact limits and editor menus.
53
- - [3D Scenes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/scene-3d.md): @algorisys/tinyfly/scene-3d: cameras, lights and meshes as JSON, in metres, animated by tracks at <scene>/<object> (cuts with activeCamera), drawn on a 2D canvas with flat, smooth or toon shading, ink outlines and fog, in browsers, Workers and Node (MP4 with tinyfly video); v2 characters in pen or solid looks, scripted native dances, timed signed spins and circle formations with foot contacts.
54
- - [3D Transforms and Rotations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/3d-rotations.md): CSS-style 3D for flat elements in every renderer (rotateX, rotateY, z, perspective, backface visibility; true perspective on Canvas and WebGL, matching CSS within a pixel), one documented transform order, the editor's 3D fields; smooth quaternion rotations with interpolation: "slerp"; the vec3, quat and mat4 helpers; format version 2.
55
- - [Extending tinyfly](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/extending.md): Writing a render adapter, animating any object with live and the ticker, custom and parametric eases, stagger offsets, adding a track kind, and contributing gallery examples.
56
- - [Deployment](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/docs/DEPLOYMENT.md): Building and hosting the editor, and serving the player bundles.
42
+ - [Cricket Stories](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/cricket.md): Reusable sports APIs, organic adult/child players, sixteen cricket plays, Test/ODI/T20 facts, contact-keyed JSON, captions, headless video and a 360° ground camera.
43
+ - [Scroll Animation](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/scroll-animation.md): Scroll-driven and play-when-visible animation with ScrollDriver and VisibilityDriver.
44
+ - [Props: Everyday Objects with Behaviours](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/props.md): Cars, trucks, buses, tractors, carts, train carriages, bikes, motorbikes, trees, houses, a helicopter and a plane: 3D rigs drawn with the characters’ pens (clean, pencil) that turn toward the camera, with beats acted through the 12 principles (anticipation, squash and stretch, follow-through, an exaggeration dial), wheels that roll exactly, effects, and figures riding them.
45
+ - [Teaching Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/teaching.md): Step-through explanatory figures: markers, captions in several languages, the teaching player, step controls, one-script declarative embeds, tinyfly/teach diagram primitives, and validate / render for build pipelines.
46
+ - [Maths Animations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/math.md): tinyfly/math: figures as JSON (grids a matrix warps, vectors, function plots, polygons, eigenlines, TeX labels and equations that rewrite step by step), animated by plain tracks, played in lesson-page embeds, explorables and videos from one layout; a built-in TeX subset and ready linear algebra figures.
47
+ - [Rendering Video from Code](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/video-rendering.md): Rendering a scene to MP4 without a browser: `tinyfly video`, custom canvas targets drawn by code, timing from narration and recorded voice-over, the stick-figure character, SRT/WebVTT captions, stills, porting Cairo scripts, and a benchmark against pycairo.
48
+ - [Animated Maps](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/maps.md): Maps that animate: a camera that flies in to a city, pins that drop in, routes that draw themselves while a marker travels them, on OpenStreetMap tiles or an offline world outline (also in pencil), in the browser and in headless video.
49
+ - [Cartoon Hands](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/cartoon-hands.md): A hand you can pose: a palm and five fingers in 3D, posed by numbers (curls, thumb, spread, wrist turn), ready-made shapes from a fist to a pencil grip, left and right, four or five fingers, in clean, pencil and silhouette looks; the animator's hand and character gloves are built on it.
50
+ - [Character Appearance](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/character-appearance.md): Hair (34 styles), facial hair (20), glasses, hats and ears for the v2 character as plain data on the head, so they turn with it through all eight views; builds (child, tall, short…), a recurring cast (castMember), expressions with blush, tears and sweat, everyday poses, held items (mug, phone, bags, umbrella, parcel) and two characters’ hands meeting (meetHands: handshake, high five, hand-over).
51
+ - [Cartoon Acting](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/acting.md): actTracks(): the same key poses, acted: anticipation, overshoot and settle, overlapping joints, eyes that lead and blink, moving holds and jump squash, in full, snappy or limited styles; gags as data (take, double take, wind-up); a line of action (bend); gaits with personality; lip-sync from text (Latin and Devanagari); beat scripts compiled to acted tracks; your own actions (defineAction), gaits (defineGait) and personas (persona()); acting on code (codePanel lines and words as anchors: leap onto a line, point at it, swipe it away wiped, knocked off or blurred; grab, throw, kick, carry and drop words, push them along their line, write new text in by hand; ride a line as gaps close); camera shots (push in, cut, shake, follow); the cartoon zip; speed lines, dust puffs and impact stars; drawing on twos (a timeline setting); acting, gags, walks and lines in the editor.
52
+ - [Dance and Flips](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/dance.md): The stick figure dances disco, hip hop, breaking, jazz, K-pop, Bollywood, Bhangra, Bharatanatyam (with mudras), the Charleston, tap and popping, and does flips, leaps and splits; native v2 garba (two/three clap) and dandiya add body-local routines, circle formations, world foot plants, paired stick-tip contacts and signed spins; JSON bakes, timing, contact limits and editor menus.
53
+ - [3D Scenes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/scene-3d.md): @algorisys/tinyfly/scene-3d: cameras, lights and meshes as JSON, in metres, animated by tracks at <scene>/<object> (cuts with activeCamera), drawn on a 2D canvas with flat, smooth or toon shading, ink outlines and fog, in browsers, Workers and Node (MP4 with tinyfly video); v2 characters in pen or solid looks, scripted native dances, timed signed spins and circle formations with foot contacts.
54
+ - [3D Transforms and Rotations](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/3d-rotations.md): CSS-style 3D for flat elements in every renderer (rotateX, rotateY, z, perspective, backface visibility; true perspective on Canvas and WebGL, matching CSS within a pixel), one documented transform order, the editor's 3D fields; smooth quaternion rotations with interpolation: "slerp"; the vec3, quat and mat4 helpers; format version 2.
55
+ - [Extending tinyfly](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/extending.md): Writing a render adapter, animating any object with live and the ticker, custom and parametric eases, stagger offsets, adding a track kind, and contributing gallery examples.
56
+ - [Deployment](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/docs/DEPLOYMENT.md): Building and hosting the editor, and serving the player bundles.
57
57
 
58
58
  ## Optional
59
59
 
60
- - [README](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/README.md): Feature overview, project layout and development setup.
61
- - [Release notes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.119.1/release-notes/README.md): What changed in each version.
60
+ - [README](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/README.md): Feature overview, project layout and development setup.
61
+ - [Release notes](https://raw.githubusercontent.com/algorisys-oss/tinyfly/v0.121.0/release-notes/README.md): What changed in each version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algorisys/tinyfly",
3
- "version": "0.119.1",
3
+ "version": "0.121.0",
4
4
  "type": "module",
5
5
  "description": "Lightweight, API-driven animation engine and editor. The engine is framework-agnostic and runs in browsers, Web Workers, and Node.",
6
6
  "license": "MIT",
@@ -178,7 +178,10 @@ names.
178
178
  `galton`, `scatter`, `bayes`; distributions are data and samples are seeded.
179
179
  Discrete: `graph` (searches stepped by `step`), `venn` (set expressions),
180
180
  `clock`. AI/ML: `network`, `heatmap`, `contours`, `descent`, `classifier`,
181
- `kmeans`, each stepped by one value. See `docs/math.md`.
181
+ `kmeans`, each stepped by one value. A presenter: `mathSurface(figure, { x, y })`
182
+ for `surfaceScript` (anchors `tip:ID`, `item:ID`, `term:ID:TEXT`; edits `set`,
183
+ `step`, `drawOn`). 3D loss surface: `lossSurface3D()` gives scene-3d JSON and
184
+ tracks. See `docs/math.md`.
182
185
 
183
186
  ## 3. Check
184
187