@algorisys/tinyfly 0.93.0 → 0.94.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 +5 -5
- package/docs/acting.md +63 -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 +8 -0
- package/docs/maps.md +2 -2
- package/docs/teaching.md +1 -1
- package/lib/addons/characters.js +2541 -2405
- package/lib/browser/tinyfly.iife.js +9 -9
- package/lib/browser/tinyfly.js +3956 -3820
- package/lib/browser/tinyfly.umd.js +9 -9
- package/lib/types/characters/acting/beat-check.d.ts +12 -5
- package/lib/types/characters/acting/custom.d.ts +66 -0
- package/lib/types/characters/acting/gags.d.ts +10 -0
- package/lib/types/characters/acting/hand-path.d.ts +3 -0
- package/lib/types/characters/acting/index.d.ts +2 -0
- package/lib/types/characters/acting/persona.d.ts +93 -0
- package/lib/types/characters/acting/script.d.ts +10 -5
- package/lib/types/characters/capabilities.d.ts +13 -2
- package/lib/types/characters/figure-actions.d.ts +4 -3
- package/lib/types/characters/stick-figure.d.ts +7 -2
- package/llms-full.txt +92 -9
- package/llms.txt +27 -27
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +3 -0
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
|
|
|
61
61
|
- **The drawing hand** - `drawnPathTarget()` draws a sketched stroke on from a `draw` track while a cartoon hand holds the pencil at its end in a writing grip; the same hand can hold the eraser. `handAt()` gives one hand for a whole scene: it follows each stroke, lifts and glides to the next, and enters and leaves the page
|
|
62
62
|
- **Erasing** - An eraser rubs out part of a target (`erasable()`, animated by an `erase` track) or of anything drawn in code (`withErased()`); clip-based, so it works in the browser and headless alike
|
|
63
63
|
- **Cartoon hands** - A hand rig in 3D, drawn flat: thumb and fingers posed by numbers (`index.curl`, `thumb.across`, `spread`, `turn`), ready-made shapes (fist, point, thumbs-up, peace, OK, pinch, wave, pencil grip…), left and right, four or five fingers, in every look; the animator's hand and (opt-in) character gloves are built on it. See [docs/cartoon-hands.md](docs/cartoon-hands.md)
|
|
64
|
-
- **Cartoon acting** - `actTracks()` turns the same key poses into acted motion: wind-ups, overshoot that settles or wobbles, joints that overlap (hips lead, wrists drag), eyes that dart ahead and blink on head turns, moving holds and jump squash, in `full`, `snappy` or `limited` styles. Gags come as data (`gag('take')`, double take, wind-up, tremble). A line of action (`bend`) curves the spine, and gaits have personality (bouncy, double bounce, sneak, strut, tired, run). Lip-sync works from text, Latin or Devanagari. `scriptTracks()` compiles a story written as beats (`{ do: 'walk', to: 640 }`, `{ do: 'take' }`, `{ do: 'say', say: '…' }`) into all of it. `cameraTracks()` films it with push-ins, cuts, shakes and follows. The cartoon zip (`{ do: 'zip' }`) has the legs wheel in place before it is gone. Figures can act on code, Animator vs Animation style: `codePanel()` lays a listing out so every line and word is a place in the scene, and beats leap onto lines, point at them and swipe them away (`{ do: 'swipe', target: code.line(7) }`), with the line wiped, knocked off the panel or blurred out of focus on the frames the hand crosses it. Words come loose too: a figure grabs `var` and throws it, kicks another out of a loop, carries a stray `;` to where it belongs, pushes a word along its line (the text closing up behind it), and writes `mut` into a line by hand. A figure standing on a line rides it when a gap above closes (`code.ride()`). In the editor, a Character's **Acting** section acts its keyed poses in a style and adds gags, walks in a gait and lip-synced lines, with drawing on twos as a timeline setting. Characters come in builds (slim, kid, broad, curvy, stocky), and the v2 human has its own line of action, gaits and gags, posed in 3D so they read from every view. It also adds speed lines from earlier frames (`drawStickSmear()`), dust puffs, impact stars, and drawing on twos for video (`drawingRate`). Output is plain keyframes. See [docs/acting.md](docs/acting.md)
|
|
64
|
+
- **Cartoon acting** - `actTracks()` turns the same key poses into acted motion: wind-ups, overshoot that settles or wobbles, joints that overlap (hips lead, wrists drag), eyes that dart ahead and blink on head turns, moving holds and jump squash, in `full`, `snappy` or `limited` styles. Gags come as data (`gag('take')`, double take, wind-up, tremble). A line of action (`bend`) curves the spine, and gaits have personality (bouncy, double bounce, sneak, strut, tired, run). Lip-sync works from text, Latin or Devanagari. `scriptTracks()` compiles a story written as beats (`{ do: 'walk', to: 640 }`, `{ do: 'take' }`, `{ do: 'say', say: '…' }`) into all of it. `cameraTracks()` films it with push-ins, cuts, shakes and follows. The cartoon zip (`{ do: 'zip' }`) has the legs wheel in place before it is gone. Figures can act on code, Animator vs Animation style: `codePanel()` lays a listing out so every line and word is a place in the scene, and beats leap onto lines, point at them and swipe them away (`{ do: 'swipe', target: code.line(7) }`), with the line wiped, knocked off the panel or blurred out of focus on the frames the hand crosses it. Words come loose too: a figure grabs `var` and throws it, kicks another out of a loop, carries a stray `;` to where it belongs, pushes a word along its line (the text closing up behind it), and writes `mut` into a line by hand. A figure standing on a line rides it when a gap above closes (`code.ride()`). Your own behaviours are plain values: `defineAction()` (from beats or timed pose steps), `defineGait()`, and `persona()` for a recurring character's look, acting style, gait, usual face and stance. In the editor, a Character's **Acting** section acts its keyed poses in a style and adds gags, walks in a gait and lip-synced lines, with drawing on twos as a timeline setting. Characters come in builds (slim, kid, broad, curvy, stocky), and the v2 human has its own line of action, gaits and gags, posed in 3D so they read from every view. It also adds speed lines from earlier frames (`drawStickSmear()`), dust puffs, impact stars, and drawing on twos for video (`drawingRate`). Output is plain keyframes. See [docs/acting.md](docs/acting.md)
|
|
65
65
|
- **Pencil story example** - `examples/pencil-story-hindi/index.html` tells a short Hindi story (प्यासा राहगीर, the thirsty traveller) Pencilmation-style with the browser bundle alone: the hand draws the scene and writes the narration, then rubs out the pot
|
|
66
66
|
- **Captions** - `toSRT()` / `toWebVTT()` from narration cues or from a timeline's markers
|
|
67
67
|
|
|
@@ -237,7 +237,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
|
237
237
|
itself.
|
|
238
238
|
|
|
239
239
|
```html
|
|
240
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
240
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.0/cdn/tinyfly.iife.js"></script>
|
|
241
241
|
<script>
|
|
242
242
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
243
243
|
|
|
@@ -273,7 +273,7 @@ A teaching figure needs no code at all:
|
|
|
273
273
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
274
274
|
<figcaption>Appending to a full slice</figcaption>
|
|
275
275
|
</figure>
|
|
276
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
276
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.0/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
277
277
|
```
|
|
278
278
|
|
|
279
279
|
See [Teaching Animations](docs/teaching.md).
|
|
@@ -372,7 +372,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
|
|
|
372
372
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
373
373
|
</div>
|
|
374
374
|
|
|
375
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
375
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.0/cdn/tinyfly-player.iife.js"></script>
|
|
376
376
|
<script>
|
|
377
377
|
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
378
378
|
</script>
|
|
@@ -481,7 +481,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
481
481
|
<svg viewBox="0 0 720 200">…</svg>
|
|
482
482
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
483
483
|
</figure>
|
|
484
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
484
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.0/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
485
485
|
```
|
|
486
486
|
|
|
487
487
|
### Audio / Video Sync
|
package/docs/acting.md
CHANGED
|
@@ -253,6 +253,69 @@ leaves, with a time, a scene x and y and a length, ready for `drawDustPuff`.
|
|
|
253
253
|
Any beat can also take `onto` (a scene y): the figure is carried to that floor
|
|
254
254
|
over the beat, as when the line it stands on moves up.
|
|
255
255
|
|
|
256
|
+
## Your own actions, gaits and personas
|
|
257
|
+
|
|
258
|
+
Behaviours of your own are plain values passed where they are used; nothing
|
|
259
|
+
is registered globally.
|
|
260
|
+
|
|
261
|
+
**Actions** come in two kinds. Built from other beats (a macro):
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
const nervousPoint = defineAction({
|
|
265
|
+
summary: 'Trembles, then points at the target.',
|
|
266
|
+
needs: ['target'],
|
|
267
|
+
beats: (beat) => [{ do: 'tremble' }, { do: 'point', target: beat.target }],
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Or written as timed pose steps from the pose it starts on, like a gag:
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
const facepalm = defineAction({
|
|
275
|
+
summary: 'Drops its face into its hand.',
|
|
276
|
+
steps: (from) => [
|
|
277
|
+
{ after: 220, pose: { rightShoulder: 150, rightElbow: 155, headTilt: from.headTilt - 10 }, easing: 'ease-out' },
|
|
278
|
+
{ after: 900, pose: { headTilt: from.headTilt - 16 } },
|
|
279
|
+
],
|
|
280
|
+
})
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Gaits** are data, like the built-in ones: `defineGait({ swing, knee, arm,
|
|
284
|
+
elbow, lean, cycle?, sway?, … })` (degrees; `cycle` is ms per two steps).
|
|
285
|
+
|
|
286
|
+
Pass them to `scriptTracks(id, beats, { actions, gaits })`, `checkBeats(beats,
|
|
287
|
+
{ actions, gaits })` and the figure that draws them
|
|
288
|
+
(`stickFigureTarget({ …, cast: { actions, gaits } })`, which lists them in
|
|
289
|
+
`describeTarget`). A custom name may not reuse a built-in one. A beats action's
|
|
290
|
+
first beat keeps the original's `at`, and its `mood` and `say` go to the first
|
|
291
|
+
beat that has none; the expanded beats are checked too.
|
|
292
|
+
|
|
293
|
+
**Personas** bundle a character: its look, acting style, gait, usual face,
|
|
294
|
+
stance and own actions.
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
const junior = persona({
|
|
298
|
+
name: 'Junior', summary: 'A nervous junior developer',
|
|
299
|
+
look: { color: '#89b4fa', rubber: 0.7 }, height: 92,
|
|
300
|
+
acting: 'full', gait: 'sneak', mood: 'worried', stance: 'rest',
|
|
301
|
+
actions: { facepalm },
|
|
302
|
+
})
|
|
303
|
+
const hero = junior.figure({ x: 600, y: 300, facing: -1 })
|
|
304
|
+
const script = junior.script('hero', [
|
|
305
|
+
{ do: 'go', to: 300 }, // walks in its own gait
|
|
306
|
+
{ do: 'facepalm', say: 'Oh no.' },
|
|
307
|
+
{ do: 'stand' }, // back to its stance and usual face
|
|
308
|
+
], { from: 600, ground: 300, facing: -1 })
|
|
309
|
+
junior.check(beats) // its own actions count as known
|
|
310
|
+
junior.describe() // { name, summary, habits, actions, own }
|
|
311
|
+
junior.handPath('hero', script.tracks, { x: 600, y: 300, start, end })
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
`go` is a built-in action: it walks in the persona's gait (in `walk` without
|
|
315
|
+
one). Scripts are deterministic, so two personas can be timed against each
|
|
316
|
+
other by reading one's `beats` before writing the other's (the **Code Review**
|
|
317
|
+
example does).
|
|
318
|
+
|
|
256
319
|
## Acting on code
|
|
257
320
|
|
|
258
321
|
`codePanel()` makes a code listing a scene object. Its layout is plain
|
package/docs/editor-guide.md
CHANGED
|
@@ -1058,7 +1058,7 @@ The dialog shows the generated HTML/JavaScript code with a **Copy Code** button.
|
|
|
1058
1058
|
**Steps to embed:**
|
|
1059
1059
|
1. Build the player: `npm run build:player`
|
|
1060
1060
|
2. Copy `lib/player/tinyfly-player.iife.js` to your project (or load
|
|
1061
|
-
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
1061
|
+
`https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.0/cdn/tinyfly-player.iife.js`
|
|
1062
1062
|
instead; see [Deployment](DEPLOYMENT.md))
|
|
1063
1063
|
3. Copy the generated code into your HTML
|
|
1064
1064
|
4. Adjust the script `src` path if needed
|
package/docs/examples.md
CHANGED
|
@@ -694,7 +694,7 @@ For simple website embedding without a build system.
|
|
|
694
694
|
</html>
|
|
695
695
|
```
|
|
696
696
|
|
|
697
|
-
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.
|
|
697
|
+
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.94.0/cdn/tinyfly-player.iife.js`.
|
|
698
698
|
|
|
699
699
|
---
|
|
700
700
|
|
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.94.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.94.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
|
@@ -26,6 +26,14 @@ It is also the last part of `llms-full.txt`.
|
|
|
26
26
|
From code, the same catalog is `capabilities()` (and `capabilitiesMarkdown()`)
|
|
27
27
|
in `@algorisys/tinyfly/characters`.
|
|
28
28
|
|
|
29
|
+
## Your own behaviours
|
|
30
|
+
|
|
31
|
+
Write new actions with `defineAction()` (from beats, or as timed pose steps),
|
|
32
|
+
new gaits with `defineGait()`, and characters with `persona()`. Pass them where
|
|
33
|
+
they are used; `persona.describe()` and `capabilities(version, cast)` list them,
|
|
34
|
+
and the checks accept them. See "Your own actions, gaits and personas" in
|
|
35
|
+
`docs/acting.md`.
|
|
36
|
+
|
|
29
37
|
## 2. Ask a target what it can do
|
|
30
38
|
|
|
31
39
|
```js
|
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.94.0/cdn/tinyfly.iife.js"></script>
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.94.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.94.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
|