motionary 10.7.0 → 10.8.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/CHANGELOG.md +20 -0
- package/README.md +42 -3
- package/dist/chunks/{anim-image-CFGpUX7t.cjs → anim-image-BzTQa2k3.cjs} +2 -2
- package/dist/chunks/{anim-image-CFGpUX7t.cjs.map → anim-image-BzTQa2k3.cjs.map} +1 -1
- package/dist/chunks/{anim-image-CXDD19FH.js → anim-image-iD646Q7i.js} +2 -2
- package/dist/chunks/{anim-image-CXDD19FH.js.map → anim-image-iD646Q7i.js.map} +1 -1
- package/dist/chunks/{keyframes-DwR6GPej.js → keyframes-B4zefz0k.js} +2 -2
- package/dist/chunks/{keyframes-DwR6GPej.js.map → keyframes-B4zefz0k.js.map} +1 -1
- package/dist/chunks/{keyframes-DdwGY1gr.cjs → keyframes-BlOyB1PP.cjs} +2 -2
- package/dist/chunks/{keyframes-DdwGY1gr.cjs.map → keyframes-BlOyB1PP.cjs.map} +1 -1
- package/dist/chunks/{registry-DhKZCitb.cjs → registry-BZxDVL3h.cjs} +2 -2
- package/dist/chunks/{registry-DhKZCitb.cjs.map → registry-BZxDVL3h.cjs.map} +1 -1
- package/dist/chunks/{registry-D87dP_aR.js → registry-Bkt3-3ET.js} +3 -3
- package/dist/chunks/{registry-D87dP_aR.js.map → registry-Bkt3-3ET.js.map} +1 -1
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs +38 -0
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs.map +1 -0
- package/dist/chunks/runtime-link-c13gskBZ.js +36 -0
- package/dist/chunks/runtime-link-c13gskBZ.js.map +1 -0
- package/dist/chunks/{ticker-jD9_A9Rh.cjs → ticker-BfxAECfO.cjs} +2 -2
- package/dist/chunks/{ticker-jD9_A9Rh.cjs.map → ticker-BfxAECfO.cjs.map} +1 -1
- package/dist/chunks/{ticker-CJYI5Pxc.js → ticker-ZtweD3U4.js} +2 -2
- package/dist/chunks/{ticker-CJYI5Pxc.js.map → ticker-ZtweD3U4.js.map} +1 -1
- package/dist/chunks/{tween-Dk0QmNe9.cjs → tween--MD-39y0.cjs} +2 -2
- package/dist/chunks/{tween-Dk0QmNe9.cjs.map → tween--MD-39y0.cjs.map} +1 -1
- package/dist/chunks/{tween-_Lld1MsF.js → tween-DACdkLyO.js} +2 -2
- package/dist/chunks/{tween-_Lld1MsF.js.map → tween-DACdkLyO.js.map} +1 -1
- package/dist/components/snap-carousel.cjs +216 -0
- package/dist/components/snap-carousel.cjs.map +1 -0
- package/dist/components/snap-carousel.d.cts +80 -0
- package/dist/components/snap-carousel.d.ts +80 -0
- package/dist/components/snap-carousel.js +214 -0
- package/dist/components/snap-carousel.js.map +1 -0
- package/dist/components/widgets.cjs +32 -46
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +77 -4
- package/dist/components/widgets.d.ts +77 -4
- package/dist/components/widgets.js +22 -36
- package/dist/components/widgets.js.map +1 -1
- package/dist/llms-full.txt +94 -6
- package/dist/llms.txt +6 -3
- package/dist/manifest.json +260 -19
- package/dist/runtime/drag-snap.cjs +269 -0
- package/dist/runtime/drag-snap.cjs.map +1 -0
- package/dist/runtime/drag-snap.d.cts +109 -0
- package/dist/runtime/drag-snap.d.ts +109 -0
- package/dist/runtime/drag-snap.iife.js +2 -0
- package/dist/runtime/drag-snap.iife.js.map +1 -0
- package/dist/runtime/drag-snap.js +261 -0
- package/dist/runtime/drag-snap.js.map +1 -0
- package/dist/runtime/format-apng.cjs +4 -4
- package/dist/runtime/format-apng.js +4 -4
- package/dist/runtime/format-css.cjs +4 -4
- package/dist/runtime/format-css.js +4 -4
- package/dist/runtime/format-gif.cjs +4 -4
- package/dist/runtime/format-gif.js +4 -4
- package/dist/runtime/format-gltf.cjs +37 -18
- package/dist/runtime/format-gltf.cjs.map +1 -1
- package/dist/runtime/format-gltf.d.cts +18 -2
- package/dist/runtime/format-gltf.d.ts +18 -2
- package/dist/runtime/format-gltf.iife.js +1 -1
- package/dist/runtime/format-gltf.iife.js.map +1 -1
- package/dist/runtime/format-gltf.js +37 -18
- package/dist/runtime/format-gltf.js.map +1 -1
- package/dist/runtime/format-motion.cjs +4 -4
- package/dist/runtime/format-motion.js +4 -4
- package/dist/runtime/format-obj.cjs +1 -1
- package/dist/runtime/format-obj.d.cts +2 -0
- package/dist/runtime/format-obj.d.ts +2 -0
- package/dist/runtime/format-obj.iife.js.map +1 -1
- package/dist/runtime/format-obj.js +1 -1
- package/dist/runtime/format-scene.cjs +1 -1
- package/dist/runtime/format-scene.js +1 -1
- package/dist/runtime/format-sprite.cjs +3 -3
- package/dist/runtime/format-sprite.js +3 -3
- package/dist/runtime/format-svg.cjs +3 -3
- package/dist/runtime/format-svg.js +3 -3
- package/dist/runtime/format-webp.cjs +4 -4
- package/dist/runtime/format-webp.js +4 -4
- package/dist/runtime/gl.cjs +17 -4
- package/dist/runtime/gl.cjs.map +1 -1
- package/dist/runtime/gl.d.cts +2 -0
- package/dist/runtime/gl.d.ts +2 -0
- package/dist/runtime/gl.iife.js +1 -1
- package/dist/runtime/gl.iife.js.map +1 -1
- package/dist/runtime/gl.js +17 -4
- package/dist/runtime/gl.js.map +1 -1
- package/dist/runtime/gltf-anim.cjs +251 -0
- package/dist/runtime/gltf-anim.cjs.map +1 -0
- package/dist/runtime/gltf-anim.d.cts +216 -0
- package/dist/runtime/gltf-anim.d.ts +216 -0
- package/dist/runtime/gltf-anim.iife.js +2 -0
- package/dist/runtime/gltf-anim.iife.js.map +1 -0
- package/dist/runtime/gltf-anim.js +243 -0
- package/dist/runtime/gltf-anim.js.map +1 -0
- package/dist/runtime/physics.cjs +1 -1
- package/dist/runtime/physics.js +1 -1
- package/dist/runtime/scroll.cjs +2 -2
- package/dist/runtime/scroll.js +2 -2
- package/dist/runtime/smooth.cjs +1 -1
- package/dist/runtime/smooth.js +1 -1
- package/dist/runtime/text.cjs +1 -1
- package/dist/runtime/text.js +1 -1
- package/dist/runtime/vector.cjs +421 -11
- package/dist/runtime/vector.cjs.map +1 -1
- package/dist/runtime/vector.d.cts +20 -4
- package/dist/runtime/vector.d.ts +20 -4
- package/dist/runtime/vector.iife.js +1 -1
- package/dist/runtime/vector.iife.js.map +1 -1
- package/dist/runtime/vector.js +421 -12
- package/dist/runtime/vector.js.map +1 -1
- package/dist/runtime.cjs +3 -3
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.iife.js +1 -1
- package/dist/runtime.iife.js.map +1 -1
- package/dist/runtime.js +5 -5
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/components/README.md +3 -2
- package/docs/components/usa-gl-scene.md +27 -6
- package/docs/components/usa-lottie-player.md +18 -0
- package/docs/components/usa-snap-carousel.md +68 -0
- package/docs/components.md +51 -3
- package/docs/runtime/drag-snap.md +60 -0
- package/docs/runtime/format-gltf.md +3 -2
- package/docs/runtime/gltf-anim.md +62 -0
- package/docs/runtime/vector.md +3 -2
- package/package.json +31 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-anim.js","sources":["../../src/runtime/gltf-anim.ts"],"sourcesContent":["/**\n * `motionary/runtime/gltf-anim` (10.8) — glTF 2.0 animation, skinning and\n * morph targets for models loaded by `motionary/runtime/format-gltf`\n * (own implementation; requires `use(gl, formatGltf, gltfAnim)`).\n *\n * - animation channels on node `translation` / `rotation` / `scale` /\n * `weights` with `LINEAR` (quaternions slerped), `STEP` and\n * `CUBICSPLINE` (Hermite with in / out tangents) samplers;\n * - morph targets (POSITION + NORMAL deltas) with mesh default weights,\n * node weights and animated weights;\n * - skins: joint hierarchy, inverse bind matrices, 4 joints / vertex\n * (JOINTS_0 / WEIGHTS_0), skinned on the CPU and re-uploaded each frame\n * (`geometry.version`), so it works with every runtime/gl material;\n * - `gltfAnimator(model)` plays a clip (by name or index) with loop / speed\n * / seek, `update(dt)` from your loop or `play()` on the shared ticker.\n *\n * Sampling and deformation are pure (SSR / workers / tests).\n */\nimport { RUNTIME_VERSION, requireModule, type RuntimeModule } from './registry';\nimport type { CoreApi } from './index';\nimport { mat4, quatSlerp, type GlNode, type Geometry, type Mat4, type Quat } from './gl';\n\ntype Num = number;\nexport type ChannelPath = 'translation' | 'rotation' | 'scale' | 'weights';\nexport type Interpolation = 'LINEAR' | 'STEP' | 'CUBICSPLINE';\nexport interface GltfChannel {\n node: GlNode;\n path: ChannelPath;\n interpolation: Interpolation;\n times: Float32Array;\n values: Float32Array;\n /** Components per key (3, 4 or the morph target count). */\n size: Num;\n}\nexport interface GltfClip {\n name: string;\n duration: Num;\n channels: GltfChannel[];\n}\n\n/** Morph / skin source data kept on a geometry by format-gltf (10.8). */\nexport interface DeformSource {\n positions: Float32Array;\n normals?: Float32Array;\n joints?: Float32Array;\n weights?: Float32Array;\n targets?: { positions?: Float32Array; normals?: Float32Array }[];\n}\n\nconst model = (root: GlNode): { gltf: any; nodes: GlNode[]; read: (i: Num) => Float32Array } => {\n const x = root.extras as any;\n if (!x?.gltf || !x.read) throw new Error('[motionary] gltf-anim: pass the node returned by loadGltf() / gltfToNode() (motionary/runtime/format-gltf 10.8+)');\n return x;\n};\n\n/** The animation clips of a loaded model. */\nexport function gltfClips(root: GlNode): GltfClip[] {\n const { gltf, nodes, read } = model(root);\n return (gltf.animations || []).map((a: any, ai: Num) => {\n let duration = 0;\n const channels: GltfChannel[] = [];\n for (const c of a.channels || []) {\n const node = nodes[c.target?.node];\n const s = a.samplers?.[c.sampler];\n if (!node || !s || !['translation', 'rotation', 'scale', 'weights'].includes(c.target.path)) continue; // KHR_animation_pointer etc.\n const times = read(s.input), values = read(s.output);\n const interpolation: Interpolation = s.interpolation || 'LINEAR';\n const size = values.length / times.length / (interpolation === 'CUBICSPLINE' ? 3 : 1);\n duration = Math.max(duration, times[times.length - 1] || 0);\n channels.push({ node, path: c.target.path, interpolation, times, values, size });\n }\n return { name: a.name || `animation${ai}`, duration, channels };\n });\n}\n\n/** Value of a channel at time `t` (seconds; clamped to the key range). */\nexport function sampleChannel(ch: GltfChannel, t: Num): Num[] {\n const { times: T, values: V, size: n } = ch;\n const cubic = ch.interpolation === 'CUBICSPLINE';\n const at = (k: Num) => Array.from(V.subarray((cubic ? k * 3 + 1 : k) * n, (cubic ? k * 3 + 1 : k) * n + n));\n const last = T.length - 1;\n if (t <= T[0] || last === 0) return at(0);\n if (t >= T[last]) return at(last);\n let k = 0;\n while (k < last - 1 && T[k + 1] <= t) k++;\n const td = T[k + 1] - T[k], s = (t - T[k]) / td;\n let out: Num[];\n if (ch.interpolation === 'STEP') return at(k);\n if (cubic) {\n const s2 = s * s, s3 = s2 * s;\n const h00 = 2 * s3 - 3 * s2 + 1, h10 = s3 - 2 * s2 + s, h01 = -2 * s3 + 3 * s2, h11 = s3 - s2;\n const p0 = k * 3 * n, p1 = (k + 1) * 3 * n;\n out = Array.from({ length: n }, (_, i) => h00 * V[p0 + n + i] + h10 * td * V[p0 + 2 * n + i] + h01 * V[p1 + n + i] + h11 * td * V[p1 + i]);\n if (ch.path === 'rotation') {\n const l = Math.hypot(...out) || 1;\n out = out.map((v) => v / l);\n }\n return out;\n }\n const a = at(k), b = at(k + 1);\n if (ch.path === 'rotation') return quatSlerp(a as Quat, b as Quat, s);\n return a.map((v, i) => v + (b[i] - v) * s);\n}\n\n/** Pose the model at time `t` of a clip (sets node TRS and morph weights). */\nexport function applyClip(clip: GltfClip, t: Num): void {\n for (const ch of clip.channels) {\n const v = sampleChannel(ch, t);\n const n = ch.node;\n if (ch.path === 'weights') n.extras.weights = v;\n else {\n n.matrix = null; // animated nodes are TRS (glTF spec)\n if (ch.path === 'translation') n.position = v as [Num, Num, Num];\n else if (ch.path === 'rotation') n.rotation = v as Quat;\n else n.scale = v as [Num, Num, Num];\n }\n }\n}\n\nconst meshesOf = (n: GlNode) => (n.mesh ? (Array.isArray(n.mesh) ? n.mesh : [n.mesh]) : []);\n\n/**\n * Apply morph weights and skins to every deformable mesh of the model\n * (call after posing; updates world matrices). Returns how many meshes changed.\n */\nexport function deformModel(root: GlNode): Num {\n const { gltf, nodes, read } = model(root);\n root.updateWorld();\n let changed = 0;\n const cache = ((root.extras as any).skinCache ||= {}) as Record<Num, { joints: GlNode[]; ibm: Mat4[] }>;\n for (const node of nodes) {\n const ms = meshesOf(node);\n if (!ms.length) continue;\n const si = node.extras.skin as Num | undefined;\n let jm: Mat4[] | null = null;\n if (si !== undefined && gltf.skins?.[si]) {\n const sk = gltf.skins[si];\n const c = (cache[si] ||= {\n joints: sk.joints.map((j: Num) => nodes[j]),\n ibm: sk.joints.map((_: Num, i: Num) => (sk.inverseBindMatrices !== undefined ? new Float32Array(read(sk.inverseBindMatrices).subarray(i * 16, i * 16 + 16)) : mat4.identity())),\n });\n const inv = mat4.invert(node.world) || mat4.identity();\n jm = c.joints.map((j, i) => mat4.multiply(inv, mat4.multiply(j.world, c.ibm[i])));\n }\n const w = (node.extras.weights as Num[] | undefined) || [];\n for (const m of ms) {\n const g = m.geometry as Geometry & { deform?: DeformSource };\n const src = g.deform;\n if (!src || (!jm && !src.targets?.length)) continue;\n deformGeometry(g, src, w, jm);\n changed++;\n }\n }\n return changed;\n}\n\n/** Morph + skin one geometry from its source data (pure). */\nexport function deformGeometry(g: Geometry, src: DeformSource, weights: Num[], joints: Mat4[] | null): void {\n const P = src.positions, N = src.normals, n = P.length / 3;\n const pos = g.positions !== P && g.positions.length === P.length ? g.positions : (g.positions = new Float32Array(P.length));\n const nrm = N ? (g.normals && g.normals !== N && g.normals.length === N.length ? g.normals : (g.normals = new Float32Array(N.length))) : null;\n pos.set(P);\n if (nrm && N) nrm.set(N);\n (src.targets || []).forEach((tg, k) => {\n const wk = weights[k] || 0;\n if (!wk) return;\n if (tg.positions) for (let i = 0; i < pos.length; i++) pos[i] += wk * tg.positions[i];\n if (tg.normals && nrm) for (let i = 0; i < nrm.length; i++) nrm[i] += wk * tg.normals[i];\n });\n if (joints && src.joints && src.weights) {\n const J = src.joints, W = src.weights, m = new Float32Array(16);\n for (let v = 0; v < n; v++) {\n m.fill(0);\n let tw = 0;\n for (let k = 0; k < 4; k++) {\n const wt = W[v * 4 + k];\n if (!wt) continue;\n const jm = joints[J[v * 4 + k]];\n if (!jm) continue;\n tw += wt;\n for (let e = 0; e < 16; e++) m[e] += wt * jm[e];\n }\n if (!tw) continue;\n const x = pos[v * 3], y = pos[v * 3 + 1], z = pos[v * 3 + 2];\n pos[v * 3] = m[0] * x + m[4] * y + m[8] * z + m[12];\n pos[v * 3 + 1] = m[1] * x + m[5] * y + m[9] * z + m[13];\n pos[v * 3 + 2] = m[2] * x + m[6] * y + m[10] * z + m[14];\n if (nrm) {\n const a = nrm[v * 3], b = nrm[v * 3 + 1], c = nrm[v * 3 + 2];\n const nx = m[0] * a + m[4] * b + m[8] * c, ny = m[1] * a + m[5] * b + m[9] * c, nz = m[2] * a + m[6] * b + m[10] * c;\n const l = Math.hypot(nx, ny, nz) || 1;\n nrm[v * 3] = nx / l;\n nrm[v * 3 + 1] = ny / l;\n nrm[v * 3 + 2] = nz / l;\n }\n }\n }\n g.version = (g.version || 0) + 1;\n}\n\nexport interface GltfAnimatorOptions {\n /** Clip name or index (default 0). */\n clip?: string | Num;\n loop?: boolean;\n speed?: Num;\n}\nexport interface GltfAnimator {\n readonly clips: GltfClip[];\n readonly clip: GltfClip | null;\n time: Num;\n speed: Num;\n loop: boolean;\n readonly playing: boolean;\n /** Switch clip (name or index); keeps playing state. */\n use(clip: string | Num): void;\n seek(t: Num): void;\n /** Advance by `dt` seconds and pose + deform. */\n update(dt: Num): void;\n /** Run on the shared ticker. */\n play(): void;\n pause(): void;\n dispose(): void;\n}\n\n/** A clip player for a loaded model. */\nexport function gltfAnimator(root: GlNode, o: GltfAnimatorOptions = {}): GltfAnimator {\n const clips = gltfClips(root);\n let clip: GltfClip | null = null, off: (() => void) | null = null;\n const pick = (c: string | Num) => (typeof c === 'number' ? clips[c] : clips.find((x) => x.name === c) || clips[Number(c)]) || null;\n const pose = () => {\n if (clip) applyClip(clip, a.time);\n deformModel(root);\n };\n const a: GltfAnimator = {\n clips,\n get clip() {\n return clip;\n },\n time: 0,\n speed: o.speed ?? 1,\n loop: o.loop ?? true,\n get playing() {\n return !!off;\n },\n use(c) {\n clip = pick(c);\n a.time = 0;\n pose();\n },\n seek(t) {\n const d = clip?.duration || 0;\n a.time = d ? (a.loop ? ((t % d) + d) % d : Math.min(d, Math.max(0, t))) : 0;\n pose();\n },\n update(dt) {\n a.seek(a.time + dt * a.speed);\n },\n play() {\n if (!off) off = requireModule<CoreApi>('core', 'motionary/runtime/gltf-anim').getTicker().add((_, ms) => a.update(Math.min(ms, 100) / 1000));\n },\n pause() {\n off?.();\n off = null;\n },\n dispose() {\n a.pause();\n },\n };\n clip = pick(o.clip ?? 0);\n pose();\n return a;\n}\n\nexport interface GltfAnimApi {\n gltfClips: typeof gltfClips;\n sampleChannel: typeof sampleChannel;\n applyClip: typeof applyClip;\n deformModel: typeof deformModel;\n deformGeometry: typeof deformGeometry;\n gltfAnimator: typeof gltfAnimator;\n}\n\nexport const gltfAnim: RuntimeModule<GltfAnimApi> = { id: 'gltf-anim', version: RUNTIME_VERSION, requires: ['core', 'gl', 'format-gltf'], api: { gltfClips, sampleChannel, applyClip, deformModel, deformGeometry, gltfAnimator } };\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AAgCH,MAAM,KAAK,GAAG,CAAC,IAAY,KAAoE;AAC7F,IAAA,MAAM,CAAC,GAAG,IAAI,CAAC,MAAa;IAC5B,IAAI,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC;AAC5J,IAAA,OAAO,CAAC;AACV,CAAC;AAED;AACM,SAAU,SAAS,CAAC,IAAY,EAAA;AACpC,IAAA,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAA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/dist/runtime/physics.cjs
CHANGED
package/dist/runtime/physics.js
CHANGED
package/dist/runtime/scroll.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var registry = require('../chunks/registry-
|
|
4
|
-
var ticker = require('../chunks/ticker-
|
|
3
|
+
var registry = require('../chunks/registry-BZxDVL3h.cjs');
|
|
4
|
+
var ticker = require('../chunks/ticker-BfxAECfO.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original
|
package/dist/runtime/scroll.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RUNTIME_VERSION } from '../chunks/registry-
|
|
2
|
-
import { g as getTicker } from '../chunks/ticker-
|
|
1
|
+
import { R as RUNTIME_VERSION } from '../chunks/registry-Bkt3-3ET.js';
|
|
2
|
+
import { g as getTicker } from '../chunks/ticker-ZtweD3U4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original
|
package/dist/runtime/smooth.cjs
CHANGED
package/dist/runtime/smooth.js
CHANGED
package/dist/runtime/text.cjs
CHANGED
package/dist/runtime/text.js
CHANGED
package/dist/runtime/vector.cjs
CHANGED
|
@@ -1,10 +1,321 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var registry = require('../chunks/registry-
|
|
4
|
-
var tween = require('../chunks/tween-
|
|
5
|
-
require('../chunks/ticker-
|
|
3
|
+
var registry = require('../chunks/registry-BZxDVL3h.cjs');
|
|
4
|
+
var tween = require('../chunks/tween--MD-39y0.cjs');
|
|
5
|
+
require('../chunks/ticker-BfxAECfO.cjs');
|
|
6
6
|
require('../chunks/ease-HwYZnZat.cjs');
|
|
7
7
|
|
|
8
|
+
const ALLOWED = new Set(['time', 'value', 'thisComp', 'thisLayer', 'thisProperty', 'Math', 'wiggle', 'loopOut', 'loopIn', 'loopOutDuration', 'loopInDuration', 'linear', 'ease', 'easeIn', 'easeOut', 'clamp', 'valueAtTime', 'framesToTime', 'timeToFrames', 'degreesToRadians', 'radiansToDegrees', 'add', 'sub', 'mul', 'div', 'length', 'true', 'false', '$bm_rt', 'index']);
|
|
9
|
+
function lex(src) {
|
|
10
|
+
const t = [];
|
|
11
|
+
const re = /\s*(?:(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|(\d+\.?\d*(?:e[+-]?\d+)?|\.\d+)|("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|([A-Za-z_$][\w$]*)|(===|!==|==|!=|<=|>=|&&|\|\||[-+*/%()[\],.;=<>!?:{}]))/gy;
|
|
12
|
+
let m, at = 0;
|
|
13
|
+
while (at < src.length) {
|
|
14
|
+
re.lastIndex = at;
|
|
15
|
+
if (!(m = re.exec(src)))
|
|
16
|
+
break;
|
|
17
|
+
at = re.lastIndex;
|
|
18
|
+
if (m[1])
|
|
19
|
+
continue;
|
|
20
|
+
const tok = m[2] || m[3] || m[4] || m[5];
|
|
21
|
+
if (tok)
|
|
22
|
+
t.push(m[2] ? '#' + tok : m[3] ? '"' + m[3].slice(1, -1) : tok);
|
|
23
|
+
}
|
|
24
|
+
if (src.slice(at).trim())
|
|
25
|
+
throw new Error('expr: unexpected ' + src.slice(at, at + 10));
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
/** Compile an expression to an AST (throws on anything outside the subset). */
|
|
29
|
+
function compileExpression(src) {
|
|
30
|
+
const T = lex(src);
|
|
31
|
+
let i = 0;
|
|
32
|
+
const peek = () => T[i], next = () => T[i++];
|
|
33
|
+
const eat = (s) => {
|
|
34
|
+
if (T[i] !== s)
|
|
35
|
+
throw new Error(`expr: expected ${s} got ${T[i]}`);
|
|
36
|
+
i++;
|
|
37
|
+
};
|
|
38
|
+
const declared = new Set();
|
|
39
|
+
const prim = () => {
|
|
40
|
+
const k = next();
|
|
41
|
+
if (k === undefined)
|
|
42
|
+
throw new Error('expr: unexpected end');
|
|
43
|
+
if (k[0] === '#')
|
|
44
|
+
return ['n', +k.slice(1)];
|
|
45
|
+
if (k[0] === '"')
|
|
46
|
+
return ['s', k.slice(1)];
|
|
47
|
+
if (k === '(') {
|
|
48
|
+
const e = expr();
|
|
49
|
+
eat(')');
|
|
50
|
+
return e;
|
|
51
|
+
}
|
|
52
|
+
if (k === '[') {
|
|
53
|
+
const a = [];
|
|
54
|
+
while (peek() !== ']') {
|
|
55
|
+
a.push(expr());
|
|
56
|
+
if (peek() === ',')
|
|
57
|
+
next();
|
|
58
|
+
}
|
|
59
|
+
eat(']');
|
|
60
|
+
return ['arr', a];
|
|
61
|
+
}
|
|
62
|
+
if (/^[A-Za-z_$]/.test(k)) {
|
|
63
|
+
if (!ALLOWED.has(k) && !declared.has(k))
|
|
64
|
+
throw new Error('expr: unsupported ' + k);
|
|
65
|
+
return ['id', k];
|
|
66
|
+
}
|
|
67
|
+
throw new Error('expr: unexpected ' + k);
|
|
68
|
+
};
|
|
69
|
+
const post = () => {
|
|
70
|
+
let e = prim();
|
|
71
|
+
for (;;) {
|
|
72
|
+
if (peek() === '.') {
|
|
73
|
+
next();
|
|
74
|
+
e = ['get', e, ['s', next()]];
|
|
75
|
+
}
|
|
76
|
+
else if (peek() === '[') {
|
|
77
|
+
next();
|
|
78
|
+
e = ['get', e, expr()];
|
|
79
|
+
eat(']');
|
|
80
|
+
}
|
|
81
|
+
else if (peek() === '(') {
|
|
82
|
+
next();
|
|
83
|
+
const a = [];
|
|
84
|
+
while (peek() !== ')') {
|
|
85
|
+
a.push(expr());
|
|
86
|
+
if (peek() === ',')
|
|
87
|
+
next();
|
|
88
|
+
}
|
|
89
|
+
eat(')');
|
|
90
|
+
e = ['call', e, a];
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
return e;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const un = () => (peek() === '-' || peek() === '+' || peek() === '!' ? ['un', next(), un()] : post());
|
|
97
|
+
const bin = (ops, sub) => () => {
|
|
98
|
+
let e = sub();
|
|
99
|
+
while (ops.includes(peek()))
|
|
100
|
+
e = ['bin', next(), e, sub()];
|
|
101
|
+
return e;
|
|
102
|
+
};
|
|
103
|
+
const mul = bin(['*', '/', '%'], un), add = bin(['+', '-'], mul), cmp = bin(['<', '>', '<=', '>='], add), eq = bin(['==', '!=', '===', '!=='], cmp), and = bin(['&&'], eq), or = bin(['||'], and);
|
|
104
|
+
const expr = () => {
|
|
105
|
+
const c = or();
|
|
106
|
+
if (peek() !== '?')
|
|
107
|
+
return c;
|
|
108
|
+
next();
|
|
109
|
+
const a = expr();
|
|
110
|
+
eat(':');
|
|
111
|
+
return ['if', c, a, expr()];
|
|
112
|
+
};
|
|
113
|
+
const stmts = [];
|
|
114
|
+
while (i < T.length) {
|
|
115
|
+
if (peek() === ';') {
|
|
116
|
+
next();
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (['var', 'let', 'const'].includes(peek())) {
|
|
120
|
+
next();
|
|
121
|
+
const name = next();
|
|
122
|
+
declared.add(name);
|
|
123
|
+
eat('=');
|
|
124
|
+
stmts.push(['set', name, expr()]);
|
|
125
|
+
}
|
|
126
|
+
else if (/^[A-Za-z_$]/.test(peek() || '') && T[i + 1] === '=') {
|
|
127
|
+
const name = next();
|
|
128
|
+
next();
|
|
129
|
+
declared.add(name);
|
|
130
|
+
stmts.push(['set', name, expr()]);
|
|
131
|
+
}
|
|
132
|
+
else
|
|
133
|
+
stmts.push(expr());
|
|
134
|
+
}
|
|
135
|
+
if (!stmts.length)
|
|
136
|
+
throw new Error('expr: empty');
|
|
137
|
+
return ['prog', stmts];
|
|
138
|
+
}
|
|
139
|
+
// ------------------------------------------------------------------ values
|
|
140
|
+
const isA = Array.isArray;
|
|
141
|
+
const zip = (a, b, f) => (isA(a) && isA(b) ? Array.from({ length: Math.max(a.length, b.length) }, (_, i) => f(a[i] ?? 0, b[i] ?? 0)) : isA(a) ? a.map((x) => f(x, b)) : isA(b) ? b.map((y) => f(a, y)) : f(a, b));
|
|
142
|
+
const vadd = (a, b) => (typeof a === 'string' || typeof b === 'string' ? String(a) + String(b) : zip(a, b, (x, y) => x + y));
|
|
143
|
+
const vsub = (a, b) => zip(a, b, (x, y) => x - y);
|
|
144
|
+
const vmul = (a, b) => zip(a, b, (x, y) => x * y);
|
|
145
|
+
const vdiv = (a, b) => zip(a, b, (x, y) => x / y);
|
|
146
|
+
const lerpV = (a, b, p) => vadd(a, vmul(vsub(b, a), p));
|
|
147
|
+
// smooth 1D value noise in [-1, 1]
|
|
148
|
+
const hash = (n) => {
|
|
149
|
+
const s = Math.sin(n * 127.1 + 311.7) * 43758.5453;
|
|
150
|
+
return (s - Math.floor(s)) * 2 - 1;
|
|
151
|
+
};
|
|
152
|
+
const noise = (x) => {
|
|
153
|
+
const i = Math.floor(x), f = x - i, u = f * f * (3 - 2 * f);
|
|
154
|
+
return hash(i) * (1 - u) + hash(i + 1) * u;
|
|
155
|
+
};
|
|
156
|
+
function remap(ease, args) {
|
|
157
|
+
const [t, a, b, c, d] = args;
|
|
158
|
+
let tMin = 0, tMax = 1, v1, v2;
|
|
159
|
+
if (args.length >= 5)
|
|
160
|
+
(tMin = a), (tMax = b), (v1 = c), (v2 = d);
|
|
161
|
+
else
|
|
162
|
+
(v1 = a), (v2 = b);
|
|
163
|
+
const p = tMax === tMin ? (t >= tMax ? 1 : 0) : Math.min(1, Math.max(0, (t - tMin) / (tMax - tMin)));
|
|
164
|
+
return lerpV(v1, v2, ease(tMax < tMin ? 1 - p : p));
|
|
165
|
+
}
|
|
166
|
+
function loop(c, out, type = 'cycle', n = 0, dur = 0) {
|
|
167
|
+
const K = c.keys, f = c.time * c.fr;
|
|
168
|
+
if (K.length < 2)
|
|
169
|
+
return c.value;
|
|
170
|
+
const first = K[0], last = K[K.length - 1];
|
|
171
|
+
let a = out ? (n > 0 ? K[Math.max(0, K.length - 1 - n)] : first) : first;
|
|
172
|
+
let b = out ? last : n > 0 ? K[Math.min(K.length - 1, n)] : last;
|
|
173
|
+
if (dur > 0)
|
|
174
|
+
out ? (a = last - dur * c.fr) : (b = first + dur * c.fr);
|
|
175
|
+
if (out ? f <= b : f >= a)
|
|
176
|
+
return c.value;
|
|
177
|
+
const d = b - a || 1;
|
|
178
|
+
if (type === 'continue') {
|
|
179
|
+
const e = out ? b : a, v = c.at(e), slope = out ? vsub(v, c.at(e - 1)) : vsub(c.at(e + 1), v);
|
|
180
|
+
return vadd(v, vmul(slope, f - e));
|
|
181
|
+
}
|
|
182
|
+
const over = out ? f - b : a - f, k = Math.floor(over / d), r = over - k * d;
|
|
183
|
+
if (type === 'pingpong')
|
|
184
|
+
return c.at(out ? (k % 2 ? a + r : b - r) : k % 2 ? b - r : a + r);
|
|
185
|
+
const base = c.at(out ? a + r : b - r);
|
|
186
|
+
if (type === 'offset')
|
|
187
|
+
return vadd(base, vmul(vsub(c.at(b), c.at(a)), out ? k + 1 : -(k + 1)));
|
|
188
|
+
return base; // cycle
|
|
189
|
+
}
|
|
190
|
+
/** Evaluate a compiled expression. */
|
|
191
|
+
function runExpression(ast, c) {
|
|
192
|
+
const vars = {};
|
|
193
|
+
const fr = c.fr;
|
|
194
|
+
const lib = {
|
|
195
|
+
Math,
|
|
196
|
+
thisComp: { frameDuration: 1 / fr },
|
|
197
|
+
thisLayer: {},
|
|
198
|
+
thisProperty: { value: c.value },
|
|
199
|
+
index: 1,
|
|
200
|
+
true: true,
|
|
201
|
+
false: false,
|
|
202
|
+
wiggle: (freq, amp, oct = 1, mult = 0.5, t = c.time) => {
|
|
203
|
+
const w = (d) => {
|
|
204
|
+
let s = 0, a = 1, fq = freq, tot = 0;
|
|
205
|
+
for (let o = 0; o < Math.max(1, oct); o++)
|
|
206
|
+
(s += a * noise(t * fq + c.seed * 13.7 + d * 101.3)), (tot += a), (a *= mult), (fq *= 2);
|
|
207
|
+
return s / tot;
|
|
208
|
+
};
|
|
209
|
+
return isA(c.value) ? c.value.map((v, d) => v + (isA(amp) ? amp[d] ?? 0 : amp) * w(d)) : c.value + amp * w(0);
|
|
210
|
+
},
|
|
211
|
+
loopOut: (t, n) => loop(c, true, t, n),
|
|
212
|
+
loopIn: (t, n) => loop(c, false, t, n),
|
|
213
|
+
loopOutDuration: (t, d) => loop(c, true, t, 0, d),
|
|
214
|
+
loopInDuration: (t, d) => loop(c, false, t, 0, d),
|
|
215
|
+
linear: (...a) => remap((p) => p, a),
|
|
216
|
+
ease: (...a) => remap((p) => p * p * (3 - 2 * p), a),
|
|
217
|
+
easeIn: (...a) => remap((p) => p * p, a),
|
|
218
|
+
easeOut: (...a) => remap((p) => 1 - (1 - p) * (1 - p), a),
|
|
219
|
+
clamp: (v, lo, hi) => zip(zip(v, lo, Math.max), hi, Math.min),
|
|
220
|
+
valueAtTime: (t) => c.at(t * fr),
|
|
221
|
+
framesToTime: (f) => f / fr,
|
|
222
|
+
timeToFrames: (t = c.time) => t * fr,
|
|
223
|
+
degreesToRadians: (d) => (d * Math.PI) / 180,
|
|
224
|
+
radiansToDegrees: (r) => (r * 180) / Math.PI,
|
|
225
|
+
add: vadd,
|
|
226
|
+
sub: vsub,
|
|
227
|
+
mul: vmul,
|
|
228
|
+
div: vdiv,
|
|
229
|
+
length: (a, b) => {
|
|
230
|
+
const d = b === undefined ? a : vsub(a, b);
|
|
231
|
+
return isA(d) ? Math.hypot(...d) : Math.abs(d);
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const ev = (n) => {
|
|
235
|
+
switch (n[0]) {
|
|
236
|
+
case 'n':
|
|
237
|
+
case 's':
|
|
238
|
+
return n[1];
|
|
239
|
+
case 'arr':
|
|
240
|
+
return n[1].map(ev);
|
|
241
|
+
case 'id': {
|
|
242
|
+
const k = n[1];
|
|
243
|
+
if (k in vars)
|
|
244
|
+
return vars[k];
|
|
245
|
+
if (k === 'time')
|
|
246
|
+
return c.time;
|
|
247
|
+
if (k === 'value')
|
|
248
|
+
return c.value;
|
|
249
|
+
return lib[k];
|
|
250
|
+
}
|
|
251
|
+
case 'get': {
|
|
252
|
+
const o = ev(n[1]), k = ev(n[2]);
|
|
253
|
+
if (o === null || o === undefined || (typeof k === 'string' && /^(__proto__|constructor|prototype)$/.test(k)))
|
|
254
|
+
throw new Error('expr: bad member');
|
|
255
|
+
if (o === Math && typeof k === 'string' && !(k in Math))
|
|
256
|
+
throw new Error('expr: Math.' + k);
|
|
257
|
+
return o[k];
|
|
258
|
+
}
|
|
259
|
+
case 'call': {
|
|
260
|
+
const f = ev(n[1]);
|
|
261
|
+
if (typeof f !== 'function')
|
|
262
|
+
throw new Error('expr: not a function');
|
|
263
|
+
return f(...n[2].map(ev));
|
|
264
|
+
}
|
|
265
|
+
case 'un': {
|
|
266
|
+
const v = ev(n[2]);
|
|
267
|
+
return n[1] === '-' ? vmul(v, -1) : n[1] === '!' ? !v : v;
|
|
268
|
+
}
|
|
269
|
+
case 'bin': {
|
|
270
|
+
const a = ev(n[2]), b = ev(n[3]);
|
|
271
|
+
switch (n[1]) {
|
|
272
|
+
case '+': return vadd(a, b);
|
|
273
|
+
case '-': return vsub(a, b);
|
|
274
|
+
case '*': return vmul(a, b);
|
|
275
|
+
case '/': return vdiv(a, b);
|
|
276
|
+
case '%': return zip(a, b, (x, y) => x % y);
|
|
277
|
+
case '<': return a < b;
|
|
278
|
+
case '>': return a > b;
|
|
279
|
+
case '<=': return a <= b;
|
|
280
|
+
case '>=': return a >= b;
|
|
281
|
+
case '==':
|
|
282
|
+
case '===': return a === b;
|
|
283
|
+
case '!=':
|
|
284
|
+
case '!==': return a !== b;
|
|
285
|
+
case '&&': return a && b;
|
|
286
|
+
default: return a || b;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
case 'if':
|
|
290
|
+
return ev(n[1]) ? ev(n[2]) : ev(n[3]);
|
|
291
|
+
case 'set':
|
|
292
|
+
return (vars[n[1]] = ev(n[2]));
|
|
293
|
+
default: {
|
|
294
|
+
let r;
|
|
295
|
+
for (const s of n[1])
|
|
296
|
+
r = ev(s);
|
|
297
|
+
return '$bm_rt' in vars ? vars.$bm_rt : r;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
return ev(ast);
|
|
302
|
+
}
|
|
303
|
+
const cache = new Map();
|
|
304
|
+
/** Compile (cached); null when outside the subset. */
|
|
305
|
+
function expression(src) {
|
|
306
|
+
if (!cache.has(src)) {
|
|
307
|
+
let ast = null;
|
|
308
|
+
try {
|
|
309
|
+
ast = compileExpression(src);
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
ast = null;
|
|
313
|
+
}
|
|
314
|
+
cache.set(src, ast);
|
|
315
|
+
}
|
|
316
|
+
return cache.get(src);
|
|
317
|
+
}
|
|
318
|
+
|
|
8
319
|
/**
|
|
9
320
|
* `motionary/runtime/vector` (10.6) — a Lottie (bodymovin JSON) + dotLottie
|
|
10
321
|
* player written for Motionary (own renderer on Canvas 2D; no lottie-web
|
|
@@ -27,8 +338,12 @@ require('../chunks/ease-HwYZnZat.cjs');
|
|
|
27
338
|
* `DecompressionStream`), `manifest.json` v1 / v2, several animations,
|
|
28
339
|
* embedded images.
|
|
29
340
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
341
|
+
* 10.8: **text layers** (system / web fonts by family + style, justification,
|
|
342
|
+
* tracking, line height, fill + stroke, box text with wrapping, source-text
|
|
343
|
+
* keyframes and expressions) and an **expression subset** (see
|
|
344
|
+
* `lottie-expr.ts`: time, value, wiggle, loopOut / loopIn, linear / ease,
|
|
345
|
+
* Math…; no eval). Not supported (documented): 3D layers, effects, text
|
|
346
|
+
* animators, glyph outlines (`chars`), merge paths, repeaters. `lottiePlayer()` is a
|
|
32
347
|
* runtime timeline (seek, reverse, scrub with `progress`, markers → labels).
|
|
33
348
|
*/
|
|
34
349
|
// ------------------------------------------------------------------ keyframes
|
|
@@ -60,10 +375,29 @@ const lerpAny = (a, b, p) => {
|
|
|
60
375
|
return { c: a.c, v: lerpAny(a.v, b.v, p), i: lerpAny(a.i, b.i, p), o: lerpAny(a.o, b.o, p) };
|
|
61
376
|
return a;
|
|
62
377
|
};
|
|
63
|
-
|
|
378
|
+
let FR = 30; // frame rate of the composition being rendered (expressions)
|
|
379
|
+
const seedOf = (s) => Array.from(s).reduce((h, c) => (h * 31 + c.charCodeAt(0)) % 9973, 7);
|
|
380
|
+
const isKeyed = (p) => !!(p.a || (Array.isArray(p.k) && p.k.length && typeof p.k[0] === 'object' && 't' in p.k[0]));
|
|
381
|
+
/** Run a property's expression (10.8 subset) on its keyframed value; the value itself when there is none or it is unsupported. */
|
|
382
|
+
function withExpr(p, f, v) {
|
|
383
|
+
const ast = typeof p.x === 'string' ? expression(p.x) : null;
|
|
384
|
+
if (!ast)
|
|
385
|
+
return v;
|
|
386
|
+
try {
|
|
387
|
+
const r = runExpression(ast, { time: f / FR, value: v, fr: FR, at: (g) => keyValue(p, g), keys: isKeyed(p) ? p.k.map((k) => k.t) : [], seed: seedOf(p.x) });
|
|
388
|
+
return r === undefined || (typeof r === 'number' && !isFinite(r)) ? v : r;
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
return v;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/** Value of an (animated or static) property at frame `f` (10.8: with its expression applied). */
|
|
64
395
|
function propValue(p, f, fallback) {
|
|
65
396
|
if (!p)
|
|
66
397
|
return fallback;
|
|
398
|
+
return withExpr(p, f, keyValue(p, f));
|
|
399
|
+
}
|
|
400
|
+
function keyValue(p, f) {
|
|
67
401
|
if (!p.a && !(Array.isArray(p.k) && p.k.length && typeof p.k[0] === 'object' && 't' in p.k[0]))
|
|
68
402
|
return p.k;
|
|
69
403
|
const ks = p.k;
|
|
@@ -432,6 +766,9 @@ function drawLayers(ctx, anim, layers, f, o, base, w, h, depth = 0) {
|
|
|
432
766
|
for (const p of ops)
|
|
433
767
|
paint(x, p, lf);
|
|
434
768
|
}
|
|
769
|
+
else if (L.ty === 5) {
|
|
770
|
+
drawText(x, anim, L, lf, m);
|
|
771
|
+
}
|
|
435
772
|
else if (L.ty === 1) {
|
|
436
773
|
x.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
437
774
|
x.fillStyle = L.sc || '#000';
|
|
@@ -483,9 +820,66 @@ function drawLayers(ctx, anim, layers, f, o, base, w, h, depth = 0) {
|
|
|
483
820
|
}
|
|
484
821
|
}
|
|
485
822
|
}
|
|
823
|
+
// ------------------------------------------------------------------ text layers (10.8)
|
|
824
|
+
function textDoc(L, f) {
|
|
825
|
+
const d = L.t?.d;
|
|
826
|
+
let s = d?.k?.[0]?.s;
|
|
827
|
+
for (const k of d?.k || [])
|
|
828
|
+
if (k.t <= f)
|
|
829
|
+
s = k.s;
|
|
830
|
+
if (s && typeof d.x === 'string')
|
|
831
|
+
s = { ...s, t: String(withExpr({ k: s.t, x: d.x }, f, s.t)) };
|
|
832
|
+
return s;
|
|
833
|
+
}
|
|
834
|
+
function drawText(x, anim, L, f, m) {
|
|
835
|
+
const d = textDoc(L, f);
|
|
836
|
+
if (!d)
|
|
837
|
+
return;
|
|
838
|
+
x.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
839
|
+
const font = anim.fonts?.list?.find((q) => q.fName === d.f);
|
|
840
|
+
const st = (font?.fStyle || d.f || '').toLowerCase();
|
|
841
|
+
const wt = /black|heavy/.test(st) ? 900 : /extra ?bold/.test(st) ? 800 : /semi ?bold|demi/.test(st) ? 600 : /bold/.test(st) ? 700 : /medium/.test(st) ? 500 : /light/.test(st) ? 300 : /thin/.test(st) ? 100 : 400;
|
|
842
|
+
x.font = `${/italic|oblique/.test(st) ? 'italic ' : ''}${wt} ${d.s}px ${font?.fFamily ? `"${font.fFamily}", ` : ''}sans-serif`;
|
|
843
|
+
x.textAlign = d.j === 1 ? 'right' : d.j === 2 ? 'center' : 'left';
|
|
844
|
+
x.textBaseline = 'alphabetic';
|
|
845
|
+
if ('letterSpacing' in x)
|
|
846
|
+
x.letterSpacing = `${((d.tr || 0) * d.s) / 1000}px`;
|
|
847
|
+
const lh = d.lh || d.s * 1.2;
|
|
848
|
+
let lines = String(d.t ?? '').split(/\r\n|\r|\n|\u0003/);
|
|
849
|
+
let ox = 0, oy = 0;
|
|
850
|
+
if (d.sz) {
|
|
851
|
+
// box text: wrap to the box width; `ps` is the box's top-left
|
|
852
|
+
const bw = d.sz[0], [px, py] = d.ps || [0, 0];
|
|
853
|
+
lines = lines.flatMap((ln) => {
|
|
854
|
+
const out = [];
|
|
855
|
+
let cur = '';
|
|
856
|
+
for (const w of ln.split(' ')) {
|
|
857
|
+
const t = cur ? cur + ' ' + w : w;
|
|
858
|
+
if (cur && x.measureText(t).width > bw)
|
|
859
|
+
out.push(cur), (cur = w);
|
|
860
|
+
else
|
|
861
|
+
cur = t;
|
|
862
|
+
}
|
|
863
|
+
return out.concat(cur);
|
|
864
|
+
});
|
|
865
|
+
ox = px + (d.j === 1 ? bw : d.j === 2 ? bw / 2 : 0);
|
|
866
|
+
oy = py + d.s;
|
|
867
|
+
}
|
|
868
|
+
const fill = d.fc ? col(d.fc) : null, stroke = d.sc && d.sw ? col(d.sc) : null;
|
|
869
|
+
lines.forEach((ln, i) => {
|
|
870
|
+
const y = oy + i * lh;
|
|
871
|
+
const F = () => fill && ((x.fillStyle = fill), x.fillText(ln, ox, y));
|
|
872
|
+
const S = () => stroke && ((x.strokeStyle = stroke), (x.lineWidth = d.sw), (x.lineJoin = 'round'), x.strokeText(ln, ox, y));
|
|
873
|
+
if (d.of)
|
|
874
|
+
F(), S();
|
|
875
|
+
else
|
|
876
|
+
S(), F();
|
|
877
|
+
});
|
|
878
|
+
}
|
|
486
879
|
/** Render one frame onto a 2D context sized `width × height` (the animation is fitted with `fit`). */
|
|
487
880
|
function renderLottieFrame(ctx, anim, frame, o = {}) {
|
|
488
881
|
const W = o.width ?? ctx.canvas.width, H = o.height ?? ctx.canvas.height;
|
|
882
|
+
FR = anim.fr || 30;
|
|
489
883
|
ctx.save();
|
|
490
884
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
491
885
|
ctx.clearRect(0, 0, W, H);
|
|
@@ -527,16 +921,21 @@ function inspectLottie(anim) {
|
|
|
527
921
|
u.add('3D layers');
|
|
528
922
|
if (l.ef?.length)
|
|
529
923
|
u.add('effects');
|
|
530
|
-
if (l.ty === 5)
|
|
531
|
-
u.add('text
|
|
924
|
+
if (l.ty === 5 && l.t?.a?.length)
|
|
925
|
+
u.add('text animators (range selectors)');
|
|
532
926
|
if (l.tt === 3 || l.tt === 4)
|
|
533
927
|
u.add('luma mattes (approximated by alpha)');
|
|
534
|
-
|
|
535
|
-
|
|
928
|
+
JSON.stringify([l.ks, l.t, l.shapes], (k, v) => {
|
|
929
|
+
if (k === 'x' && typeof v === 'string' && !expression(v))
|
|
930
|
+
u.add('expressions outside the supported subset');
|
|
931
|
+
return v;
|
|
932
|
+
});
|
|
536
933
|
walkShapes(l.shapes || []);
|
|
537
934
|
});
|
|
538
935
|
walk(anim.layers);
|
|
539
936
|
anim.assets?.forEach((a) => a.layers && walk(a.layers));
|
|
937
|
+
if (anim.chars?.length)
|
|
938
|
+
u.add('glyph outlines (chars): drawn with system fonts');
|
|
540
939
|
return { layers: anim.layers.length, unsupported: [...u] };
|
|
541
940
|
}
|
|
542
941
|
/** Read a zip archive's entries (central directory; stored + deflate). Pure; inflating uses `DecompressionStream`. */
|
|
@@ -687,9 +1086,20 @@ class LPlayer extends tween.Playable {
|
|
|
687
1086
|
function lottiePlayer(canvas, animation, o = {}) {
|
|
688
1087
|
return new LPlayer(canvas, animation, o);
|
|
689
1088
|
}
|
|
1089
|
+
/** Evaluate a Lottie expression (10.8 subset) on a value at `time` seconds — `undefined` when it is outside the subset. */
|
|
1090
|
+
function evalExpression(src, value, time = 0, fr = 30) {
|
|
1091
|
+
const ast = expression(src);
|
|
1092
|
+
try {
|
|
1093
|
+
return ast ? runExpression(ast, { time, value, fr, at: () => value, keys: [], seed: seedOf(src) }) : undefined;
|
|
1094
|
+
}
|
|
1095
|
+
catch {
|
|
1096
|
+
return undefined;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
690
1099
|
/** The module object for `use(vector)`. */
|
|
691
|
-
const vector = { id: 'vector', version: registry.RUNTIME_VERSION, requires: ['core'], api: { loadLottie, parseDotLottie, unzipEntries, lottiePlayer, renderLottieFrame, inspectLottie, propValue, transformAt, trimContours, loadLottieImages } };
|
|
1100
|
+
const vector = { id: 'vector', version: registry.RUNTIME_VERSION, requires: ['core'], api: { evalExpression, loadLottie, parseDotLottie, unzipEntries, lottiePlayer, renderLottieFrame, inspectLottie, propValue, transformAt, trimContours, loadLottieImages } };
|
|
692
1101
|
|
|
1102
|
+
exports.evalExpression = evalExpression;
|
|
693
1103
|
exports.inspectLottie = inspectLottie;
|
|
694
1104
|
exports.loadLottie = loadLottie;
|
|
695
1105
|
exports.loadLottieImages = loadLottieImages;
|