@algorisys/tinyfly 0.100.0 → 0.101.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/bin/tinyfly.mjs +7 -3
- package/docs/character-appearance.md +26 -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 +14 -2
- package/docs/maps.md +2 -2
- package/docs/scene-3d.md +23 -4
- package/docs/teaching.md +1 -1
- package/docs/video-rendering.md +154 -0
- package/lib/addons/adapters.js +387 -333
- package/lib/addons/characters.js +4467 -4448
- package/lib/addons/load-scene-oWNsYYC1.js +372 -0
- package/lib/addons/scene-3d-webgl.js +1 -1
- package/lib/addons/scene-3d.js +323 -277
- package/lib/addons/shading-0lPgnXmD.js +96 -0
- package/lib/browser/tinyfly-scene-3d.iife.js +2 -2
- package/lib/browser/tinyfly.iife.js +14 -14
- package/lib/browser/tinyfly.js +5888 -5511
- package/lib/browser/tinyfly.umd.js +14 -14
- package/lib/engine/tinyfly-engine.js +1389 -1031
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +39 -0
- package/lib/types/adapters/canvas/impossible.d.ts +15 -0
- package/lib/types/adapters/canvas/index.d.ts +3 -0
- package/lib/types/adapters/canvas/nested-zoom.d.ts +40 -0
- package/lib/types/adapters/canvas/zoom-blur.d.ts +49 -0
- package/lib/types/characters/character.d.ts +23 -3
- package/lib/types/characters/head/face.d.ts +19 -2
- package/lib/types/engine/authoring/beat-loop.d.ts +46 -0
- package/lib/types/engine/authoring/curve.d.ts +26 -0
- package/lib/types/engine/authoring/index.d.ts +3 -0
- package/lib/types/engine/authoring/periodic.d.ts +89 -0
- package/lib/types/engine/path/goo.d.ts +103 -0
- package/lib/types/engine/path/impossible.d.ts +92 -0
- package/lib/types/engine/path/index.d.ts +6 -0
- package/lib/types/engine/path/similarity.d.ts +48 -0
- package/lib/types/headless/index.d.ts +1 -0
- package/lib/types/headless/loop-audio.d.ts +21 -0
- package/lib/types/headless/node-audio.d.ts +20 -0
- package/lib/types/headless/video-scene.d.ts +9 -0
- package/lib/types/scene-3d/camera.d.ts +11 -2
- package/lib/types/scene-3d/geometry/mesh.d.ts +2 -0
- package/lib/types/scene-3d/geometry/primitives.d.ts +7 -0
- package/lib/types/scene-3d/impossible-3d.d.ts +29 -0
- package/lib/types/scene-3d/index.d.ts +4 -3
- package/lib/types/scene-3d/resolve-scene.d.ts +13 -1
- package/lib/types/scene-3d/scene-3d-adapter.d.ts +2 -0
- package/lib/types/scene-3d/scene-types.d.ts +29 -4
- package/lib/types/scene-3d/shading.d.ts +2 -0
- package/llms-full.txt +226 -15
- package/llms.txt +29 -29
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +7 -0
- package/lib/addons/load-scene-CQvcFWGJ.js +0 -331
- package/lib/addons/shading-o5T_v9DT.js +0 -89
package/lib/addons/adapters.js
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { D as
|
|
3
|
-
import { C as
|
|
4
|
-
import { createTrack as
|
|
5
|
-
import { p as
|
|
6
|
-
import { c as
|
|
7
|
-
function
|
|
1
|
+
import { h as q, e as D, i as G, a as Z, b as j, p as J, t as Q, g as K, c as W, q as ee, F as te, s as ie, d as oe } from "./dom-adapter-Cphr2HZn.js";
|
|
2
|
+
import { D as Ve } from "./dom-adapter-Cphr2HZn.js";
|
|
3
|
+
import { C as qe, I as Ze, a as je, b as Je, c as Qe, d as Ke, e as et, f as tt } from "./target-properties-BtN9skb-.js";
|
|
4
|
+
import { createTrack as se, parsePath as N, ribbon as ne, ribbonHeadCap as re, similarityMatrix as ae, powSimilarity as le, createRandom as ce, hashSeed as he, mat4 as v } from "@algorisys/tinyfly";
|
|
5
|
+
import { p as fe, s as de } from "./sketch-CYPUbk3Q.js";
|
|
6
|
+
import { c as ot, a as st, b as nt } from "./sketch-CYPUbk3Q.js";
|
|
7
|
+
function ue(s) {
|
|
8
8
|
const e = /* @__PURE__ */ new Map();
|
|
9
|
-
for (const { name: t, element: i } of
|
|
10
|
-
e.set(t,
|
|
9
|
+
for (const { name: t, element: i } of s)
|
|
10
|
+
e.set(t, U(i));
|
|
11
11
|
return { measurements: e };
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const i = t.duration ?? 600, o = t.easing ?? "ease-out",
|
|
15
|
-
for (const { name:
|
|
16
|
-
const h =
|
|
13
|
+
function pe(s, e, t = {}) {
|
|
14
|
+
const i = t.duration ?? 600, o = t.easing ?? "ease-out", n = t.scale !== !1, a = t.idPrefix ?? "flip", r = [];
|
|
15
|
+
for (const { name: l, element: c } of e) {
|
|
16
|
+
const h = s.measurements.get(l);
|
|
17
17
|
if (!h) continue;
|
|
18
|
-
const f =
|
|
19
|
-
if ((m !== 0 ||
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
),
|
|
23
|
-
const p = h.width / f.width,
|
|
24
|
-
p !== 1 && r.push(
|
|
18
|
+
const f = U(c), m = h.left + h.width / 2 - (f.left + f.width / 2), d = h.top + h.height / 2 - (f.top + f.height / 2);
|
|
19
|
+
if ((m !== 0 || d !== 0) && r.push(
|
|
20
|
+
A(`${a}-${l}-x`, l, "x", m, 0, i, o),
|
|
21
|
+
A(`${a}-${l}-y`, l, "y", d, 0, i, o)
|
|
22
|
+
), n && f.width > 0 && f.height > 0) {
|
|
23
|
+
const p = h.width / f.width, u = h.height / f.height;
|
|
24
|
+
p !== 1 && r.push(A(`${a}-${l}-sx`, l, "scaleX", p, 1, i, o)), u !== 1 && r.push(A(`${a}-${l}-sy`, l, "scaleY", u, 1, i, o));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
return r;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const i =
|
|
31
|
-
return e(),
|
|
29
|
+
function _e(s, e, t = {}) {
|
|
30
|
+
const i = ue(s);
|
|
31
|
+
return e(), pe(i, s, t);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
id:
|
|
33
|
+
function A(s, e, t, i, o, n, a) {
|
|
34
|
+
return se({
|
|
35
|
+
id: s,
|
|
36
36
|
target: e,
|
|
37
37
|
property: t,
|
|
38
38
|
keyframes: [
|
|
39
39
|
{ time: 0, value: i },
|
|
40
|
-
{ time:
|
|
40
|
+
{ time: n, value: o, easing: a }
|
|
41
41
|
]
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const e =
|
|
44
|
+
function U(s) {
|
|
45
|
+
const e = s;
|
|
46
46
|
if (typeof e.getBoundingClientRect != "function")
|
|
47
47
|
return { left: 0, top: 0, width: 0, height: 0 };
|
|
48
48
|
const t = e.getBoundingClientRect();
|
|
49
49
|
return { left: t.left, top: t.top, width: t.width, height: t.height };
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const i = t.highlight ?? "#ffffff", o = t.halfWidth ?? 0.12,
|
|
53
|
-
{ offset:
|
|
54
|
-
{ offset:
|
|
55
|
-
{ offset:
|
|
51
|
+
function H(s, e, t = {}) {
|
|
52
|
+
const i = t.highlight ?? "#ffffff", o = t.halfWidth ?? 0.12, n = -0.2 + s * 1.4, a = [{ offset: 0, color: e }], r = [
|
|
53
|
+
{ offset: n - o, color: e },
|
|
54
|
+
{ offset: n, color: i },
|
|
55
|
+
{ offset: n + o, color: e }
|
|
56
56
|
];
|
|
57
|
-
for (const
|
|
58
|
-
|
|
59
|
-
return a.push({ offset: 1, color: e }), a.sort((
|
|
57
|
+
for (const l of r)
|
|
58
|
+
l.offset > 0 && l.offset < 1 && a.push(l);
|
|
59
|
+
return a.push({ offset: 1, color: e }), a.sort((l, c) => l.offset - c.offset), a;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
function x(
|
|
61
|
+
const _ = 12;
|
|
62
|
+
function x(s) {
|
|
63
63
|
const e = [];
|
|
64
64
|
let t, i = -1;
|
|
65
|
-
for (const o of
|
|
65
|
+
for (const o of N(s).segments) {
|
|
66
66
|
if (o.type === "L") {
|
|
67
67
|
(!t || i !== o.subpath) && (t = { kind: "line", points: [{ x: o.startX, y: o.startY }], length: 0 }, i = o.subpath, e.push(t)), t.points.push({ x: o.endX, y: o.endY }), t.length += o.length;
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
t = void 0;
|
|
71
|
-
const [
|
|
72
|
-
for (let m = 0; m <=
|
|
73
|
-
const
|
|
71
|
+
const [n, a, r, l, c, h] = o.points, f = [];
|
|
72
|
+
for (let m = 0; m <= _; m++) {
|
|
73
|
+
const d = m / _, p = 1 - d;
|
|
74
74
|
f.push({
|
|
75
|
-
x: p * p * p * o.startX + 3 * p * p *
|
|
76
|
-
y: p * p * p * o.startY + 3 * p * p *
|
|
75
|
+
x: p * p * p * o.startX + 3 * p * p * d * n + 3 * p * d * d * r + d * d * d * c,
|
|
76
|
+
y: p * p * p * o.startY + 3 * p * p * d * a + 3 * p * d * d * l + d * d * d * h
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
e.push({ kind: "curve", points: f, length: o.length });
|
|
80
80
|
}
|
|
81
81
|
return e;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const a =
|
|
83
|
+
function me(s, e, t, i, o = 0) {
|
|
84
|
+
const n = Math.max(0, Math.min(o, t / 2, i / 2));
|
|
85
|
+
if (n === 0) return x(`M${s},${e} H${s + t} V${e + i} H${s} Z`);
|
|
86
|
+
const a = s + t, r = e + i;
|
|
87
87
|
return x(
|
|
88
|
-
`M${
|
|
88
|
+
`M${s + n},${e} H${a - n} A${n},${n} 0 0 1 ${a},${e + n} V${r - n} A${n},${n} 0 0 1 ${a - n},${r} H${s + n} A${n},${n} 0 0 1 ${s},${r - n} V${e + n} A${n},${n} 0 0 1 ${s + n},${e} Z`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
91
|
+
function C(s, e, t, i) {
|
|
92
|
+
const n = e.reduce((r, l) => r + l.length, 0) * Math.min(1, Math.max(0, t));
|
|
93
93
|
let a = 0;
|
|
94
|
-
i ||
|
|
94
|
+
i || s.beginPath();
|
|
95
95
|
for (const r of e) {
|
|
96
|
-
const
|
|
96
|
+
const l = r.length === 0 ? n >= a ? 1 : 0 : Math.min(1, Math.max(0, (n - a) / r.length));
|
|
97
97
|
if (a += r.length, i) {
|
|
98
|
-
r.kind === "curve" ? i.curve(r.points,
|
|
98
|
+
r.kind === "curve" ? i.curve(r.points, l) : i.line(r.points, l);
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
for (const h of
|
|
101
|
+
if (l <= 0) continue;
|
|
102
|
+
const c = fe(r.points, l);
|
|
103
|
+
s.moveTo(c[0].x, c[0].y);
|
|
104
|
+
for (const h of c.slice(1)) s.lineTo(h.x, h.y);
|
|
105
105
|
}
|
|
106
|
-
i ||
|
|
106
|
+
i || s.stroke();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function k(s, e, t) {
|
|
109
109
|
if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(e, t);
|
|
110
|
-
const i =
|
|
110
|
+
const i = s.canvas;
|
|
111
111
|
if (i?.ownerDocument) {
|
|
112
112
|
const o = i.ownerDocument.createElement("canvas");
|
|
113
113
|
return o.width = e, o.height = t, o;
|
|
@@ -118,10 +118,10 @@ function g(n, e, t) {
|
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
return typeof
|
|
121
|
+
function $e(s) {
|
|
122
|
+
return typeof s == "object" && s !== null && "type" in s;
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class I {
|
|
125
125
|
targets = /* @__PURE__ */ new Map();
|
|
126
126
|
targetOrder = [];
|
|
127
127
|
// Store animation offsets separately - these are applied via ctx.translate() during rendering
|
|
@@ -184,17 +184,17 @@ class R {
|
|
|
184
184
|
for (const [t, i] of e.values) {
|
|
185
185
|
const o = this.targets.get(t);
|
|
186
186
|
if (!o) continue;
|
|
187
|
-
const
|
|
188
|
-
for (const [r,
|
|
189
|
-
if (
|
|
190
|
-
r === "x" || r === "motionPathX" ? a.x =
|
|
187
|
+
const n = this.aliases.get(t) ?? t, a = this.animationOffsets.get(n) ?? { x: 0, y: 0 };
|
|
188
|
+
for (const [r, l] of i)
|
|
189
|
+
if (I.OFFSET_PROPERTIES.has(r) && typeof l == "number")
|
|
190
|
+
r === "x" || r === "motionPathX" ? a.x = l : (r === "y" || r === "motionPathY") && (a.y = l);
|
|
191
191
|
else if (o.type === "custom" && o.props && (r in o.props || o.acceptsProp?.(r)))
|
|
192
|
-
o.props[r] =
|
|
192
|
+
o.props[r] = l;
|
|
193
193
|
else {
|
|
194
|
-
const
|
|
195
|
-
o[
|
|
194
|
+
const c = I.PROPERTY_MAP[r] ?? r;
|
|
195
|
+
o[c] = l;
|
|
196
196
|
}
|
|
197
|
-
this.animationOffsets.set(
|
|
197
|
+
this.animationOffsets.set(n, a);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
@@ -219,24 +219,24 @@ class R {
|
|
|
219
219
|
* Render a single target.
|
|
220
220
|
*/
|
|
221
221
|
renderTarget(e, t, i) {
|
|
222
|
-
if (e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity),
|
|
223
|
-
const
|
|
224
|
-
if (t.backfaceVisibility === "hidden" &&
|
|
222
|
+
if (e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), q(t)) {
|
|
223
|
+
const n = D(t, i, { x: this.getPivotX(t), y: this.getPivotY(t) });
|
|
224
|
+
if (t.backfaceVisibility === "hidden" && G(n)) {
|
|
225
225
|
e.restore();
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
Z(n) ? (e.transform(...j(n)), this.drawContent(e, t)) : this.drawInPerspective(e, t, n), e.restore();
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
if ((i.x !== 0 || i.y !== 0) && e.translate(i.x, i.y), t.rotate !== void 0 || t.rotateX !== void 0 || t.rotateY !== void 0 || t.scale !== void 0 || t.scaleX !== void 0 || t.scaleY !== void 0 || t.skewX !== void 0 || t.skewY !== void 0) {
|
|
232
|
-
const
|
|
233
|
-
e.translate(
|
|
234
|
-
let r = t.scaleX ?? 1,
|
|
235
|
-
if (t.rotateX !== void 0 && (
|
|
236
|
-
const
|
|
237
|
-
e.transform(1, Math.tan(h), Math.tan(
|
|
232
|
+
const n = this.getPivotX(t), a = this.getPivotY(t);
|
|
233
|
+
e.translate(n, a), t.rotate !== void 0 && e.rotate(t.rotate * Math.PI / 180);
|
|
234
|
+
let r = t.scaleX ?? 1, l = t.scaleY ?? 1;
|
|
235
|
+
if (t.rotateX !== void 0 && (l *= Math.cos(t.rotateX * Math.PI / 180)), t.rotateY !== void 0 && (r *= Math.cos(t.rotateY * Math.PI / 180)), t.scale !== void 0 ? e.scale(t.scale, t.scale) : (r !== 1 || l !== 1) && e.scale(r, l), t.skewX !== void 0 || t.skewY !== void 0) {
|
|
236
|
+
const c = (t.skewX ?? 0) * Math.PI / 180, h = (t.skewY ?? 0) * Math.PI / 180;
|
|
237
|
+
e.transform(1, Math.tan(h), Math.tan(c), 1, 0, 0);
|
|
238
238
|
}
|
|
239
|
-
e.translate(-
|
|
239
|
+
e.translate(-n, -a);
|
|
240
240
|
}
|
|
241
241
|
this.drawContent(e, t), e.restore();
|
|
242
242
|
}
|
|
@@ -246,20 +246,20 @@ class R {
|
|
|
246
246
|
* there. The triangles overlap by a pixel so no anti-aliased seam shows.
|
|
247
247
|
*/
|
|
248
248
|
drawInPerspective(e, t, i) {
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
|
|
249
|
+
const n = e.globalAlpha < 1 ? this.perspectiveLayer(e) : null;
|
|
250
|
+
if (n) {
|
|
251
|
+
n.ctx.setTransform(e.getTransform()), this.drawMesh(n.ctx, t, i), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(n.canvas, 0, 0), e.restore();
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
254
|
this.drawMesh(e, t, i);
|
|
255
255
|
}
|
|
256
256
|
drawMesh(e, t, i) {
|
|
257
257
|
const o = this.contentBounds(e, t);
|
|
258
|
-
for (const
|
|
259
|
-
const a =
|
|
258
|
+
for (const n of J(i, o)) {
|
|
259
|
+
const a = Q(n.source, n.target);
|
|
260
260
|
if (!a) continue;
|
|
261
|
-
const [r,
|
|
262
|
-
e.save(), e.beginPath(), e.moveTo(r.x, r.y), e.lineTo(
|
|
261
|
+
const [r, l, c] = K(n.target, 1);
|
|
262
|
+
e.save(), e.beginPath(), e.moveTo(r.x, r.y), e.lineTo(l.x, l.y), e.lineTo(c.x, c.y), e.closePath(), e.clip(), e.transform(...a), this.drawContent(e, t), e.restore();
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
/** A cleared offscreen canvas the size of `ctx`'s, reused frame to frame; null where none can be made. */
|
|
@@ -267,8 +267,8 @@ class R {
|
|
|
267
267
|
const t = e.canvas?.width ?? 0, i = e.canvas?.height ?? 0;
|
|
268
268
|
if (!(t > 0 && i > 0)) return null;
|
|
269
269
|
if (!this.layer || this.layer.width !== t || this.layer.height !== i) {
|
|
270
|
-
const
|
|
271
|
-
if (this.layer =
|
|
270
|
+
const n = k(e, t, i), a = n?.getContext("2d");
|
|
271
|
+
if (this.layer = n && a ? { canvas: n, ctx: a, width: t, height: i } : null, !this.layer) return null;
|
|
272
272
|
}
|
|
273
273
|
const o = this.layer.ctx;
|
|
274
274
|
return o.setTransform(1, 0, 0, 1, 0, 0), o.globalAlpha = 1, o.clearRect(0, 0, t, i), this.layer;
|
|
@@ -281,22 +281,22 @@ class R {
|
|
|
281
281
|
contentBounds(e, t) {
|
|
282
282
|
let i = this.getTargetBounds(t);
|
|
283
283
|
if (t.type === "text") {
|
|
284
|
-
const
|
|
285
|
-
e.save(), e.font = `${t.fontWeight ?? 400} ${
|
|
284
|
+
const n = t.fontSize ?? 16;
|
|
285
|
+
e.save(), e.font = `${t.fontWeight ?? 400} ${n}px ${t.fontFamily ?? "sans-serif"}`;
|
|
286
286
|
const a = e.measureText(t.text).width;
|
|
287
287
|
e.restore();
|
|
288
|
-
const r = t.textAlign ?? "left",
|
|
289
|
-
i = { x:
|
|
288
|
+
const r = t.textAlign ?? "left", l = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, c = (t.textBaseline ?? "top") === "top" ? t.y : t.y - n;
|
|
289
|
+
i = { x: l, y: c, width: a, height: n * 1.4 };
|
|
290
290
|
} else if (t.type === "path") {
|
|
291
|
-
const
|
|
292
|
-
for (const r of
|
|
293
|
-
|
|
294
|
-
for (let
|
|
295
|
-
|
|
291
|
+
const n = [], a = [];
|
|
292
|
+
for (const r of N(t.d).segments) {
|
|
293
|
+
n.push(r.startX, r.endX), a.push(r.startY, r.endY);
|
|
294
|
+
for (let l = 0; l + 1 < r.points.length; l += 2)
|
|
295
|
+
n.push(r.points[l]), a.push(r.points[l + 1]);
|
|
296
296
|
}
|
|
297
|
-
if (
|
|
298
|
-
const r = Math.min(...
|
|
299
|
-
i = { x: t.x + r, y: t.y +
|
|
297
|
+
if (n.length > 0) {
|
|
298
|
+
const r = Math.min(...n), l = Math.min(...a);
|
|
299
|
+
i = { x: t.x + r, y: t.y + l, width: Math.max(...n) - r, height: Math.max(...a) - l };
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
const o = (t.lineWidth ?? 1) + 2 + 3 * Math.max(t.blur ?? 0, t.glow ?? 0, t.shadowBlur ?? 0) + Math.max(Math.abs(t.shadowX ?? 0), Math.abs(t.shadowY ?? 0));
|
|
@@ -308,10 +308,10 @@ class R {
|
|
|
308
308
|
*/
|
|
309
309
|
drawContent(e, t) {
|
|
310
310
|
t.fillStyle && (e.fillStyle = this.resolveFillStyle(e, t)), t.strokeStyle && (e.strokeStyle = t.strokeStyle), t.lineWidth !== void 0 && (e.lineWidth = t.lineWidth);
|
|
311
|
-
const i =
|
|
311
|
+
const i = W(t);
|
|
312
312
|
if (i && (e.filter = i), t.clipTop !== void 0 || t.clipRight !== void 0 || t.clipBottom !== void 0 || t.clipLeft !== void 0) {
|
|
313
|
-
const o = this.getTargetBounds(t),
|
|
314
|
-
e.beginPath(), e.rect(
|
|
313
|
+
const o = this.getTargetBounds(t), n = o.x + (t.clipLeft ?? 0) / 100 * o.width, a = o.x + o.width - (t.clipRight ?? 0) / 100 * o.width, r = o.y + (t.clipTop ?? 0) / 100 * o.height, l = o.y + o.height - (t.clipBottom ?? 0) / 100 * o.height;
|
|
314
|
+
e.beginPath(), e.rect(n, r, Math.max(0, a - n), Math.max(0, l - r)), e.clip();
|
|
315
315
|
}
|
|
316
316
|
switch (t.type) {
|
|
317
317
|
case "rect":
|
|
@@ -351,18 +351,18 @@ class R {
|
|
|
351
351
|
* Create a canvas linear gradient from a LinearGradient definition.
|
|
352
352
|
*/
|
|
353
353
|
createLinearGradient(e, t, i) {
|
|
354
|
-
const o = (t.angle - 90) * (Math.PI / 180),
|
|
355
|
-
for (const
|
|
356
|
-
m.addColorStop(
|
|
354
|
+
const o = (t.angle - 90) * (Math.PI / 180), n = i.x + i.width / 2, a = i.y + i.height / 2, r = Math.max(i.width, i.height), l = n - Math.cos(o) * r / 2, c = a - Math.sin(o) * r / 2, h = n + Math.cos(o) * r / 2, f = a + Math.sin(o) * r / 2, m = e.createLinearGradient(l, c, h, f);
|
|
355
|
+
for (const d of t.stops)
|
|
356
|
+
m.addColorStop(d.offset, d.color);
|
|
357
357
|
return m;
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
360
360
|
* Create a canvas radial gradient from a RadialGradient definition.
|
|
361
361
|
*/
|
|
362
362
|
createRadialGradient(e, t, i) {
|
|
363
|
-
const o = i.x + i.width * t.centerX,
|
|
364
|
-
for (const
|
|
365
|
-
r.addColorStop(
|
|
363
|
+
const o = i.x + i.width * t.centerX, n = i.y + i.height * t.centerY, a = Math.max(i.width, i.height) * t.radius, r = e.createRadialGradient(o, n, 0, o, n, a);
|
|
364
|
+
for (const l of t.stops)
|
|
365
|
+
r.addColorStop(l.offset, l.color);
|
|
366
366
|
return r;
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
@@ -403,24 +403,24 @@ class R {
|
|
|
403
403
|
* then the outline up to `drawOn`, in pencil strokes when sketched.
|
|
404
404
|
*/
|
|
405
405
|
renderOutlined(e, t, i, o) {
|
|
406
|
-
const
|
|
407
|
-
if (i && t.fillStyle &&
|
|
408
|
-
const a = t.sketch ?
|
|
409
|
-
a && (e.lineCap = t.lineCap ?? "round", e.lineJoin = t.lineJoin ?? "round"), o(
|
|
406
|
+
const n = Math.min(1, Math.max(0, t.drawOn ?? 1));
|
|
407
|
+
if (i && t.fillStyle && n >= 1 && i(), !t.strokeStyle || n <= 0) return;
|
|
408
|
+
const a = t.sketch ? de(e, t.sketch, this.time) : void 0;
|
|
409
|
+
a && (e.lineCap = t.lineCap ?? "round", e.lineJoin = t.lineJoin ?? "round"), o(n, a);
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
412
|
* Render a rectangle.
|
|
413
413
|
*/
|
|
414
414
|
renderRect(e, t) {
|
|
415
415
|
if (this.drawsOutline(t)) {
|
|
416
|
-
const { x: i, y: o, width:
|
|
416
|
+
const { x: i, y: o, width: n, height: a } = t;
|
|
417
417
|
return this.renderOutlined(
|
|
418
418
|
e,
|
|
419
419
|
t,
|
|
420
420
|
() => {
|
|
421
|
-
e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, i, o,
|
|
421
|
+
e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, i, o, n, a, t.borderRadius) : e.rect(i, o, n, a), e.fill();
|
|
422
422
|
},
|
|
423
|
-
(r,
|
|
423
|
+
(r, l) => C(e, me(i, o, n, a, t.borderRadius), r, l)
|
|
424
424
|
);
|
|
425
425
|
}
|
|
426
426
|
e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, t.x, t.y, t.width, t.height, t.borderRadius) : e.rect(t.x, t.y, t.width, t.height), t.fillStyle && e.fill(), t.strokeStyle && e.stroke(), e.closePath();
|
|
@@ -428,25 +428,25 @@ class R {
|
|
|
428
428
|
/**
|
|
429
429
|
* Draw a rounded rectangle path.
|
|
430
430
|
*/
|
|
431
|
-
roundRect(e, t, i, o,
|
|
432
|
-
const r = Math.min(a, o / 2,
|
|
433
|
-
e.moveTo(t + r, i), e.lineTo(t + o - r, i), e.arcTo(t + o, i, t + o, i + r, r), e.lineTo(t + o, i +
|
|
431
|
+
roundRect(e, t, i, o, n, a) {
|
|
432
|
+
const r = Math.min(a, o / 2, n / 2);
|
|
433
|
+
e.moveTo(t + r, i), e.lineTo(t + o - r, i), e.arcTo(t + o, i, t + o, i + r, r), e.lineTo(t + o, i + n - r), e.arcTo(t + o, i + n, t + o - r, i + n, r), e.lineTo(t + r, i + n), e.arcTo(t, i + n, t, i + n - r, r), e.lineTo(t, i + r), e.arcTo(t, i, t + r, i, r);
|
|
434
434
|
}
|
|
435
435
|
/**
|
|
436
436
|
* Render a circle.
|
|
437
437
|
*/
|
|
438
438
|
renderCircle(e, t) {
|
|
439
439
|
if (this.drawsOutline(t)) {
|
|
440
|
-
const { x: i, y: o, radius:
|
|
440
|
+
const { x: i, y: o, radius: n } = t;
|
|
441
441
|
return this.renderOutlined(
|
|
442
442
|
e,
|
|
443
443
|
t,
|
|
444
444
|
() => {
|
|
445
|
-
e.beginPath(), e.arc(i, o,
|
|
445
|
+
e.beginPath(), e.arc(i, o, n, 0, Math.PI * 2), e.fill();
|
|
446
446
|
},
|
|
447
447
|
(a, r) => {
|
|
448
|
-
if (r) return r.circle(i, o,
|
|
449
|
-
e.beginPath(), e.arc(i, o,
|
|
448
|
+
if (r) return r.circle(i, o, n, a);
|
|
449
|
+
e.beginPath(), e.arc(i, o, n, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * a), e.stroke();
|
|
450
450
|
}
|
|
451
451
|
);
|
|
452
452
|
}
|
|
@@ -456,13 +456,13 @@ class R {
|
|
|
456
456
|
* Render text.
|
|
457
457
|
*/
|
|
458
458
|
renderText(e, t) {
|
|
459
|
-
const i = t.fontSize ?? 16, o = t.fontFamily ?? "sans-serif",
|
|
460
|
-
if (e.font = `${
|
|
459
|
+
const i = t.fontSize ?? 16, o = t.fontFamily ?? "sans-serif", n = t.fontWeight ?? 400;
|
|
460
|
+
if (e.font = `${n} ${i}px ${o}`, e.textAlign = t.textAlign ?? "left", e.textBaseline = t.textBaseline ?? "top", t.fillStyle) {
|
|
461
461
|
if (t.shine !== void 0 && typeof t.fillStyle == "string") {
|
|
462
|
-
const a = e.measureText(t.text).width, r = t.textAlign ?? "left",
|
|
463
|
-
for (const h of
|
|
464
|
-
|
|
465
|
-
e.fillStyle =
|
|
462
|
+
const a = e.measureText(t.text).width, r = t.textAlign ?? "left", l = r === "center" ? t.x - a / 2 : r === "right" ? t.x - a : t.x, c = e.createLinearGradient(l, t.y, l + a, t.y);
|
|
463
|
+
for (const h of H(t.shine, t.fillStyle))
|
|
464
|
+
c.addColorStop(h.offset, h.color);
|
|
465
|
+
e.fillStyle = c;
|
|
466
466
|
}
|
|
467
467
|
e.fillText(t.text, t.x, t.y);
|
|
468
468
|
}
|
|
@@ -481,7 +481,7 @@ class R {
|
|
|
481
481
|
e,
|
|
482
482
|
t,
|
|
483
483
|
void 0,
|
|
484
|
-
(
|
|
484
|
+
(n, a) => C(e, [{ kind: "line", points: i, length: o }], n, a)
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
487
|
e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(t.x2, t.y2), t.strokeStyle && e.stroke(), e.closePath();
|
|
@@ -497,7 +497,7 @@ class R {
|
|
|
497
497
|
e,
|
|
498
498
|
t,
|
|
499
499
|
() => e.fill(i),
|
|
500
|
-
(o,
|
|
500
|
+
(o, n) => C(e, x(t.d), o, n)
|
|
501
501
|
);
|
|
502
502
|
t.fillStyle && e.fill(i), t.strokeStyle && e.stroke(i);
|
|
503
503
|
}
|
|
@@ -507,13 +507,13 @@ class R {
|
|
|
507
507
|
renderImage(e, t) {
|
|
508
508
|
if (!t.image) return;
|
|
509
509
|
t.opacity !== void 0 && (e.globalAlpha = t.opacity);
|
|
510
|
-
const { x: i, y: o, width:
|
|
511
|
-
let m = i,
|
|
510
|
+
const { x: i, y: o, width: n, height: a } = t, r = t.objectFit ?? "fill", l = t.borderRadius ?? 0, c = t.image, h = c.naturalWidth || c.videoWidth || c.width || n, f = c.naturalHeight || c.videoHeight || c.height || a;
|
|
511
|
+
let m = i, d = o, p = n, u = a;
|
|
512
512
|
if (r !== "fill" && h > 0 && f > 0) {
|
|
513
|
-
const y = r === "cover" ? Math.max(
|
|
514
|
-
p = h * y,
|
|
513
|
+
const y = r === "cover" ? Math.max(n / h, a / f) : Math.min(n / h, a / f);
|
|
514
|
+
p = h * y, u = f * y, m = i + (n - p) / 2, d = o + (a - u) / 2;
|
|
515
515
|
}
|
|
516
|
-
e.save(), e.beginPath(),
|
|
516
|
+
e.save(), e.beginPath(), l > 0 && typeof e.roundRect == "function" ? e.roundRect(i, o, n, a, l) : e.rect(i, o, n, a), e.clip(), e.drawImage(t.image, m, d, p, u), e.restore();
|
|
517
517
|
}
|
|
518
518
|
/**
|
|
519
519
|
* Render a custom target by calling its draw function in local coordinates.
|
|
@@ -621,109 +621,158 @@ class R {
|
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
function
|
|
625
|
-
const t =
|
|
626
|
-
for (let
|
|
627
|
-
const a = n
|
|
624
|
+
function ye(s, e) {
|
|
625
|
+
const t = s.length / 4, i = new Float32Array(t * 3), o = Math.min(0.999, Math.max(0, e));
|
|
626
|
+
for (let n = 0; n < t; n++) {
|
|
627
|
+
const a = s[n * 4] / 255, r = s[n * 4 + 1] / 255, l = s[n * 4 + 2] / 255, c = s[n * 4 + 3] / 255, h = Math.max(a, r, l);
|
|
628
628
|
if (h <= o) continue;
|
|
629
|
-
const f = (h - o) / (1 - o) *
|
|
630
|
-
i[
|
|
629
|
+
const f = (h - o) / (1 - o) * c / h;
|
|
630
|
+
i[n * 3] = a * f, i[n * 3 + 1] = r * f, i[n * 3 + 2] = l * f;
|
|
631
631
|
}
|
|
632
632
|
return i;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
const
|
|
634
|
+
function $(s, e, t, i, o) {
|
|
635
|
+
const n = new Float32Array(s.length), a = o ? t : e, r = o ? e : t, l = (h, f) => (o ? h * e + f : f * e + h) * 3, c = i * 2 + 1;
|
|
636
636
|
for (let h = 0; h < a; h++)
|
|
637
637
|
for (let f = 0; f < 3; f++) {
|
|
638
638
|
let m = 0;
|
|
639
|
-
for (let
|
|
640
|
-
for (let
|
|
641
|
-
|
|
642
|
-
const p =
|
|
643
|
-
m +=
|
|
639
|
+
for (let d = -i; d <= i; d++) m += s[l(h, Math.min(r - 1, Math.max(0, d))) + f];
|
|
640
|
+
for (let d = 0; d < r; d++) {
|
|
641
|
+
n[l(h, d) + f] = m / c;
|
|
642
|
+
const p = s[l(h, Math.max(0, d - i)) + f], u = s[l(h, Math.min(r - 1, d + i + 1)) + f];
|
|
643
|
+
m += u - p;
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
return
|
|
646
|
+
return n;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function Y(s, e, t, i) {
|
|
649
649
|
const o = Math.max(1, Math.round(i / Math.sqrt(3)));
|
|
650
|
-
let
|
|
650
|
+
let n = s;
|
|
651
651
|
for (let a = 0; a < 3; a++)
|
|
652
|
-
|
|
653
|
-
return
|
|
652
|
+
n = $(n, e, t, o, !0), n = $(n, e, t, o, !1);
|
|
653
|
+
return n;
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const t =
|
|
655
|
+
function Ye(s, e = {}) {
|
|
656
|
+
const t = s.canvas, i = t.width, o = t.height;
|
|
657
657
|
if (!(i > 0 && o > 0)) return;
|
|
658
|
-
const
|
|
659
|
-
if (!
|
|
660
|
-
|
|
661
|
-
const h =
|
|
658
|
+
const n = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / n)), r = Math.max(1, Math.ceil(o / n)), l = k(s, a, r), c = l?.getContext("2d");
|
|
659
|
+
if (!l || !c) return;
|
|
660
|
+
c.imageSmoothingEnabled = !0, c.drawImage(s.canvas, 0, 0, a, r);
|
|
661
|
+
const h = ye(c.getImageData(0, 0, a, r).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, o) * 0.02) / n, m = Y(h, a, r, f), d = Y(h, a, r, f * 3), p = e.halo ?? 0.6, u = c.createImageData(a, r);
|
|
662
662
|
for (let y = 0; y < a * r; y++) {
|
|
663
|
-
for (let w = 0; w < 3; w++)
|
|
664
|
-
|
|
663
|
+
for (let w = 0; w < 3; w++) u.data[y * 4 + w] = Math.round(Math.min(1, m[y * 3 + w] + d[y * 3 + w] * p) * 255);
|
|
664
|
+
u.data[y * 4 + 3] = 255;
|
|
665
665
|
}
|
|
666
|
-
|
|
666
|
+
c.putImageData(u, 0, 0), s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.globalCompositeOperation = "lighter", s.globalAlpha = Math.max(0, e.strength ?? 0.9), s.imageSmoothingEnabled = !0, s.drawImage(l, 0, 0, i, o), s.restore();
|
|
667
667
|
}
|
|
668
|
-
function
|
|
669
|
-
const i = t.width ?? 6, o = t.taper ?? 1,
|
|
670
|
-
if (
|
|
671
|
-
const
|
|
672
|
-
r ? (
|
|
673
|
-
}
|
|
674
|
-
const
|
|
675
|
-
if (t.head &&
|
|
676
|
-
r && (
|
|
677
|
-
const
|
|
678
|
-
h.addColorStop(0,
|
|
679
|
-
}
|
|
680
|
-
|
|
668
|
+
function Oe(s, e, t) {
|
|
669
|
+
const i = t.width ?? 6, o = t.taper ?? 1, n = t.fade ?? 1, a = t.opacity ?? 1, r = t.blend === "add";
|
|
670
|
+
if (s.save(), e.length >= 2) {
|
|
671
|
+
const c = be(e, i, o, n, a);
|
|
672
|
+
r ? (s.globalCompositeOperation = "lighter", X(s, c, t.color)) : ve(s, c, t.color);
|
|
673
|
+
}
|
|
674
|
+
const l = e[e.length - 1];
|
|
675
|
+
if (t.head && l && t.head.radius > 0) {
|
|
676
|
+
r && (s.globalCompositeOperation = "lighter");
|
|
677
|
+
const c = t.head.color ?? t.color, h = s.createRadialGradient(l.at.x, l.at.y, 0, l.at.x, l.at.y, t.head.radius);
|
|
678
|
+
h.addColorStop(0, c), h.addColorStop(0.35, c), h.addColorStop(1, we(s, c)), s.globalAlpha = a, s.fillStyle = h, s.beginPath(), s.arc(l.at.x, l.at.y, t.head.radius, 0, Math.PI * 2), s.fill();
|
|
679
|
+
}
|
|
680
|
+
s.restore();
|
|
681
681
|
}
|
|
682
|
-
function
|
|
683
|
-
|
|
684
|
-
const t = String(
|
|
682
|
+
function we(s, e) {
|
|
683
|
+
s.fillStyle = e;
|
|
684
|
+
const t = String(s.fillStyle), i = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);
|
|
685
685
|
if (i) return `rgba(${parseInt(i[1], 16)}, ${parseInt(i[2], 16)}, ${parseInt(i[3], 16)}, 0)`;
|
|
686
686
|
const o = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i.exec(t);
|
|
687
687
|
return o ? `rgba(${o[1]}, ${o[2]}, ${o[3]}, 0)` : "rgba(0, 0, 0, 0)";
|
|
688
688
|
}
|
|
689
|
-
function
|
|
690
|
-
const
|
|
691
|
-
for (let
|
|
692
|
-
const h = (
|
|
689
|
+
function be(s, e, t, i, o) {
|
|
690
|
+
const n = s.map((c) => ({ x: c.at.x, y: c.at.y, width: e * (1 - t * c.age) })), a = ne(n), r = re(n) ?? void 0, l = [];
|
|
691
|
+
for (let c = 0; c + 1 < s.length; c++) {
|
|
692
|
+
const h = (s[c].age + s[c + 1].age) / 2, f = o * (1 - i * h);
|
|
693
693
|
if (f <= 0) continue;
|
|
694
|
-
const m =
|
|
695
|
-
|
|
694
|
+
const m = c + 2 === s.length;
|
|
695
|
+
l.push({ corners: [a.left[c], a.left[c + 1], a.right[c + 1], a.right[c]], alpha: f, ...m && r && { cap: r } });
|
|
696
696
|
}
|
|
697
|
-
return
|
|
697
|
+
return l;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
700
|
-
|
|
699
|
+
function X(s, e, t) {
|
|
700
|
+
s.fillStyle = t;
|
|
701
701
|
for (const i of e) {
|
|
702
|
-
const [o,
|
|
703
|
-
|
|
702
|
+
const [o, n, a, r] = i.corners;
|
|
703
|
+
s.globalAlpha = Math.min(1, i.alpha), s.beginPath(), s.moveTo(o.x, o.y), s.lineTo(n.x, n.y), i.cap && s.arc(i.cap.x, i.cap.y, i.cap.radius, i.cap.start, i.cap.start - Math.PI, !0), s.lineTo(a.x, a.y), s.lineTo(r.x, r.y), s.closePath(), s.fill();
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
const i = typeof
|
|
708
|
-
...
|
|
709
|
-
corners:
|
|
710
|
-
...
|
|
706
|
+
function ve(s, e, t) {
|
|
707
|
+
const i = typeof s.getTransform == "function" ? s.getTransform() : null, o = (u) => i ? { x: i.a * u.x + i.c * u.y + i.e, y: i.b * u.x + i.d * u.y + i.f } : u, n = i ? Math.sqrt(Math.abs(i.a * i.d - i.b * i.c)) : 1, a = e.map((u) => ({
|
|
708
|
+
...u,
|
|
709
|
+
corners: u.corners.map(o),
|
|
710
|
+
...u.cap && { cap: { ...u.cap, ...o(u.cap), radius: u.cap.radius * n, start: u.cap.start + (i ? Math.atan2(i.b, i.a) : 0) } }
|
|
711
711
|
}));
|
|
712
|
-
let r = 1 / 0,
|
|
713
|
-
for (const
|
|
714
|
-
const y =
|
|
715
|
-
for (const w of [...
|
|
716
|
-
r = Math.min(r, w.x),
|
|
717
|
-
}
|
|
718
|
-
if (!(
|
|
719
|
-
const f = Math.floor(r) - 1, m = Math.floor(
|
|
720
|
-
if (!
|
|
721
|
-
|
|
712
|
+
let r = 1 / 0, l = 1 / 0, c = -1 / 0, h = -1 / 0;
|
|
713
|
+
for (const u of a) {
|
|
714
|
+
const y = u.cap ? [{ x: u.cap.x - u.cap.radius, y: u.cap.y - u.cap.radius }, { x: u.cap.x + u.cap.radius, y: u.cap.y + u.cap.radius }] : [];
|
|
715
|
+
for (const w of [...u.corners, ...y])
|
|
716
|
+
r = Math.min(r, w.x), l = Math.min(l, w.y), c = Math.max(c, w.x), h = Math.max(h, w.y);
|
|
717
|
+
}
|
|
718
|
+
if (!(c > r && h > l)) return;
|
|
719
|
+
const f = Math.floor(r) - 1, m = Math.floor(l) - 1, d = i ? k(s, Math.ceil(c) + 1 - f, Math.ceil(h) + 1 - m) : null, p = d?.getContext("2d");
|
|
720
|
+
if (!d || !p) {
|
|
721
|
+
X(s, e, t);
|
|
722
722
|
return;
|
|
723
723
|
}
|
|
724
|
-
p.translate(-f, -m), p.globalCompositeOperation = "lighter",
|
|
724
|
+
p.translate(-f, -m), p.globalCompositeOperation = "lighter", X(p, a, t), s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.globalAlpha = 1, s.drawImage(d, f, m), s.restore();
|
|
725
725
|
}
|
|
726
|
-
|
|
726
|
+
function Te(s, e, t) {
|
|
727
|
+
return le(s, e - t);
|
|
728
|
+
}
|
|
729
|
+
function Be(s, e) {
|
|
730
|
+
const [t, i] = e.levels ?? [-4, 24], o = e.minSize ?? 1, n = [];
|
|
731
|
+
for (let l = Math.ceil(t); l <= Math.floor(i); l++) {
|
|
732
|
+
const c = Te(e.step, l, e.phase);
|
|
733
|
+
c.scale * e.extent < o || n.push({ level: l, scale: c.scale, transform: c });
|
|
734
|
+
}
|
|
735
|
+
n.sort((l, c) => c.scale - l.scale);
|
|
736
|
+
let a = 0;
|
|
737
|
+
if (e.coversAbove !== void 0)
|
|
738
|
+
for (let l = 0; l < n.length; l++) n[l].scale >= e.coversAbove && (a = l);
|
|
739
|
+
const r = [];
|
|
740
|
+
for (const { level: l, scale: c, transform: h } of n.slice(a))
|
|
741
|
+
s.save(), s.transform(...ae(h)), e.draw(s, l, c), s.restore(), r.push(l);
|
|
742
|
+
return r;
|
|
743
|
+
}
|
|
744
|
+
function Le(s, e = {}) {
|
|
745
|
+
const t = s.canvas, i = t.width, o = t.height;
|
|
746
|
+
if (!(i > 0 && o > 0)) return;
|
|
747
|
+
const n = k(s, i, o), a = n?.getContext("2d");
|
|
748
|
+
if (!n || !a) return;
|
|
749
|
+
a.drawImage(s.canvas, 0, 0);
|
|
750
|
+
const r = Math.max(1, Math.round(e.samples ?? 8)), l = e.strength ?? 0.08, c = e.centre?.x ?? i / 2, h = e.centre?.y ?? o / 2, f = e.blend === "add", m = Math.min(1, Math.max(0, e.amount ?? 1));
|
|
751
|
+
s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.imageSmoothingEnabled = !0, f && (s.globalCompositeOperation = "lighter");
|
|
752
|
+
for (let d = 1; d <= r; d++) {
|
|
753
|
+
const p = 1 + l * d / r;
|
|
754
|
+
s.globalAlpha = m * (f ? 0.9 / r : 1 / (d + 1)), s.drawImage(n, c - c * p, h - h * p, i * p, o * p);
|
|
755
|
+
}
|
|
756
|
+
s.restore();
|
|
757
|
+
}
|
|
758
|
+
function Fe(s, e = {}) {
|
|
759
|
+
const t = s.canvas, i = e.centre?.x ?? t.width / 2, o = e.centre?.y ?? t.height / 2, n = Math.hypot(t.width, t.height) / 2, a = e.inner ?? n * 0.15, r = e.outer ?? n * 1.1, l = Math.max(1, r - a), c = (e.length ?? 0.35) * l, h = Math.max(1, Math.round(e.count ?? 28)), f = ce(typeof e.seed == "string" ? he(e.seed) : e.seed ?? 1), m = e.phase ?? 0, d = e.direction === "in" ? -1 : 1;
|
|
760
|
+
s.save(), s.strokeStyle = e.color ?? "#ffffff", s.lineCap = "round", e.blend === "add" && (s.globalCompositeOperation = "lighter");
|
|
761
|
+
const p = e.width ?? 3, u = e.opacity ?? 0.8;
|
|
762
|
+
for (let y = 0; y < h; y++) {
|
|
763
|
+
const w = (y + f.next() * 0.6) / h * Math.PI * 2, T = f.next(), M = 0.6 + f.next() * 0.8, z = ((T + d * m) % 1 + 1) % 1, b = a + z * l, S = b + c * M, P = Math.cos(w), g = Math.sin(w), R = s.createLinearGradient(i + P * b, o + g * b, i + P * S, o + g * S);
|
|
764
|
+
R.addColorStop(0, "rgba(0,0,0,0)"), R.addColorStop(0.5, e.color ?? "#ffffff"), R.addColorStop(1, "rgba(0,0,0,0)"), s.strokeStyle = R, s.globalAlpha = u * Math.min(1, (b - a) / l + 0.3), s.lineWidth = p * (0.4 + 0.6 * (b - a) / l), s.beginPath(), s.moveTo(i + P * b, o + g * b), s.lineTo(i + P * Math.min(S, r + c), o + g * Math.min(S, r + c)), s.stroke();
|
|
765
|
+
}
|
|
766
|
+
s.restore();
|
|
767
|
+
}
|
|
768
|
+
function De(s, e, t = {}) {
|
|
769
|
+
const i = { top: t.top ?? "#f3f4f6", left: t.left ?? "#9ca3af", right: t.right ?? "#4b5563" };
|
|
770
|
+
s.save(), s.lineJoin = "round";
|
|
771
|
+
for (const o of e)
|
|
772
|
+
s.beginPath(), o.points.forEach((n, a) => a === 0 ? s.moveTo(n.x, n.y) : s.lineTo(n.x, n.y)), s.closePath(), s.fillStyle = t.fill?.(o) ?? i[o.side], s.fill(), t.outline && (s.strokeStyle = t.outline, s.lineWidth = t.lineWidth ?? 2, s.stroke());
|
|
773
|
+
s.restore();
|
|
774
|
+
}
|
|
775
|
+
const E = "http://www.w3.org/2000/svg", Me = /* @__PURE__ */ new Set([
|
|
727
776
|
"fill",
|
|
728
777
|
"stroke",
|
|
729
778
|
"d",
|
|
@@ -743,7 +792,7 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
|
|
|
743
792
|
"height",
|
|
744
793
|
"viewBox",
|
|
745
794
|
"preserveAspectRatio"
|
|
746
|
-
]),
|
|
795
|
+
]), O = {
|
|
747
796
|
strokeWidth: "stroke-width",
|
|
748
797
|
strokeLinecap: "stroke-linecap",
|
|
749
798
|
strokeLinejoin: "stroke-linejoin",
|
|
@@ -754,7 +803,7 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
|
|
|
754
803
|
strokeOpacity: "stroke-opacity",
|
|
755
804
|
borderRadius: "rx"
|
|
756
805
|
// Map CSS borderRadius to SVG rx
|
|
757
|
-
},
|
|
806
|
+
}, Se = /* @__PURE__ */ new Set([
|
|
758
807
|
"x",
|
|
759
808
|
// Position x treated as translateX
|
|
760
809
|
"y",
|
|
@@ -775,8 +824,8 @@ const S = "http://www.w3.org/2000/svg", he = /* @__PURE__ */ new Set([
|
|
|
775
824
|
"motionPathX",
|
|
776
825
|
"motionPathY",
|
|
777
826
|
"motionPathRotate"
|
|
778
|
-
]),
|
|
779
|
-
class
|
|
827
|
+
]), Pe = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
|
|
828
|
+
class Ge {
|
|
780
829
|
targets = /* @__PURE__ */ new Map();
|
|
781
830
|
/**
|
|
782
831
|
* Register an SVG element as an animation target.
|
|
@@ -817,25 +866,25 @@ class Ae {
|
|
|
817
866
|
applyProperties(e, t) {
|
|
818
867
|
const i = {};
|
|
819
868
|
let o = null;
|
|
820
|
-
const
|
|
821
|
-
let
|
|
822
|
-
for (const [
|
|
823
|
-
|
|
869
|
+
const n = {}, a = {}, r = {};
|
|
870
|
+
let l = !1;
|
|
871
|
+
for (const [c, h] of t)
|
|
872
|
+
c !== "drawOn" && (Se.has(c) ? i[c] = h : c === "quaternion" ? o = ee(h) : c === "originX" || c === "originY" ? typeof h == "number" && (n[c] = h) : c === "perspective" ? typeof h == "number" && (i.perspective = h) : Pe.has(c) ? typeof h == "number" && (a[c] = h) : te.has(c) ? (r[c] = h, l = !0) : c === "text" ? typeof h == "string" && ie(e, h) : c === "shine" ? typeof h == "number" && this.applyShine(e, h) : c === "opacity" ? (e.setAttribute("fill-opacity", String(h)), e.setAttribute("stroke-opacity", String(h))) : this.applyAttribute(e, c, h));
|
|
824
873
|
if (Object.keys(i).length > 0 || o) {
|
|
825
|
-
const
|
|
826
|
-
e.style.transform =
|
|
874
|
+
const c = this.buildCssTransformString(i, o);
|
|
875
|
+
e.style.transform = c, oe(e);
|
|
827
876
|
}
|
|
828
|
-
if (Object.keys(
|
|
829
|
-
const
|
|
830
|
-
|
|
877
|
+
if (Object.keys(n).length > 0) {
|
|
878
|
+
const c = e.style;
|
|
879
|
+
c.transformBox = "fill-box", c.transformOrigin = `${n.originX ?? 50}% ${n.originY ?? 50}%`;
|
|
831
880
|
}
|
|
832
881
|
if (Object.keys(a).length > 0) {
|
|
833
|
-
const
|
|
834
|
-
e.style.clipPath = `inset(${
|
|
882
|
+
const c = a.clipTop ?? 0, h = a.clipRight ?? 0, f = a.clipBottom ?? 0, m = a.clipLeft ?? 0;
|
|
883
|
+
e.style.clipPath = `inset(${c}% ${h}% ${f}% ${m}%)`;
|
|
835
884
|
}
|
|
836
|
-
if (
|
|
837
|
-
const
|
|
838
|
-
|
|
885
|
+
if (l) {
|
|
886
|
+
const c = W(r);
|
|
887
|
+
c && (e.style.filter = c);
|
|
839
888
|
}
|
|
840
889
|
}
|
|
841
890
|
/**
|
|
@@ -844,14 +893,14 @@ class Ae {
|
|
|
844
893
|
buildCssTransformString(e, t = null) {
|
|
845
894
|
const i = [];
|
|
846
895
|
e.perspective !== void 0 && e.perspective > 0 && i.push(`perspective(${e.perspective}px)`);
|
|
847
|
-
const o = e.motionPathX ?? e.x ?? e.translateX,
|
|
848
|
-
e.z !== void 0 ? i.push(`translate3d(${o ?? 0}px, ${
|
|
896
|
+
const o = e.motionPathX ?? e.x ?? e.translateX, n = e.motionPathY ?? e.y ?? e.translateY;
|
|
897
|
+
e.z !== void 0 ? i.push(`translate3d(${o ?? 0}px, ${n ?? 0}px, ${e.z}px)`) : (o !== void 0 || n !== void 0) && i.push(`translate(${o ?? 0}px, ${n ?? 0}px)`);
|
|
849
898
|
const a = e.motionPathRotate ?? e.rotate ?? e.rotateZ;
|
|
850
899
|
if (a !== void 0 && i.push(`rotate(${a}deg)`), e.rotateX !== void 0 && i.push(`rotateX(${e.rotateX}deg)`), e.rotateY !== void 0 && i.push(`rotateY(${e.rotateY}deg)`), t && i.push(t), e.scale !== void 0)
|
|
851
900
|
i.push(`scale(${e.scale})`);
|
|
852
901
|
else if (e.scaleX !== void 0 || e.scaleY !== void 0) {
|
|
853
|
-
const r = e.scaleX ?? 1,
|
|
854
|
-
i.push(`scale(${r}, ${
|
|
902
|
+
const r = e.scaleX ?? 1, l = e.scaleY ?? 1;
|
|
903
|
+
i.push(`scale(${r}, ${l})`);
|
|
855
904
|
}
|
|
856
905
|
return e.skewX !== void 0 && i.push(`skewX(${e.skewX}deg)`), e.skewY !== void 0 && i.push(`skewY(${e.skewY}deg)`), i.join(" ");
|
|
857
906
|
}
|
|
@@ -866,27 +915,27 @@ class Ae {
|
|
|
866
915
|
applyShine(e, t) {
|
|
867
916
|
const i = e.ownerSVGElement, o = e.ownerDocument;
|
|
868
917
|
if (!i || !o) return;
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
const a =
|
|
918
|
+
const n = e;
|
|
919
|
+
n.dataset.shineBase || (n.dataset.shineBase = e.getAttribute("fill") || "#000000");
|
|
920
|
+
const a = n.dataset.shineBase;
|
|
872
921
|
let r = i.querySelector("defs");
|
|
873
|
-
r || (r = o.createElementNS(
|
|
874
|
-
let
|
|
875
|
-
for (
|
|
876
|
-
for (const h of
|
|
877
|
-
const f = o.createElementNS(
|
|
878
|
-
f.setAttribute("offset", String(h.offset)), f.setAttribute("stop-color", h.color),
|
|
922
|
+
r || (r = o.createElementNS(E, "defs"), i.insertBefore(r, i.firstChild));
|
|
923
|
+
let l = n.dataset.shineGrad, c = l ? r.querySelector(`#${l}`) : null;
|
|
924
|
+
for (c || (l = `tinyfly-shine-${Math.random().toString(36).slice(2, 9)}`, n.dataset.shineGrad = l, c = o.createElementNS(E, "linearGradient"), c.setAttribute("id", l), r.appendChild(c)); c.firstChild; ) c.removeChild(c.firstChild);
|
|
925
|
+
for (const h of H(t, a)) {
|
|
926
|
+
const f = o.createElementNS(E, "stop");
|
|
927
|
+
f.setAttribute("offset", String(h.offset)), f.setAttribute("stop-color", h.color), c.appendChild(f);
|
|
879
928
|
}
|
|
880
|
-
e.setAttribute("fill", `url(#${
|
|
929
|
+
e.setAttribute("fill", `url(#${l})`);
|
|
881
930
|
}
|
|
882
931
|
applyAttribute(e, t, i) {
|
|
883
932
|
let o = t;
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
e.setAttribute(o,
|
|
933
|
+
O[t] ? o = O[t] : Me.has(t) && (o = t);
|
|
934
|
+
const n = Array.isArray(i) ? i.join(" ") : String(i);
|
|
935
|
+
e.setAttribute(o, n);
|
|
887
936
|
}
|
|
888
937
|
}
|
|
889
|
-
const
|
|
938
|
+
const ge = `
|
|
890
939
|
attribute vec2 a_position;
|
|
891
940
|
attribute vec2 a_texCoord;
|
|
892
941
|
uniform mat4 u_matrix;
|
|
@@ -896,7 +945,7 @@ void main() {
|
|
|
896
945
|
gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
|
|
897
946
|
v_texCoord = a_texCoord;
|
|
898
947
|
}
|
|
899
|
-
`,
|
|
948
|
+
`, Re = `
|
|
900
949
|
precision mediump float;
|
|
901
950
|
uniform vec4 u_color;
|
|
902
951
|
uniform sampler2D u_texture;
|
|
@@ -907,7 +956,7 @@ void main() {
|
|
|
907
956
|
vec4 color = u_useTexture ? texture2D(u_texture, v_texCoord) : u_color;
|
|
908
957
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
909
958
|
}
|
|
910
|
-
`,
|
|
959
|
+
`, Ae = /* @__PURE__ */ new Set([
|
|
911
960
|
"x",
|
|
912
961
|
"y",
|
|
913
962
|
"width",
|
|
@@ -928,7 +977,7 @@ void main() {
|
|
|
928
977
|
"motionPathY",
|
|
929
978
|
"motionPathRotate"
|
|
930
979
|
]);
|
|
931
|
-
class
|
|
980
|
+
class We {
|
|
932
981
|
gl;
|
|
933
982
|
program;
|
|
934
983
|
positionBuffer;
|
|
@@ -939,7 +988,7 @@ class ge {
|
|
|
939
988
|
basePositions = /* @__PURE__ */ new Map();
|
|
940
989
|
locations;
|
|
941
990
|
constructor(e) {
|
|
942
|
-
this.gl = e, this.program =
|
|
991
|
+
this.gl = e, this.program = Ee(e, ge, Re), this.locations = {
|
|
943
992
|
position: e.getAttribLocation(this.program, "a_position"),
|
|
944
993
|
texCoord: e.getAttribLocation(this.program, "a_texCoord"),
|
|
945
994
|
matrix: e.getUniformLocation(this.program, "u_matrix"),
|
|
@@ -947,7 +996,7 @@ class ge {
|
|
|
947
996
|
texture: e.getUniformLocation(this.program, "u_texture"),
|
|
948
997
|
useTexture: e.getUniformLocation(this.program, "u_useTexture"),
|
|
949
998
|
opacity: e.getUniformLocation(this.program, "u_opacity")
|
|
950
|
-
}, this.positionBuffer =
|
|
999
|
+
}, this.positionBuffer = L(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), this.texCoordBuffer = L(e, [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]);
|
|
951
1000
|
}
|
|
952
1001
|
registerTarget(e, t) {
|
|
953
1002
|
this.targets.set(e, t), this.basePositions.set(e, { x: t.x, y: t.y });
|
|
@@ -968,9 +1017,9 @@ class ge {
|
|
|
968
1017
|
for (const [t, i] of e.values) {
|
|
969
1018
|
const o = this.targets.get(t);
|
|
970
1019
|
if (!o) continue;
|
|
971
|
-
const
|
|
1020
|
+
const n = this.basePositions.get(t) ?? { x: 0, y: 0 };
|
|
972
1021
|
for (const [a, r] of i)
|
|
973
|
-
this.applyProperty(o,
|
|
1022
|
+
this.applyProperty(o, n, a, r);
|
|
974
1023
|
}
|
|
975
1024
|
}
|
|
976
1025
|
applyProperty(e, t, i, o) {
|
|
@@ -987,7 +1036,7 @@ class ge {
|
|
|
987
1036
|
e.rotate = o;
|
|
988
1037
|
return;
|
|
989
1038
|
}
|
|
990
|
-
if (
|
|
1039
|
+
if (Ae.has(i)) {
|
|
991
1040
|
e[i] = o;
|
|
992
1041
|
return;
|
|
993
1042
|
}
|
|
@@ -997,61 +1046,61 @@ class ge {
|
|
|
997
1046
|
/** Draw every registered target. */
|
|
998
1047
|
render() {
|
|
999
1048
|
const e = this.gl, { width: t, height: i } = e.canvas;
|
|
1000
|
-
e.viewport(0, 0, t, i), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA), e.useProgram(this.program),
|
|
1001
|
-
for (const [o,
|
|
1002
|
-
this.drawTarget(o,
|
|
1049
|
+
e.viewport(0, 0, t, i), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA), e.useProgram(this.program), F(e, this.positionBuffer, this.locations.position), F(e, this.texCoordBuffer, this.locations.texCoord);
|
|
1050
|
+
for (const [o, n] of this.targets)
|
|
1051
|
+
this.drawTarget(o, n, t, i);
|
|
1003
1052
|
}
|
|
1004
1053
|
drawTarget(e, t, i, o) {
|
|
1005
|
-
const
|
|
1006
|
-
if (t.backfaceVisibility === "hidden" &&
|
|
1007
|
-
const a =
|
|
1008
|
-
if (
|
|
1009
|
-
|
|
1054
|
+
const n = this.gl;
|
|
1055
|
+
if (t.backfaceVisibility === "hidden" && G(V(t))) return;
|
|
1056
|
+
const a = ke(t, i, o);
|
|
1057
|
+
if (n.uniformMatrix4fv(this.locations.matrix, !1, a), n.uniform1f(this.locations.opacity, t.opacity ?? 1), t.texture)
|
|
1058
|
+
n.bindTexture(n.TEXTURE_2D, this.textureFor(e, t.texture)), n.uniform1i(this.locations.useTexture, 1), n.uniform1i(this.locations.texture, 0);
|
|
1010
1059
|
else {
|
|
1011
|
-
|
|
1012
|
-
const [r,
|
|
1013
|
-
|
|
1060
|
+
n.uniform1i(this.locations.useTexture, 0);
|
|
1061
|
+
const [r, l, c] = Ce(t.fill ?? "#ffffff");
|
|
1062
|
+
n.uniform4f(this.locations.color, r, l, c, 1);
|
|
1014
1063
|
}
|
|
1015
|
-
|
|
1064
|
+
n.drawArrays(n.TRIANGLES, 0, 6);
|
|
1016
1065
|
}
|
|
1017
1066
|
textureFor(e, t) {
|
|
1018
1067
|
const i = this.textures.get(e);
|
|
1019
1068
|
if (i) return i;
|
|
1020
|
-
const o = this.gl,
|
|
1021
|
-
return o.bindTexture(o.TEXTURE_2D,
|
|
1069
|
+
const o = this.gl, n = o.createTexture();
|
|
1070
|
+
return o.bindTexture(o.TEXTURE_2D, n), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, t), this.textures.set(e, n), n;
|
|
1022
1071
|
}
|
|
1023
1072
|
/** Release GL resources. */
|
|
1024
1073
|
destroy() {
|
|
1025
1074
|
this.clearTargets(), this.gl.deleteProgram(this.program), this.gl.deleteBuffer(this.positionBuffer), this.gl.deleteBuffer(this.texCoordBuffer);
|
|
1026
1075
|
}
|
|
1027
1076
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const i = (
|
|
1077
|
+
function Ne(s, e, t) {
|
|
1078
|
+
const i = (s.scale ?? s.scaleX ?? 1) * s.width, o = (s.scale ?? s.scaleY ?? 1) * s.height, n = (s.originX ?? 50) / 100, a = (s.originY ?? 50) / 100, r = (s.rotate ?? 0) * Math.PI / 180, l = Math.cos(r), c = Math.sin(r), h = -n, f = -a, m = l * i, d = c * i, p = -c * o, u = l * o, y = s.x + m * h + p * f, w = s.y + d * h + u * f, T = 2 / e, M = -2 / t;
|
|
1030
1079
|
return new Float32Array([
|
|
1031
|
-
m *
|
|
1032
|
-
|
|
1080
|
+
m * T,
|
|
1081
|
+
d * M,
|
|
1033
1082
|
0,
|
|
1034
|
-
p *
|
|
1035
|
-
|
|
1083
|
+
p * T,
|
|
1084
|
+
u * M,
|
|
1036
1085
|
0,
|
|
1037
|
-
y *
|
|
1038
|
-
w *
|
|
1086
|
+
y * T - 1,
|
|
1087
|
+
w * M + 1,
|
|
1039
1088
|
1
|
|
1040
1089
|
]);
|
|
1041
1090
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const e = (
|
|
1044
|
-
|
|
1045
|
-
|
|
1091
|
+
function V(s) {
|
|
1092
|
+
const e = (s.originX ?? 50) / 100, t = (s.originY ?? 50) / 100, i = { x: s.x, y: s.y }, o = v.multiply(
|
|
1093
|
+
v.translation([s.x, s.y, 0]),
|
|
1094
|
+
v.multiply(v.scaling([s.width, s.height, 1]), v.translation([-e, -t, 0]))
|
|
1046
1095
|
);
|
|
1047
|
-
return
|
|
1096
|
+
return v.multiply(D(s, { x: 0, y: 0 }, i), o);
|
|
1048
1097
|
}
|
|
1049
|
-
function
|
|
1098
|
+
function ke(s, e, t) {
|
|
1050
1099
|
const i = [2 / e, 0, 0, 0, 0, -2 / t, 0, 0, 0, 0, 0, 0, -1, 1, 0, 1];
|
|
1051
|
-
return new Float32Array(
|
|
1100
|
+
return new Float32Array(v.multiply(i, V(s)));
|
|
1052
1101
|
}
|
|
1053
|
-
function
|
|
1054
|
-
const e =
|
|
1102
|
+
function Ce(s) {
|
|
1103
|
+
const e = s.trim().replace("#", "");
|
|
1055
1104
|
return e.length === 3 ? [
|
|
1056
1105
|
Number.parseInt(e[0] + e[0], 16) / 255,
|
|
1057
1106
|
Number.parseInt(e[1] + e[1], 16) / 255,
|
|
@@ -1062,61 +1111,66 @@ function we(n) {
|
|
|
1062
1111
|
Number.parseInt(e.slice(4, 6), 16) / 255
|
|
1063
1112
|
] : [1, 1, 1];
|
|
1064
1113
|
}
|
|
1065
|
-
function
|
|
1066
|
-
const i =
|
|
1114
|
+
function Ee(s, e, t) {
|
|
1115
|
+
const i = s.createProgram();
|
|
1067
1116
|
if (!i) throw new Error("WebGLAdapter: could not create a program");
|
|
1068
|
-
if (
|
|
1069
|
-
throw new Error(`WebGLAdapter: program link failed — ${
|
|
1117
|
+
if (s.attachShader(i, B(s, s.VERTEX_SHADER, e)), s.attachShader(i, B(s, s.FRAGMENT_SHADER, t)), s.linkProgram(i), !s.getProgramParameter(i, s.LINK_STATUS))
|
|
1118
|
+
throw new Error(`WebGLAdapter: program link failed — ${s.getProgramInfoLog(i)}`);
|
|
1070
1119
|
return i;
|
|
1071
1120
|
}
|
|
1072
|
-
function
|
|
1073
|
-
const i =
|
|
1121
|
+
function B(s, e, t) {
|
|
1122
|
+
const i = s.createShader(e);
|
|
1074
1123
|
if (!i) throw new Error("WebGLAdapter: could not create a shader");
|
|
1075
|
-
if (
|
|
1076
|
-
throw new Error(`WebGLAdapter: shader compile failed — ${
|
|
1124
|
+
if (s.shaderSource(i, t), s.compileShader(i), !s.getShaderParameter(i, s.COMPILE_STATUS))
|
|
1125
|
+
throw new Error(`WebGLAdapter: shader compile failed — ${s.getShaderInfoLog(i)}`);
|
|
1077
1126
|
return i;
|
|
1078
1127
|
}
|
|
1079
|
-
function
|
|
1080
|
-
const t =
|
|
1128
|
+
function L(s, e) {
|
|
1129
|
+
const t = s.createBuffer();
|
|
1081
1130
|
if (!t) throw new Error("WebGLAdapter: could not create a buffer");
|
|
1082
|
-
return
|
|
1131
|
+
return s.bindBuffer(s.ARRAY_BUFFER, t), s.bufferData(s.ARRAY_BUFFER, new Float32Array(e), s.STATIC_DRAW), t;
|
|
1083
1132
|
}
|
|
1084
|
-
function
|
|
1085
|
-
t < 0 || (
|
|
1133
|
+
function F(s, e, t) {
|
|
1134
|
+
t < 0 || (s.bindBuffer(s.ARRAY_BUFFER, e), s.enableVertexAttribArray(t), s.vertexAttribPointer(t, 2, s.FLOAT, !1, 0, 0));
|
|
1086
1135
|
}
|
|
1087
1136
|
export {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1137
|
+
qe as CANVAS_PROPERTIES,
|
|
1138
|
+
I as CanvasAdapter,
|
|
1139
|
+
Ve as DOMAdapter,
|
|
1140
|
+
Ze as IDENTITY_CAMERA,
|
|
1141
|
+
Ge as SVGAdapter,
|
|
1142
|
+
We as WebGLAdapter,
|
|
1143
|
+
je as animatableProperties,
|
|
1144
|
+
Ye as applyBloom,
|
|
1145
|
+
Je as applyCamera,
|
|
1146
|
+
Le as applyZoomBlur,
|
|
1147
|
+
ot as boilFrame,
|
|
1148
|
+
Y as boxBlur,
|
|
1149
|
+
ye as brightPass,
|
|
1150
|
+
pe as buildFlipTracks,
|
|
1151
|
+
Qe as cameraFromValues,
|
|
1152
|
+
Ke as cameraPoint,
|
|
1153
|
+
k as canvasLike,
|
|
1154
|
+
et as checkTracks,
|
|
1155
|
+
tt as describeTarget,
|
|
1156
|
+
Fe as drawDiveLines,
|
|
1157
|
+
De as drawIsometricFaces,
|
|
1158
|
+
C as drawOutline,
|
|
1159
|
+
Oe as drawTrail,
|
|
1160
|
+
_e as flip,
|
|
1161
|
+
$e as isGradient,
|
|
1162
|
+
Be as nestedZoom,
|
|
1163
|
+
Te as nestedZoomTransform,
|
|
1164
|
+
Ce as parseColor,
|
|
1165
|
+
fe as partialPath,
|
|
1166
|
+
st as pathLength,
|
|
1113
1167
|
x as pathOutline,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1168
|
+
nt as pointAlong,
|
|
1169
|
+
Ne as quadMatrix,
|
|
1170
|
+
ke as quadMatrix3d,
|
|
1171
|
+
ue as recordFlipState,
|
|
1172
|
+
me as rectOutline,
|
|
1173
|
+
ie as setTextContent,
|
|
1174
|
+
de as sketchPen,
|
|
1175
|
+
be as trailQuads
|
|
1122
1176
|
};
|