@algorisys/tinyfly 0.92.0 → 0.93.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.
Files changed (61) hide show
  1. package/README.md +7 -6
  2. package/bin/tinyfly.mjs +34 -1
  3. package/docs/2d-animation-roadmap.md +191 -0
  4. package/docs/3d-rotations.md +164 -0
  5. package/docs/3d-support-plan.md +628 -0
  6. package/docs/DEPLOYMENT.md +414 -0
  7. package/docs/acting.md +466 -0
  8. package/docs/api-reference.md +2353 -0
  9. package/docs/camera.md +94 -0
  10. package/docs/cartoon-hands.md +96 -0
  11. package/docs/character-system-m1.md +218 -0
  12. package/docs/character-system-plan.md +384 -0
  13. package/docs/dance.md +315 -0
  14. package/docs/editor-guide.md +1249 -0
  15. package/docs/examples.md +765 -0
  16. package/docs/extending.md +168 -0
  17. package/docs/file-format.md +690 -0
  18. package/docs/getting-started.md +314 -0
  19. package/docs/grid-and-snapping.md +64 -0
  20. package/docs/gsap-compat.md +1241 -0
  21. package/docs/llm-guide.md +123 -0
  22. package/docs/maps.md +116 -0
  23. package/docs/onion-skinning.md +41 -0
  24. package/docs/pen-tool.md +65 -0
  25. package/docs/polygon-star.md +44 -0
  26. package/docs/scene-3d.md +299 -0
  27. package/docs/scroll-animation.md +314 -0
  28. package/docs/shape-morph.md +61 -0
  29. package/docs/sprite-sheet-export.md +54 -0
  30. package/docs/symbols-and-library.md +137 -0
  31. package/docs/teaching.md +348 -0
  32. package/docs/video-rendering.md +728 -0
  33. package/lib/addons/adapters.js +22 -18
  34. package/lib/addons/characters.js +2694 -1809
  35. package/lib/addons/target-properties-BtN9skb-.js +142 -0
  36. package/lib/browser/tinyfly.iife.js +9 -4
  37. package/lib/browser/tinyfly.js +6498 -5483
  38. package/lib/browser/tinyfly.umd.js +9 -4
  39. package/lib/engine/tinyfly-engine.js +286 -258
  40. package/lib/engine/tinyfly-engine.umd.cjs +2 -2
  41. package/lib/types/adapters/canvas/canvas-adapter.d.ts +6 -0
  42. package/lib/types/adapters/canvas/index.d.ts +1 -0
  43. package/lib/types/adapters/canvas/target-properties.d.ts +68 -0
  44. package/lib/types/characters/acting/beat-check.d.ts +95 -0
  45. package/lib/types/characters/acting/hand-path.d.ts +32 -0
  46. package/lib/types/characters/acting/index.d.ts +2 -0
  47. package/lib/types/characters/acting/script.d.ts +66 -7
  48. package/lib/types/characters/capabilities.d.ts +50 -0
  49. package/lib/types/characters/code-panel.d.ts +201 -0
  50. package/lib/types/characters/figure-actions.d.ts +11 -0
  51. package/lib/types/characters/figure-props.d.ts +87 -0
  52. package/lib/types/characters/gaits.d.ts +8 -0
  53. package/lib/types/characters/index.d.ts +3 -0
  54. package/lib/types/characters/stick-figure.d.ts +2 -0
  55. package/lib/types/engine/authoring/did-you-mean.d.ts +14 -0
  56. package/lib/types/engine/authoring/index.d.ts +1 -0
  57. package/llms-full.txt +12548 -0
  58. package/llms.txt +57 -0
  59. package/package.json +6 -2
  60. package/skills/tinyfly/SKILL.md +64 -0
  61. package/lib/addons/camera-C7bZOWMB.js +0 -33
@@ -0,0 +1,142 @@
1
+ import { unknownName as m } from "@algorisys/tinyfly";
2
+ const x = { x: 0, y: 0, scale: 1, rotate: 0, shakeX: 0, shakeY: 0, shakeRotate: 0 };
3
+ function S(s) {
4
+ const i = (o) => {
5
+ const n = s?.get(o);
6
+ return typeof n == "number" ? n : x[o];
7
+ };
8
+ return {
9
+ x: i("x"),
10
+ y: i("y"),
11
+ scale: i("scale"),
12
+ rotate: i("rotate"),
13
+ shakeX: i("shakeX"),
14
+ shakeY: i("shakeY"),
15
+ shakeRotate: i("shakeRotate")
16
+ };
17
+ }
18
+ function Y(s, i, o) {
19
+ const n = o.width / 2, t = o.height / 2, p = 1 + 2 * Math.max(Math.abs(i.shakeX), Math.abs(i.shakeY)) / Math.max(1, Math.min(o.width, o.height));
20
+ s.translate(n + i.x + i.shakeX, t + i.y + i.shakeY), s.rotate((i.rotate + i.shakeRotate) * Math.PI / 180), s.scale(i.scale * p, i.scale * p), s.translate(-n, -t);
21
+ }
22
+ function M(s, i, o) {
23
+ const n = i.width / 2, t = i.height / 2, a = (s.rotate + s.shakeRotate) * Math.PI / 180, p = (o.x - n) * s.scale, d = (o.y - t) * s.scale;
24
+ return {
25
+ x: n + s.x + s.shakeX + p * Math.cos(a) - d * Math.sin(a),
26
+ y: t + s.y + s.shakeY + p * Math.sin(a) + d * Math.cos(a)
27
+ };
28
+ }
29
+ const e = ["rect", "circle", "text", "line", "path", "image", "custom"], g = ["rect", "circle", "line", "path"], y = {
30
+ x: { description: "Moves it right by this much from where it was placed (an offset; the target’s own x is its place)", unit: "px", types: e },
31
+ y: { description: "Moves it down by this much from where it was placed (an offset)", unit: "px", types: e },
32
+ opacity: { description: "How opaque it is", unit: "0..1", min: 0, max: 1, types: e },
33
+ rotate: { description: "Turns it clockwise about its origin", unit: "degrees", types: e },
34
+ rotateX: { description: "Tips it about the horizontal axis (3D; shows with perspective)", unit: "degrees", types: e },
35
+ rotateY: { description: "Turns it about the vertical axis (3D; shows with perspective)", unit: "degrees", types: e },
36
+ z: { description: "Depth toward the viewer (shows with perspective)", unit: "px", types: e },
37
+ perspective: { description: "Distance from the viewer: nearer parts grow, further ones shrink", unit: "px", min: 1, types: e },
38
+ scale: { description: "Size, both ways", unit: "factor", types: e },
39
+ scaleX: { description: "Width factor", unit: "factor", types: e },
40
+ scaleY: { description: "Height factor", unit: "factor", types: e },
41
+ skewX: { description: "Slants it sideways", unit: "degrees", types: e },
42
+ skewY: { description: "Slants it up and down", unit: "degrees", types: e },
43
+ originX: { description: "Transform pivot across its box", unit: "% (0 left, 50 centre, 100 right)", min: 0, max: 100, types: e },
44
+ originY: { description: "Transform pivot down its box", unit: "% (0 top, 50 centre, 100 bottom)", min: 0, max: 100, types: e },
45
+ fill: { description: "Fill colour (also written fillStyle)", kind: "color", types: e },
46
+ stroke: { description: "Outline colour (also written strokeStyle)", kind: "color", types: e },
47
+ strokeWidth: { description: "Outline width (also written lineWidth)", unit: "px", min: 0, types: e },
48
+ clipTop: { description: "Hides this much from the top edge, for reveals", unit: "% of its height", min: 0, max: 100, types: e },
49
+ clipRight: { description: "Hides this much from the right edge", unit: "% of its width", min: 0, max: 100, types: e },
50
+ clipBottom: { description: "Hides this much from the bottom edge", unit: "% of its height", min: 0, max: 100, types: e },
51
+ clipLeft: { description: "Hides this much from the left edge", unit: "% of its width", min: 0, max: 100, types: e },
52
+ blur: { description: "Gaussian blur", unit: "px", min: 0, types: e },
53
+ brightness: { description: "Brightness factor (1 unchanged)", unit: "factor", min: 0, types: e },
54
+ glow: { description: "Soft glow around it, in glowColor", unit: "px", min: 0, types: e },
55
+ glowColor: { description: "Colour of the glow", kind: "color", types: e },
56
+ shadowX: { description: "Drop shadow offset right", unit: "px", types: e },
57
+ shadowY: { description: "Drop shadow offset down", unit: "px", types: e },
58
+ shadowBlur: { description: "Drop shadow softness", unit: "px", min: 0, types: e },
59
+ shadowColor: { description: "Drop shadow colour", kind: "color", types: e },
60
+ shine: { description: "A highlight sweeping across the fill", unit: "0..1 (progress)", min: 0, max: 1, types: e },
61
+ drawOn: { description: "How much of the outline is drawn, for drawing a shape on; the fill appears when it is complete", unit: "0..1", min: 0, max: 1, types: g },
62
+ width: { description: "Box width", unit: "px", min: 0, types: ["rect", "image"] },
63
+ height: { description: "Box height", unit: "px", min: 0, types: ["rect", "image"] },
64
+ borderRadius: { description: "Rounded corners", unit: "px", min: 0, types: ["rect", "image"] },
65
+ radius: { description: "Circle radius", unit: "px", min: 0, types: ["circle"] },
66
+ x2: { description: "Line end, x", unit: "px", types: ["line"] },
67
+ y2: { description: "Line end, y", unit: "px", types: ["line"] },
68
+ d: { description: "SVG path data; tween between paths to morph", kind: "string", types: ["path"] },
69
+ text: { description: "The text shown (a text track types or scrambles it)", kind: "string", types: ["text"] },
70
+ fontSize: { description: "Font size", unit: "px", min: 0, types: ["text"] },
71
+ fontWeight: { description: "Font weight", unit: "100..900", min: 100, max: 900, types: ["text"] },
72
+ motionPath: { description: "Moves it along an SVG path (a motion-path track writes motionPathX/Y and, aligned, rotate)", kind: "string", types: e },
73
+ quaternion: { description: 'A rotation as [x, y, z, w] (a track with interpolation: "slerp")', kind: "list", types: e }
74
+ }, l = { fillStyle: "fill", strokeStyle: "stroke", lineWidth: "strokeWidth", rotateZ: "rotate", motionPathX: "x", motionPathY: "y", motionPathRotate: "rotate" }, k = {
75
+ rotation: "rotate",
76
+ angle: "rotate",
77
+ alpha: "opacity",
78
+ fade: "opacity",
79
+ color: "fill",
80
+ colour: "fill",
81
+ background: "fill",
82
+ size: "scale",
83
+ left: "x",
84
+ top: "y",
85
+ translateX: "x",
86
+ translateY: "y",
87
+ r: "radius",
88
+ path: "d",
89
+ content: "text"
90
+ };
91
+ function w(s) {
92
+ const i = s, o = Object.entries(y).filter(([, t]) => t.types.includes(s.type)).map(([t, { types: a, ...p }]) => ({ name: t, ...p, ...i[t] !== void 0 && typeof i[t] != "object" ? { value: i[t] } : {} }));
93
+ if (s.type !== "custom") return { type: s.type, properties: o };
94
+ const n = s.about;
95
+ for (const [t, a] of Object.entries(s.props ?? {}))
96
+ o.push({ name: t, description: n?.props?.[t]?.description ?? "", ...n?.props?.[t], value: a });
97
+ return { type: "custom", ...n ? { kind: n.kind, summary: n.summary } : {}, properties: o, ...n?.actions ? { actions: n.actions } : {} };
98
+ }
99
+ function b(s) {
100
+ const i = w(s).properties.map((o) => o.name);
101
+ return [...i, ...Object.keys(l).filter((o) => i.includes(l[o]))];
102
+ }
103
+ function T(s, i) {
104
+ const o = [], n = Object.keys(i);
105
+ for (const t of s) {
106
+ const a = (r) => o.push({ level: "error", track: t.id, message: r }), p = i[t.target];
107
+ if (!p) {
108
+ a(m("target", t.target, n));
109
+ continue;
110
+ }
111
+ const d = b(p), f = p.type === "custom" && p.acceptsProp?.(t.property);
112
+ if (!d.includes(t.property) && !f) {
113
+ a(`${t.target}: ${m("property", t.property, d, k[t.property])}`);
114
+ continue;
115
+ }
116
+ const h = t.keyframes ?? [];
117
+ for (let r = 1; r < h.length; r++)
118
+ h[r].time < h[r - 1].time && a(`${t.target}.${t.property}: keyframes out of time order (${h[r - 1].time} ms, then ${h[r].time} ms).`);
119
+ const c = y[l[t.property] ?? t.property] ?? p.about?.props?.[t.property], u = c && (c.kind ?? "number") === "number";
120
+ for (const r of h) {
121
+ if (u && typeof r.value != "number") {
122
+ a(`${t.target}.${t.property}: values are numbers${c.unit ? ` (${c.unit})` : ""} (got ${JSON.stringify(r.value)} at ${r.time} ms).`);
123
+ break;
124
+ }
125
+ if (u && typeof r.value == "number" && (c.min !== void 0 && r.value < c.min || c.max !== void 0 && r.value > c.max)) {
126
+ o.push({ level: "warning", track: t.id, message: `${t.target}.${t.property}: ${r.value} at ${r.time} ms is outside ${c.min ?? "−∞"}..${c.max ?? "∞"}${c.unit ? ` (${c.unit})` : ""}.` });
127
+ break;
128
+ }
129
+ }
130
+ }
131
+ return o;
132
+ }
133
+ export {
134
+ y as C,
135
+ x as I,
136
+ b as a,
137
+ Y as b,
138
+ S as c,
139
+ M as d,
140
+ T as e,
141
+ w as f
142
+ };