@pixerate/editor 0.248.0 → 0.250.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 +1 -0
- package/dist/animation-editor/index.cjs +118 -114
- package/dist/animation-editor/index.js +11 -7
- package/dist/{brushstrokeRender-QLCXROJK.js → brushstrokeRender-2FHFLSEG.js} +8 -4
- package/dist/{brushstrokeRender-DTDPFBLC.cjs → brushstrokeRender-QGRXOKDA.cjs} +15 -11
- package/dist/canvas/index.cjs +71 -15
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +58 -2
- package/dist/canvas/stickers.d.cts +35 -0
- package/dist/canvas/stickers.d.ts +35 -0
- package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
- package/dist/{chunk-SC2RZ5EF.js → chunk-2VJAVXLI.js} +2 -2
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/{chunk-ZFSLEOSQ.js → chunk-3TWOCSCY.js} +11 -9
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-4JNWA3VT.cjs +302 -0
- package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
- package/dist/chunk-ATK6ABN3.cjs +303 -0
- package/dist/{chunk-7T7JWTVE.cjs → chunk-BOHDJJ2O.cjs} +8 -8
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/{chunk-6G6ZDDDB.cjs → chunk-GT77U7QG.cjs} +303 -149
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
- package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-Q2HA52V4.js → chunk-KDLBJ6QR.js} +2 -2
- package/dist/{chunk-WVS5KQDH.cjs → chunk-M2VKFE5L.cjs} +246 -244
- package/dist/{chunk-5GLYUSNT.js → chunk-NOHJP5TK.js} +1 -1
- package/dist/{chunk-XNRBMYNB.js → chunk-NTRAVM2I.js} +1 -1
- package/dist/{chunk-VNBUDVD4.js → chunk-OTEPAQJX.js} +228 -74
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
- package/dist/{chunk-NZ3O3A5C.js → chunk-SMSGP2HQ.js} +1 -1
- package/dist/chunk-SZTI6EER.js +13 -0
- package/dist/chunk-U4NUOKBT.js +303 -0
- package/dist/chunk-U67EN7GG.cjs +13 -0
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/chunk-WKH5ZAUA.js +302 -0
- package/dist/{chunk-L6REDLNB.cjs → chunk-WPUXGDH4.cjs} +7 -7
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/{chunk-IBDU6EGZ.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
- package/dist/{chunk-XWTRATIM.cjs → chunk-YM6ZBTXG.cjs} +23 -23
- package/dist/{chunk-TPWB4Y6L.cjs → chunk-YW43M56C.cjs} +1 -1
- package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
- package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
- package/dist/effects/helpers.d.cts +6 -0
- package/dist/effects/helpers.d.ts +6 -0
- package/dist/effects/index.cjs +62 -60
- package/dist/effects/index.js +5 -3
- package/dist/effects/tools.d.cts +6 -0
- package/dist/effects/tools.d.ts +6 -0
- package/dist/image-editor/effects.d.cts +1 -1
- package/dist/image-editor/effects.d.ts +1 -1
- package/dist/image-editor/index.cjs +1097 -1069
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +58 -30
- package/dist/image-editor/stickers.d.cts +9 -0
- package/dist/image-editor/stickers.d.ts +9 -0
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +37 -1
- package/dist/paint-editor/controller.d.ts +37 -1
- package/dist/paint-editor/index.cjs +753 -609
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +187 -43
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/ui.d.cts +10 -2
- package/dist/paint-editor/ui.d.ts +10 -2
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.js +12 -10
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +337 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +337 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +81 -0
- package/dist/stickers/tools.d.ts +81 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +1018 -981
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +44 -7
- package/dist/vector/stickers.d.cts +11 -0
- package/dist/vector/stickers.d.ts +11 -0
- package/dist/video-editor/index.cjs +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +8 -5
- package/skills/pixerate-stickers/SKILL.md +57 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkX7WRL5ZZcjs = require('../chunk-X7WRL5ZZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ var _chunkDGWOGQJ5cjs = require('../chunk-DGWOGQJ5.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkZ3BRH4JKcjs = require('../chunk-Z3BRH4JK.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -39,8 +39,9 @@ var _chunkK5DS2JTAcjs = require('../chunk-K5DS2JTA.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../chunk-
|
|
42
|
+
var _chunkWPUXGDH4cjs = require('../chunk-WPUXGDH4.cjs');
|
|
43
|
+
require('../chunk-GT77U7QG.cjs');
|
|
44
|
+
require('../chunk-4JNWA3VT.cjs');
|
|
44
45
|
require('../chunk-CVFAAZXE.cjs');
|
|
45
46
|
|
|
46
47
|
|
|
@@ -50,6 +51,7 @@ require('../chunk-CVFAAZXE.cjs');
|
|
|
50
51
|
|
|
51
52
|
var _chunkGF2RBSDMcjs = require('../chunk-GF2RBSDM.cjs');
|
|
52
53
|
require('../chunk-NM3G4VQT.cjs');
|
|
54
|
+
require('../chunk-U67EN7GG.cjs');
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
@@ -69,11 +71,13 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
69
71
|
|
|
70
72
|
|
|
71
73
|
|
|
72
|
-
var
|
|
74
|
+
var _chunkISIO63Q5cjs = require('../chunk-ISIO63Q5.cjs');
|
|
73
75
|
require('../chunk-WOFXZ3XU.cjs');
|
|
74
|
-
require('../chunk-
|
|
76
|
+
require('../chunk-I7NJPHWV.cjs');
|
|
77
|
+
require('../chunk-3K6HWEXZ.cjs');
|
|
75
78
|
require('../chunk-YQGCPL5X.cjs');
|
|
76
|
-
require('../chunk-
|
|
79
|
+
require('../chunk-2VX55NFM.cjs');
|
|
80
|
+
require('../chunk-W5M3J7PV.cjs');
|
|
77
81
|
require('../chunk-474IQG74.cjs');
|
|
78
82
|
require('../chunk-XFM3OCHU.cjs');
|
|
79
83
|
require('../chunk-NIBFDFYW.cjs');
|
|
@@ -502,11 +506,11 @@ function shotLayersShapeProblems(shot, name) {
|
|
|
502
506
|
if (layer.effect === void 0 && layer.subject === void 0) problems.push(`${where} needs an "effect", a "subject" or both.`);
|
|
503
507
|
if (layer.effect !== void 0 && (typeof layer.effect !== "string" || !layer.effect)) problems.push(`${where}: "effect" must be an effect id.`);
|
|
504
508
|
if (layer.subject !== void 0) {
|
|
505
|
-
const kind =
|
|
509
|
+
const kind = _chunkZ3BRH4JKcjs.effectSubjectKind.call(void 0, layer.subject);
|
|
506
510
|
if (kind === "video") problems.push(`${where}: an animation layer cannot play a video; use { "image" }, { "svg" }, { "text" } or { "slot" } (the video editor plays video).`);
|
|
507
511
|
else if (!kind || !String(layer.subject[kind]).trim()) problems.push(`${where}: "subject" must be { "image": url }, { "svg": markup }, { "text": words } or { "slot": name }.`);
|
|
508
512
|
}
|
|
509
|
-
if (layer.role !== void 0 && !
|
|
513
|
+
if (layer.role !== void 0 && !_chunkISIO63Q5cjs.EFFECT_LAYER_ROLES.includes(layer.role)) problems.push(`${where}: "role" must be one of ${_chunkISIO63Q5cjs.EFFECT_LAYER_ROLES.join(", ")}.`);
|
|
510
514
|
if (layer.rect !== void 0) {
|
|
511
515
|
const r = layer.rect;
|
|
512
516
|
if (!isObject(r) || !["x", "y", "width", "height"].every((k) => isNum(r[k])) || !(r.width > 0 && r.height > 0)) problems.push(`${where}: "rect" must be { x, y, width, height } in artwork units, width and height > 0.`);
|
|
@@ -698,7 +702,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
698
702
|
function motionTextLayout(nodes, id) {
|
|
699
703
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
700
704
|
if (!group || group.type !== "group") return null;
|
|
701
|
-
const letters =
|
|
705
|
+
const letters = _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, group).map((p) => ({ id: p.id, b: _optionalChain([nodes, 'access', _8 => _8.get, 'call', _9 => _9(p.id), 'optionalAccess', _10 => _10.bounds]) })).filter((l) => !!l.b && l.b.width + l.b.height > 0);
|
|
702
706
|
if (!letters.length) return null;
|
|
703
707
|
const lines = [];
|
|
704
708
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -783,21 +787,21 @@ function indexMotionNodes(nodes) {
|
|
|
783
787
|
const out = /* @__PURE__ */ new Map();
|
|
784
788
|
const walk = (list, parentWorld, ancestors) => {
|
|
785
789
|
for (const node of list) {
|
|
786
|
-
const local =
|
|
787
|
-
const bounds =
|
|
790
|
+
const local = _chunkWPUXGDH4cjs.vectorNodeBounds.call(void 0, node);
|
|
791
|
+
const bounds = _chunkWPUXGDH4cjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
788
792
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
789
793
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
790
|
-
if (node.type === "group") walk(node.children,
|
|
794
|
+
if (node.type === "group") walk(node.children, _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
791
795
|
}
|
|
792
796
|
};
|
|
793
|
-
walk(nodes,
|
|
797
|
+
walk(nodes, _chunkWPUXGDH4cjs.IDENTITY_MATRIX, []);
|
|
794
798
|
indexCache.set(nodes, out);
|
|
795
799
|
return out;
|
|
796
800
|
}
|
|
797
801
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
798
802
|
function firstPaint(node, key) {
|
|
799
803
|
if (node.type === "path") return solid(node[key]);
|
|
800
|
-
for (const p of
|
|
804
|
+
for (const p of _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node)) {
|
|
801
805
|
const s = solid(p[key]);
|
|
802
806
|
if (s) return s;
|
|
803
807
|
}
|
|
@@ -805,7 +809,7 @@ function firstPaint(node, key) {
|
|
|
805
809
|
}
|
|
806
810
|
function strokeReach(node) {
|
|
807
811
|
let reach = 0;
|
|
808
|
-
for (const p of node.type === "path" ? [node] :
|
|
812
|
+
for (const p of node.type === "path" ? [node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node)) {
|
|
809
813
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
810
814
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
811
815
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -875,7 +879,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
875
879
|
case "stroke":
|
|
876
880
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
877
881
|
case "strokeWidth": {
|
|
878
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
882
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
879
883
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
880
884
|
}
|
|
881
885
|
case "shape":
|
|
@@ -986,12 +990,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
986
990
|
const r = camera;
|
|
987
991
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
988
992
|
}
|
|
989
|
-
function motionPathLength(node, parentWorld =
|
|
993
|
+
function motionPathLength(node, parentWorld = _chunkWPUXGDH4cjs.IDENTITY_MATRIX) {
|
|
990
994
|
let longest = 0;
|
|
991
|
-
const paths = node.type === "path" ? [node] :
|
|
995
|
+
const paths = node.type === "path" ? [node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node);
|
|
992
996
|
for (const p of paths) {
|
|
993
997
|
try {
|
|
994
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
998
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
995
999
|
} catch (e2) {
|
|
996
1000
|
}
|
|
997
1001
|
}
|
|
@@ -1127,9 +1131,9 @@ function compileMotionScene(scene) {
|
|
|
1127
1131
|
const start = t;
|
|
1128
1132
|
let cursor = start;
|
|
1129
1133
|
const f = motionShotTimeScale(shot);
|
|
1130
|
-
const moveIn = shot.camera ?
|
|
1131
|
-
const transitionMs = index > 0 && shot.transition ? (_nullishCoalesce(shot.transition.ms, () => (
|
|
1132
|
-
const moveDuring = shot.camera ?
|
|
1134
|
+
const moveIn = shot.camera ? _chunkISIO63Q5cjs.cameraMoveParts.call(void 0, shot.camera.in) : void 0;
|
|
1135
|
+
const transitionMs = index > 0 && shot.transition ? (_nullishCoalesce(shot.transition.ms, () => ( _chunkISIO63Q5cjs.EFFECT_TRANSITION_MS))) * f : 0;
|
|
1136
|
+
const moveDuring = shot.camera ? _chunkISIO63Q5cjs.cameraMoveParts.call(void 0, shot.camera.during) : void 0;
|
|
1133
1137
|
let playsIn = false;
|
|
1134
1138
|
if (shot.camera) {
|
|
1135
1139
|
const framed = motionCameraFramed(shot.camera);
|
|
@@ -1267,12 +1271,12 @@ function compileMotionScene(scene) {
|
|
|
1267
1271
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1268
1272
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1269
1273
|
if (order2 === "together" && pace === "time") return null;
|
|
1270
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1274
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, entry.node);
|
|
1271
1275
|
let list = paths.map((p) => {
|
|
1272
1276
|
const at = nodes.get(p.id);
|
|
1273
1277
|
let first = { x: 0, y: 0 };
|
|
1274
1278
|
try {
|
|
1275
|
-
const m =
|
|
1279
|
+
const m = _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunkWPUXGDH4cjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1276
1280
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1277
1281
|
} catch (e3) {
|
|
1278
1282
|
}
|
|
@@ -1384,17 +1388,17 @@ function compileMotionScene(scene) {
|
|
|
1384
1388
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1385
1389
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1386
1390
|
if (command3.to) {
|
|
1387
|
-
const inv =
|
|
1388
|
-
const target =
|
|
1391
|
+
const inv = _chunkWPUXGDH4cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1392
|
+
const target = _chunkWPUXGDH4cjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1389
1393
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1390
1394
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1391
1395
|
}
|
|
1392
1396
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1393
|
-
const inv =
|
|
1397
|
+
const inv = _chunkWPUXGDH4cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1394
1398
|
const x0 = num2("x");
|
|
1395
1399
|
const y0 = num2("y");
|
|
1396
1400
|
const add = command3.blend === "add";
|
|
1397
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1401
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkWPUXGDH4cjs.applyMatrix.call(void 0, inv, p)).map((p) => ({ x: p.x - entry.center.x - x0, y: p.y - entry.center.y - y0 })), { x: dx, y: dy }];
|
|
1398
1402
|
const times = _optionalChain([command3, 'access', _51 => _51.times, 'optionalAccess', _52 => _52.length]) === command3.via.length ? [start, ...command3.times.map((f) => start + f * (end - start)), end] : smoothMotionTimes(offsets, start, end - start, _nullishCoalesce(command3.pacing, () => ( "even")));
|
|
1399
1403
|
for (const axis of ["x", "y"]) {
|
|
1400
1404
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -1498,7 +1502,7 @@ function motionShotAt(timeline, time) {
|
|
|
1498
1502
|
// src/animation-editor/camera.ts
|
|
1499
1503
|
var windowCache = /* @__PURE__ */ new WeakMap();
|
|
1500
1504
|
function motionShotCameraMove(shot, role) {
|
|
1501
|
-
return
|
|
1505
|
+
return _chunkISIO63Q5cjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'optionalAccess', _55 => _55.camera, 'optionalAccess', _56 => _56[role === "transition" ? "in" : "during"]]));
|
|
1502
1506
|
}
|
|
1503
1507
|
var motionCameraStage = (scene) => ({ width: scene.artwork.width, height: scene.artwork.height });
|
|
1504
1508
|
var effectsPlayCamera = (provider) => !!provider && provider.capabilities.supportsCamera === true && typeof provider.cameraView === "function";
|
|
@@ -1520,7 +1524,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1520
1524
|
const track = timeline.tracks.get(motionTrackKey("", "camera"));
|
|
1521
1525
|
const boxView = (t) => {
|
|
1522
1526
|
const b = trackValue(track, t);
|
|
1523
|
-
return
|
|
1527
|
+
return _chunkISIO63Q5cjs.cameraViewOfBox.call(void 0, Array.isArray(b) ? { x: b[0], y: b[1], width: b[2], height: b[3] } : full, stage);
|
|
1524
1528
|
};
|
|
1525
1529
|
const view = (move, values, from, to, u, ms2) => {
|
|
1526
1530
|
try {
|
|
@@ -1536,7 +1540,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1536
1540
|
const eases = timing.commandsStart > timing.start && !!_optionalChain([track, 'optionalAccess', _57 => _57.some, 'call', _58 => _58((seg) => seg.shot === timing.id)]);
|
|
1537
1541
|
const framed = !!_optionalChain([track, 'optionalAccess', _59 => _59.some, 'call', _60 => _60((seg) => seg.shot === timing.id)]);
|
|
1538
1542
|
if (timing.cameraIn && timing.commandsStart > timing.start) {
|
|
1539
|
-
const spec =
|
|
1543
|
+
const spec = _chunkISIO63Q5cjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'access', _61 => _61.camera, 'optionalAccess', _62 => _62.in]));
|
|
1540
1544
|
const from = _nullishCoalesce(carry, () => ( boxView(timing.start)));
|
|
1541
1545
|
const to = boxView(timing.commandsStart);
|
|
1542
1546
|
if (view(spec.move, spec.values, from, to, 0, timing.commandsStart - timing.start)) {
|
|
@@ -1548,7 +1552,7 @@ function motionCameraWindows(scene, provider) {
|
|
|
1548
1552
|
carry = null;
|
|
1549
1553
|
} else if (framed) carry = null;
|
|
1550
1554
|
if (timing.cameraDuring && timing.end > timing.commandsEnd) {
|
|
1551
|
-
const spec =
|
|
1555
|
+
const spec = _chunkISIO63Q5cjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'access', _63 => _63.camera, 'optionalAccess', _64 => _64.during]));
|
|
1552
1556
|
const from = _nullishCoalesce(carry, () => ( boxView(timing.commandsEnd)));
|
|
1553
1557
|
const ms2 = timing.end - timing.commandsEnd;
|
|
1554
1558
|
const last = view(spec.move, spec.values, from, from, 1, ms2);
|
|
@@ -1565,8 +1569,8 @@ var lerp = (a, b, t) => a + (b - a) * t;
|
|
|
1565
1569
|
var smooth = (t) => t * t * (3 - 2 * t);
|
|
1566
1570
|
function easeViews(from, to, u, stage) {
|
|
1567
1571
|
const k = smooth(Math.min(1, Math.max(0, u)));
|
|
1568
|
-
const a =
|
|
1569
|
-
const b =
|
|
1572
|
+
const a = _chunkISIO63Q5cjs.cameraBoxOfView.call(void 0, from, stage);
|
|
1573
|
+
const b = _chunkISIO63Q5cjs.cameraBoxOfView.call(void 0, to, stage);
|
|
1570
1574
|
const zoom = from.zoom * Math.pow(to.zoom / from.zoom, k);
|
|
1571
1575
|
const cx = lerp(a.x + a.width / 2, b.x + b.width / 2, k);
|
|
1572
1576
|
const cy = lerp(a.y + a.height / 2, b.y + b.height / 2, k);
|
|
@@ -1598,7 +1602,7 @@ function motionCameraViewAt(scene, time, provider) {
|
|
|
1598
1602
|
return retaken ? null : before.after;
|
|
1599
1603
|
}
|
|
1600
1604
|
function motionCameraBox(view, scene) {
|
|
1601
|
-
return
|
|
1605
|
+
return _chunkISIO63Q5cjs.cameraBoxOfView.call(void 0, view, motionCameraStage(scene));
|
|
1602
1606
|
}
|
|
1603
1607
|
function motionCameraTransform(view, width) {
|
|
1604
1608
|
if (!view || !view.tilt && !view.turn) return "";
|
|
@@ -1639,7 +1643,7 @@ async function checkMotionCameraMoves(scene, provider) {
|
|
|
1639
1643
|
const spec = shot.camera[field];
|
|
1640
1644
|
if (spec === void 0) continue;
|
|
1641
1645
|
try {
|
|
1642
|
-
await
|
|
1646
|
+
await _chunkISIO63Q5cjs.resolveCameraMoveSpec.call(void 0, provider, spec, role);
|
|
1643
1647
|
} catch (error) {
|
|
1644
1648
|
const code = error.code === "invalid_values" || /preset/.test(error.message) ? "camera-move-values" : "camera-move-unknown";
|
|
1645
1649
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, code, error.message, { shot: shot.id }));
|
|
@@ -1667,7 +1671,7 @@ function motionLayerSpans(scene) {
|
|
|
1667
1671
|
(_nullishCoalesce(shot.layers, () => ( []))).forEach((layer, index) => {
|
|
1668
1672
|
const start = at(shotIndex2, layer.from, shots[shotIndex2].start);
|
|
1669
1673
|
const end = Math.max(start, at(shotIndex2, _nullishCoalesce(layer.until, () => ( { shots: 1 })), total));
|
|
1670
|
-
out.push({ layer, shot: shot.id, shotIndex: shotIndex2, index, role:
|
|
1674
|
+
out.push({ layer, shot: shot.id, shotIndex: shotIndex2, index, role: _chunkZ3BRH4JKcjs.effectLayerRole.call(void 0, layer), start, end });
|
|
1671
1675
|
});
|
|
1672
1676
|
});
|
|
1673
1677
|
spanCache.set(scene, out);
|
|
@@ -1762,7 +1766,7 @@ var MotionLayersEngine = (_class = class {
|
|
|
1762
1766
|
__init6() {this.generation = 0}
|
|
1763
1767
|
|
|
1764
1768
|
constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);
|
|
1765
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1769
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkISIO63Q5cjs.EffectsSlot)()));
|
|
1766
1770
|
this.host = _nullishCoalesce(options.host, () => ( null));
|
|
1767
1771
|
this.frameSvg = options.frameSvg;
|
|
1768
1772
|
this.options = { scale: _nullishCoalesce(options.scale, () => ( 1)), maxSize: _nullishCoalesce(options.maxSize, () => ( 1280)), fps: _nullishCoalesce(options.fps, () => ( 30)), maxEntries: _nullishCoalesce(options.maxEntries, () => ( 160)) };
|
|
@@ -1882,8 +1886,8 @@ var MotionLayersEngine = (_class = class {
|
|
|
1882
1886
|
const effect = layer.effect;
|
|
1883
1887
|
this.request(key, { layer: layer.id }, async () => {
|
|
1884
1888
|
const d = await this.describe(effect);
|
|
1885
|
-
const values =
|
|
1886
|
-
const input =
|
|
1889
|
+
const values = _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, layer.values);
|
|
1890
|
+
const input = _chunkZ3BRH4JKcjs.effectLayerInput.call(void 0, d);
|
|
1887
1891
|
const inputs = layer.subject && input ? { [input]: await this.subjectPixels(layer.subject, size) } : void 0;
|
|
1888
1892
|
const pixels = await this.pool.render(provider, effect, size, { time, values, ...inputs ? { inputs } : {} });
|
|
1889
1893
|
return host.encode(pixels);
|
|
@@ -1904,7 +1908,7 @@ var MotionLayersEngine = (_class = class {
|
|
|
1904
1908
|
const fromKey = `from:${sceneId(scene)}:${active.shot}:${size.width}x${size.height}`;
|
|
1905
1909
|
this.request(key, { transition: active.shot }, async () => {
|
|
1906
1910
|
const d = await this.describe(t.effect);
|
|
1907
|
-
const values =
|
|
1911
|
+
const values = _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, t.values);
|
|
1908
1912
|
frameSvg(scene, Math.max(0, active.start - 1e-3));
|
|
1909
1913
|
frameSvg(scene, at);
|
|
1910
1914
|
await this.idleExcept(key);
|
|
@@ -2017,13 +2021,13 @@ function morphBetween(a, b) {
|
|
|
2017
2021
|
let inner = morphCache.get(a);
|
|
2018
2022
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2019
2023
|
let morph = inner.get(b);
|
|
2020
|
-
if (!morph) inner.set(b, morph =
|
|
2024
|
+
if (!morph) inner.set(b, morph = _chunkX7WRL5ZZcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2021
2025
|
return morph;
|
|
2022
2026
|
}
|
|
2023
2027
|
function shapeIn(entry, shape) {
|
|
2024
2028
|
if (shape === entry) return entry.node;
|
|
2025
|
-
const m =
|
|
2026
|
-
return { ...shape.node, ...
|
|
2029
|
+
const m = _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkWPUXGDH4cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2030
|
+
return { ...shape.node, ..._chunkWPUXGDH4cjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2027
2031
|
}
|
|
2028
2032
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2029
2033
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2043,7 +2047,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2043
2047
|
function motionFollowRoute(entry, path) {
|
|
2044
2048
|
if (!path || path.node.type !== "path") return null;
|
|
2045
2049
|
try {
|
|
2046
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2050
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkWPUXGDH4cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2047
2051
|
} catch (e6) {
|
|
2048
2052
|
return null;
|
|
2049
2053
|
}
|
|
@@ -2077,9 +2081,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2077
2081
|
const scaleX = read("scaleX", 1);
|
|
2078
2082
|
const scaleY = read("scaleY", 1);
|
|
2079
2083
|
const c = entry.center;
|
|
2080
|
-
let matrix =
|
|
2084
|
+
let matrix = _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkWPUXGDH4cjs.rotateMatrix.call(void 0, rotation, c)), _chunkWPUXGDH4cjs.translateMatrix.call(void 0, dx, dy));
|
|
2081
2085
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2082
|
-
if (along) matrix =
|
|
2086
|
+
if (along) matrix = _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, matrix, _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkWPUXGDH4cjs.rotateMatrix.call(void 0, along.angle)), _chunkWPUXGDH4cjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2083
2087
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2084
2088
|
}
|
|
2085
2089
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2146,7 +2150,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2146
2150
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2147
2151
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2148
2152
|
if (start > 0 || end < 1) {
|
|
2149
|
-
const trim =
|
|
2153
|
+
const trim = _chunkWPUXGDH4cjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2150
2154
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2151
2155
|
}
|
|
2152
2156
|
}
|
|
@@ -2160,8 +2164,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2160
2164
|
if (o >= 1) delete out.opacity;
|
|
2161
2165
|
}
|
|
2162
2166
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2163
|
-
if (offset && !
|
|
2164
|
-
const m =
|
|
2167
|
+
if (offset && !_chunkWPUXGDH4cjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2168
|
+
const m = _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2165
2169
|
out = { ...out, transform: m };
|
|
2166
2170
|
}
|
|
2167
2171
|
return out;
|
|
@@ -2182,8 +2186,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2182
2186
|
const wrap = { ...options.wrap };
|
|
2183
2187
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2184
2188
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2185
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2186
|
-
const art =
|
|
2189
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunkWPUXGDH4cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2190
|
+
const art = _chunkWPUXGDH4cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2187
2191
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2188
2192
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2189
2193
|
if (transition) {
|
|
@@ -2374,8 +2378,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2374
2378
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2375
2379
|
const circle = clip("clipCircle");
|
|
2376
2380
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2377
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2378
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2381
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2382
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node).length === 0 || _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2379
2383
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2380
2384
|
return typeof v !== "number" || v > 0.01;
|
|
2381
2385
|
}));
|
|
@@ -2462,7 +2466,7 @@ function checkMotionScene(scene) {
|
|
|
2462
2466
|
}
|
|
2463
2467
|
for (const id of targets) {
|
|
2464
2468
|
const node = nodes.get(id).node;
|
|
2465
|
-
const paths = node.type === "path" ? [node] :
|
|
2469
|
+
const paths = node.type === "path" ? [node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node);
|
|
2466
2470
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2467
2471
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, "paint-not-color", `"${id}" has a gradient ${key}; it switches to ${color} at the end instead of blending.`, { ...where, ids: [id] }));
|
|
2468
2472
|
}
|
|
@@ -2475,7 +2479,7 @@ function checkMotionScene(scene) {
|
|
|
2475
2479
|
else
|
|
2476
2480
|
for (const id of targets) {
|
|
2477
2481
|
const node = nodes.get(id).node;
|
|
2478
|
-
const paths = node.type === "path" ? [node] :
|
|
2482
|
+
const paths = node.type === "path" ? [node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node);
|
|
2479
2483
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2480
2484
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, "paint-not-color", `"${id}" has a gradient or no ${key}, so a colour pulse cannot tint it; give it a solid ${key} or pulse the ${key === "fill" ? "stroke" : "fill"}.`, { ...where, ids: [id] }));
|
|
2481
2485
|
}
|
|
@@ -2920,7 +2924,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2920
2924
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2921
2925
|
const timeline = compileMotionScene(scene);
|
|
2922
2926
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2923
|
-
const centre =
|
|
2927
|
+
const centre = _chunkWPUXGDH4cjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2924
2928
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2925
2929
|
const fill = paint("fill");
|
|
2926
2930
|
const stroke = paint("stroke");
|
|
@@ -3267,7 +3271,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3267
3271
|
raw: (t) => transformAt(t, true)
|
|
3268
3272
|
});
|
|
3269
3273
|
}
|
|
3270
|
-
const paths = node.type === "path" ? [node] :
|
|
3274
|
+
const paths = node.type === "path" ? [node] : _chunkWPUXGDH4cjs.collectPathNodes.call(void 0, node);
|
|
3271
3275
|
for (const path of paths) {
|
|
3272
3276
|
if (pathsSeen.has(path.id)) continue;
|
|
3273
3277
|
pathsSeen.add(path.id);
|
|
@@ -3289,7 +3293,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3289
3293
|
if (shapeSegments.length) {
|
|
3290
3294
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
3291
3295
|
else {
|
|
3292
|
-
const inverse =
|
|
3296
|
+
const inverse = _chunkWPUXGDH4cjs.invertMatrix.call(void 0, _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, node));
|
|
3293
3297
|
channels.push({
|
|
3294
3298
|
id,
|
|
3295
3299
|
kind: "attr",
|
|
@@ -3298,9 +3302,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3298
3302
|
exact: () => false,
|
|
3299
3303
|
value: (t) => {
|
|
3300
3304
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3301
|
-
const now =
|
|
3305
|
+
const now = _chunkWPUXGDH4cjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3302
3306
|
if (!now || now.type !== "path") return "";
|
|
3303
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3307
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, now, _chunkWPUXGDH4cjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3304
3308
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3305
3309
|
}
|
|
3306
3310
|
});
|
|
@@ -3321,7 +3325,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3321
3325
|
if (w) return `${w.move}@${w.shot}`;
|
|
3322
3326
|
const seg = camera.find((x) => t >= x.start - 1e-6 && t < Math.max(x.end, x.start + 1e-3));
|
|
3323
3327
|
const shot = seg ? scene.shots.find((x) => x.id === seg.shot) : void 0;
|
|
3324
|
-
const move = _optionalChain([
|
|
3328
|
+
const move = _optionalChain([_chunkISIO63Q5cjs.cameraMoveParts.call(void 0, _optionalChain([shot, 'optionalAccess', _155 => _155.camera, 'optionalAccess', _156 => _156.in])), 'optionalAccess', _157 => _157.move]);
|
|
3325
3329
|
return move && shot ? `${move}@${shot.id}` : void 0;
|
|
3326
3330
|
};
|
|
3327
3331
|
const unplayed = scene.shots.filter((x) => x.camera && (x.camera.in !== void 0 || x.camera.during !== void 0) && !windows.some((w) => w.shot === x.id));
|
|
@@ -3440,7 +3444,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3440
3444
|
}
|
|
3441
3445
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3442
3446
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3443
|
-
let svg =
|
|
3447
|
+
let svg = _chunkWPUXGDH4cjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkWPUXGDH4cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3444
3448
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3445
3449
|
let motion = { svg, animate };
|
|
3446
3450
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3538,14 +3542,14 @@ function easingOf(ease, fallback) {
|
|
|
3538
3542
|
return fallback;
|
|
3539
3543
|
}
|
|
3540
3544
|
function poseOf(value, entry) {
|
|
3541
|
-
const t =
|
|
3542
|
-
const o =
|
|
3545
|
+
const t = _chunkWPUXGDH4cjs.parseSvgTransform.call(void 0, String(value));
|
|
3546
|
+
const o = _chunkWPUXGDH4cjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkWPUXGDH4cjs.invertMatrix.call(void 0, _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3543
3547
|
const sx = Math.hypot(o[0], o[1]);
|
|
3544
3548
|
if (!(sx > 1e-9)) return null;
|
|
3545
3549
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3546
3550
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3547
3551
|
const c = entry.center;
|
|
3548
|
-
const moved =
|
|
3552
|
+
const moved = _chunkWPUXGDH4cjs.applyMatrix.call(void 0, o, c);
|
|
3549
3553
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3550
3554
|
}
|
|
3551
3555
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3630,7 +3634,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3630
3634
|
const notes = [];
|
|
3631
3635
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3632
3636
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3633
|
-
const artwork =
|
|
3637
|
+
const artwork = _chunkWPUXGDH4cjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3634
3638
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3635
3639
|
const byStep = /* @__PURE__ */ new Map();
|
|
3636
3640
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3877,9 +3881,9 @@ function toLottie(scene, options = {}) {
|
|
|
3877
3881
|
const items = [];
|
|
3878
3882
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3879
3883
|
const geometryAt = (t) => {
|
|
3880
|
-
if (!shapeSegments.length) return
|
|
3884
|
+
if (!shapeSegments.length) return _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3881
3885
|
const now = _optionalChain([indexMotionNodes, 'call', _170 => _170(motionFrameAt(scene, t, { draw: false, offsets: false }).document.nodes), 'access', _171 => _171.get, 'call', _172 => _172(path.id), 'optionalAccess', _173 => _173.node]);
|
|
3882
|
-
return now && now.type === "path" ?
|
|
3886
|
+
return now && now.type === "path" ? _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, _chunkWPUXGDH4cjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3883
3887
|
};
|
|
3884
3888
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3885
3889
|
rest.forEach((contour, n2) => {
|
|
@@ -3952,13 +3956,13 @@ function toLottie(scene, options = {}) {
|
|
|
3952
3956
|
const innerTr = STATIC_TR();
|
|
3953
3957
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3954
3958
|
else if (node.type === "text" || node.type === "instance") {
|
|
3955
|
-
const drawn =
|
|
3959
|
+
const drawn = _chunkWPUXGDH4cjs.expandVectorAppearance.call(void 0, node);
|
|
3956
3960
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3957
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3961
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkWPUXGDH4cjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3958
3962
|
} else {
|
|
3959
3963
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3960
|
-
const m =
|
|
3961
|
-
if (m !==
|
|
3964
|
+
const m = _chunkWPUXGDH4cjs.nodeMatrix.call(void 0, node);
|
|
3965
|
+
if (m !== _chunkWPUXGDH4cjs.IDENTITY_MATRIX) {
|
|
3962
3966
|
const parts = staticParts(m);
|
|
3963
3967
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3964
3968
|
else {
|
|
@@ -3971,7 +3975,7 @@ function toLottie(scene, options = {}) {
|
|
|
3971
3975
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3972
3976
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3973
3977
|
};
|
|
3974
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3978
|
+
const artwork = { ...scene.artwork, nodes: _chunkWPUXGDH4cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3975
3979
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3976
3980
|
if (artwork.background && rgba(artwork.background))
|
|
3977
3981
|
content.push({ ty: "gr", nm: "Background", it: [{ ty: "rc", nm: "Background", p: { a: 0, k: [artwork.width / 2, artwork.height / 2] }, s: { a: 0, k: [artwork.width, artwork.height] }, r: { a: 0, k: 0 } }, { ty: "fl", c: { a: 0, k: rgba(artwork.background).map(round4) }, o: { a: 0, k: 100 }, r: 1 }, STATIC_TR()] });
|
|
@@ -4070,11 +4074,11 @@ function preset(prst, w, h) {
|
|
|
4070
4074
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4071
4075
|
switch (prst) {
|
|
4072
4076
|
case "rect":
|
|
4073
|
-
return [
|
|
4077
|
+
return [_chunkWPUXGDH4cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4074
4078
|
case "roundRect":
|
|
4075
|
-
return [
|
|
4079
|
+
return [_chunkWPUXGDH4cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4076
4080
|
case "ellipse":
|
|
4077
|
-
return [
|
|
4081
|
+
return [_chunkWPUXGDH4cjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4078
4082
|
case "triangle":
|
|
4079
4083
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4080
4084
|
case "rtTriangle":
|
|
@@ -4182,7 +4186,7 @@ function shapes(ctx, tree, map) {
|
|
|
4182
4186
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4183
4187
|
if (!subpaths) {
|
|
4184
4188
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4185
|
-
subpaths = [
|
|
4189
|
+
subpaths = [_chunkWPUXGDH4cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4186
4190
|
}
|
|
4187
4191
|
const style = kid(el, "style");
|
|
4188
4192
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4425,7 +4429,7 @@ var kindHint = (d) => {
|
|
|
4425
4429
|
function withPreset(d, preset2, values) {
|
|
4426
4430
|
if (preset2 === void 0) return values;
|
|
4427
4431
|
const p = d.presets.find((x) => x.name === preset2);
|
|
4428
|
-
if (!p) throw new (0,
|
|
4432
|
+
if (!p) throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" has no preset "${preset2}"; ${d.presets.length ? `its presets are ${d.presets.map((x) => `"${x.name}"`).join(", ")}` : "it has no presets"}.`, d.id);
|
|
4429
4433
|
return { ...p.values, ..._nullishCoalesce(values, () => ( {})) };
|
|
4430
4434
|
}
|
|
4431
4435
|
async function resolveMotionShotLayer(provider, layer) {
|
|
@@ -4435,27 +4439,27 @@ async function resolveMotionShotLayer(provider, layer) {
|
|
|
4435
4439
|
const { provider: _p, name: _n, ...rest } = layer;
|
|
4436
4440
|
return rest;
|
|
4437
4441
|
}
|
|
4438
|
-
if (!provider) throw new (0,
|
|
4442
|
+
if (!provider) throw new (0, _chunkISIO63Q5cjs.NoEffectsProviderError)();
|
|
4439
4443
|
const d = await provider.describe(layer.effect);
|
|
4440
|
-
if (!
|
|
4441
|
-
const input =
|
|
4442
|
-
if (layer.subject && !input) throw new (0,
|
|
4443
|
-
if (!layer.subject && input && _optionalChain([d, 'access', _198 => _198.inputs, 'access', _199 => _199.find, 'call', _200 => _200((i) => i.name === input), 'optionalAccess', _201 => _201.required])) throw new (0,
|
|
4444
|
+
if (!_chunkZ3BRH4JKcjs.effectLayerOffered.call(void 0, d)) throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) cannot be a layer; ${kindHint(d)}. A layer's effect is a generator, filter, overlay or title (search_effects with use "generator", "filter", "overlay" or "title").`, d.id);
|
|
4445
|
+
const input = _chunkZ3BRH4JKcjs.effectLayerInput.call(void 0, d);
|
|
4446
|
+
if (layer.subject && !input) throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) draws its own picture and takes no subject; leave "subject" out, or pick a filter to change the subject.`, d.id);
|
|
4447
|
+
if (!layer.subject && input && _optionalChain([d, 'access', _198 => _198.inputs, 'access', _199 => _199.find, 'call', _200 => _200((i) => i.name === input), 'optionalAccess', _201 => _201.required])) throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) changes a picture; give a "subject": { "image": url }, { "svg": markup }, { "text": words } or { "slot": name }.`, d.id);
|
|
4444
4448
|
const values = withPreset(d, layer.preset, layer.values);
|
|
4445
|
-
|
|
4449
|
+
_chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, values);
|
|
4446
4450
|
const out = { ...layer, provider: provider.id, name: d.name };
|
|
4447
4451
|
if (values && Object.keys(values).length) out.values = values;
|
|
4448
4452
|
else delete out.values;
|
|
4449
4453
|
return out;
|
|
4450
4454
|
}
|
|
4451
4455
|
async function resolveMotionShotTransition(provider, transition) {
|
|
4452
|
-
if (!provider) throw new (0,
|
|
4456
|
+
if (!provider) throw new (0, _chunkISIO63Q5cjs.NoEffectsProviderError)();
|
|
4453
4457
|
const d = await provider.describe(transition.effect);
|
|
4454
|
-
if (!d.uses.includes("transition") || d.kind === "camera") throw new (0,
|
|
4458
|
+
if (!d.uses.includes("transition") || d.kind === "camera") throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is not a transition (${kindHint(d)}); search_effects with use "transition" lists them.`, d.id);
|
|
4455
4459
|
if (transition.ms !== void 0 && !(transition.ms > 0 && transition.ms <= 6e4)) throw new Error(`A transition's "ms" is from 1 to 60000; got ${transition.ms}.`);
|
|
4456
4460
|
const values = withPreset(d, transition.preset, transition.values);
|
|
4457
|
-
|
|
4458
|
-
const out = { ...transition, ms: _nullishCoalesce(transition.ms, () => (
|
|
4461
|
+
_chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, values);
|
|
4462
|
+
const out = { ...transition, ms: _nullishCoalesce(transition.ms, () => ( _chunkISIO63Q5cjs.EFFECT_TRANSITION_MS)), provider: provider.id, name: d.name };
|
|
4459
4463
|
if (values && Object.keys(values).length) out.values = values;
|
|
4460
4464
|
else delete out.values;
|
|
4461
4465
|
return out;
|
|
@@ -4571,7 +4575,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4571
4575
|
walk(scene.artwork.nodes);
|
|
4572
4576
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4573
4577
|
}
|
|
4574
|
-
var motionArtworkSvg = (artwork) =>
|
|
4578
|
+
var motionArtworkSvg = (artwork) => _chunkWPUXGDH4cjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4575
4579
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4576
4580
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4577
4581
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4650,7 +4654,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4650
4654
|
|
|
4651
4655
|
|
|
4652
4656
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
4653
|
-
__init9() {this.effects = new (0,
|
|
4657
|
+
__init9() {this.effects = new (0, _chunkISIO63Q5cjs.EffectsSlot)()}
|
|
4654
4658
|
/** Renders shot layer and transition pictures for frames (see `MotionLayersEngine`). */
|
|
4655
4659
|
|
|
4656
4660
|
|
|
@@ -4844,7 +4848,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4844
4848
|
try {
|
|
4845
4849
|
plan = await work();
|
|
4846
4850
|
} catch (error) {
|
|
4847
|
-
if (
|
|
4851
|
+
if (_chunkISIO63Q5cjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
4848
4852
|
throw error;
|
|
4849
4853
|
}
|
|
4850
4854
|
const r = this.apply({ op: "replace_scene", scene: plan.scene }, plan.label, { merge });
|
|
@@ -4855,11 +4859,11 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4855
4859
|
}
|
|
4856
4860
|
async describeFor(effect, kinds) {
|
|
4857
4861
|
const provider = this.effects.require();
|
|
4858
|
-
if (!provider.applyVectorEffect) throw new (0,
|
|
4862
|
+
if (!provider.applyVectorEffect) throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`${provider.name} has no vector or motion effects.`);
|
|
4859
4863
|
const d = await provider.describe(effect);
|
|
4860
4864
|
if (!kinds.includes(d.kind)) {
|
|
4861
4865
|
const hint = d.kind === "motion" ? "apply it to nodes with apply_effect" : d.kind === "vector" ? "add it with add_vector_effect" : "it draws pixels, which scenes cannot hold";
|
|
4862
|
-
throw new (0,
|
|
4866
|
+
throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.kind} effect: ${hint}.`, d.id);
|
|
4863
4867
|
}
|
|
4864
4868
|
return d;
|
|
4865
4869
|
}
|
|
@@ -4880,7 +4884,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4880
4884
|
return this.effectEdit(async () => {
|
|
4881
4885
|
this.knownNodes(targets);
|
|
4882
4886
|
const d = await this.describeFor(effect, ["motion"]);
|
|
4883
|
-
const values =
|
|
4887
|
+
const values = _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4884
4888
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4885
4889
|
const motion = await this.effects.require().applyVectorEffect(d.id, { svg: motionArtworkSvg(this.scene.artwork), nodeIds: [...targets] }, values);
|
|
4886
4890
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4905,7 +4909,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4905
4909
|
let given = options.values;
|
|
4906
4910
|
let place = options.box;
|
|
4907
4911
|
if (options.path) {
|
|
4908
|
-
const controls =
|
|
4912
|
+
const controls = _chunkISIO63Q5cjs.pathControlsOf.call(void 0, d);
|
|
4909
4913
|
if (!controls.length) throw new Error(`"${d.id}" does not draw along a path. Find one that does with search_effects accepts ["path"] (kind vector).`);
|
|
4910
4914
|
const control = _nullishCoalesce(options.control, () => ( (controls.length === 1 ? controls[0] : void 0)));
|
|
4911
4915
|
if (!control) throw new Error(`"${d.id}" has several path controls (${controls.join(", ")}); pass control.`);
|
|
@@ -4915,7 +4919,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4915
4919
|
const entry = indexMotionNodes(this.scene.artwork.nodes).get(options.path.node);
|
|
4916
4920
|
if (!entry) throw new Error(`There is no node "${options.path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4917
4921
|
if (entry.node.type !== "path") throw new Error(`Node "${options.path.node}" is a ${entry.node.type}, not a path; pass a path node (find_animation_elements shows each node's type).`);
|
|
4918
|
-
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4922
|
+
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunkWPUXGDH4cjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4919
4923
|
place ??= "viewBox";
|
|
4920
4924
|
} else {
|
|
4921
4925
|
const provider = this.effects.require();
|
|
@@ -4925,7 +4929,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4925
4929
|
}
|
|
4926
4930
|
given = { ..._nullishCoalesce(given, () => ( {})), [control]: value };
|
|
4927
4931
|
}
|
|
4928
|
-
const values =
|
|
4932
|
+
const values = _chunkISIO63Q5cjs.resolveEffectValues.call(void 0, d, given);
|
|
4929
4933
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4930
4934
|
const motion = await this.effects.require().applyVectorEffect(d.id, motionArtworkSvg(this.scene.artwork), values);
|
|
4931
4935
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4949,7 +4953,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4949
4953
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
4950
4954
|
else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
4951
4955
|
}
|
|
4952
|
-
const merged = { ...base, ...
|
|
4956
|
+
const merged = { ...base, ..._chunkISIO63Q5cjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
4953
4957
|
const { scene: bare, place } = withoutMotionEffect(this.scene, instance);
|
|
4954
4958
|
const provider = this.effects.require();
|
|
4955
4959
|
const source = { instance, effect: d.id, provider: provider.id, name: d.name, values: merged };
|
|
@@ -5004,12 +5008,12 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5004
5008
|
if (!found) return this.refuse(`There is no shot "${shot}"; the shots are ${this.scene.shots.map((s) => `"${s.id}"`).join(", ") || "none yet"}.`);
|
|
5005
5009
|
let resolved;
|
|
5006
5010
|
try {
|
|
5007
|
-
resolved = await
|
|
5011
|
+
resolved = await _chunkISIO63Q5cjs.resolveCameraMoveSpec.call(void 0, this.effects.require(), spec, role);
|
|
5008
5012
|
} catch (error) {
|
|
5009
|
-
if (
|
|
5013
|
+
if (_chunkISIO63Q5cjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5010
5014
|
throw error;
|
|
5011
5015
|
}
|
|
5012
|
-
const field =
|
|
5016
|
+
const field = _chunkISIO63Q5cjs.cameraMoveField.call(void 0, role);
|
|
5013
5017
|
const current = this.scene.shots.find((s) => s.id === shot);
|
|
5014
5018
|
if (!current) return this.refuse(`Shot "${shot}" was removed while the move was checked.`);
|
|
5015
5019
|
const parts = role === "transition" && resolved.spec.ms === void 0 ? { ...resolved.spec, ms: resolved.description.camera.durationMs } : resolved.spec;
|
|
@@ -5023,7 +5027,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5023
5027
|
clearShotCameraMove(shot, role) {
|
|
5024
5028
|
const found = this.scene.shots.find((s) => s.id === shot);
|
|
5025
5029
|
if (!found) return this.refuse(`There is no shot "${shot}"; the shots are ${this.scene.shots.map((s) => `"${s.id}"`).join(", ") || "none yet"}.`);
|
|
5026
|
-
const field =
|
|
5030
|
+
const field = _chunkISIO63Q5cjs.cameraMoveField.call(void 0, role);
|
|
5027
5031
|
if (_optionalChain([found, 'access', _232 => _232.camera, 'optionalAccess', _233 => _233[field]]) === void 0) return this.refuse(`Shot "${shot}" has no camera "${field}" move to clear${_optionalChain([found, 'access', _234 => _234.camera, 'optionalAccess', _235 => _235[field === "in" ? "during" : "in"]]) !== void 0 ? `; it has a "${field === "in" ? "during" : "in"}" move (role ${role === "hold" ? "transition" : "hold"})` : ""}.`);
|
|
5028
5032
|
const rest = { ...found.camera };
|
|
5029
5033
|
delete rest[field];
|
|
@@ -5165,7 +5169,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5165
5169
|
try {
|
|
5166
5170
|
plan = await work();
|
|
5167
5171
|
} catch (error) {
|
|
5168
|
-
if (
|
|
5172
|
+
if (_chunkISIO63Q5cjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5169
5173
|
throw error;
|
|
5170
5174
|
}
|
|
5171
5175
|
const id = this.scene.shots[plan.shot].id;
|
|
@@ -5247,7 +5251,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5247
5251
|
const { provider: _p, name: _n, ...given } = transition;
|
|
5248
5252
|
resolved = await resolveMotionShotTransition(this.effects.provider, given);
|
|
5249
5253
|
} catch (error) {
|
|
5250
|
-
if (
|
|
5254
|
+
if (_chunkISIO63Q5cjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5251
5255
|
throw error;
|
|
5252
5256
|
}
|
|
5253
5257
|
if (!this.scene.shots.some((s) => s.id === shot)) return this.refuse(`Shot "${shot}" was removed while the transition was checked.`);
|
|
@@ -5279,9 +5283,9 @@ var AnimationEditorController = (_class2 = class {
|
|
|
5279
5283
|
const mode = _nullishCoalesce(options.mode, () => ( "replace"));
|
|
5280
5284
|
let filled;
|
|
5281
5285
|
try {
|
|
5282
|
-
filled = await
|
|
5286
|
+
filled = await _chunkZ3BRH4JKcjs.fillEffectTemplate.call(void 0, this.effects.provider, template, values, options.name ? { name: options.name } : {});
|
|
5283
5287
|
} catch (error) {
|
|
5284
|
-
if (
|
|
5288
|
+
if (_chunkISIO63Q5cjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
5285
5289
|
throw error;
|
|
5286
5290
|
}
|
|
5287
5291
|
const provider = this.effects.provider.id;
|
|
@@ -6176,7 +6180,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6176
6180
|
handler: ({ svg }) => {
|
|
6177
6181
|
let artwork;
|
|
6178
6182
|
try {
|
|
6179
|
-
artwork =
|
|
6183
|
+
artwork = _chunkWPUXGDH4cjs.parseVectorSvg.call(void 0, svg);
|
|
6180
6184
|
} catch (error) {
|
|
6181
6185
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6182
6186
|
}
|
|
@@ -6981,7 +6985,7 @@ function animationCameraMoveTools(controller, ctx) {
|
|
|
6981
6985
|
shot: { type: "string", minLength: 1, description: "A shot id from get_animation." },
|
|
6982
6986
|
role: ROLE,
|
|
6983
6987
|
move: { type: "string", minLength: 1, description: "A camera move id of that role from list_camera_moves." },
|
|
6984
|
-
ms: { type: "number", minimum: 0, maximum:
|
|
6988
|
+
ms: { type: "number", minimum: 0, maximum: _chunkISIO63Q5cjs.CAMERA_MOVE_MAX_MS, description: `How long a transition takes, ms (0\u2013${_chunkISIO63Q5cjs.CAMERA_MOVE_MAX_MS}; default the move's durationMs). Not for a hold, which plays across the shot's hold.` },
|
|
6985
6989
|
preset: { type: "string", minLength: 1, description: "A preset of the move by name, from describe_effect; its values are written out on the shot." },
|
|
6986
6990
|
values: ctx.valuesSchema("Control values over the move's defaults (and the preset's), from describe_effect")
|
|
6987
6991
|
},
|
|
@@ -7054,7 +7058,7 @@ var fields = (ctx) => ({
|
|
|
7054
7058
|
preset: { type: "string", minLength: 1, description: "A preset of the effect by name, from describe_effect; its values are written out on the layer." },
|
|
7055
7059
|
values: ctx.valuesSchema("Control values over the effect's defaults (and the preset's), from describe_effect"),
|
|
7056
7060
|
subject: SUBJECT,
|
|
7057
|
-
role: { type: "string", enum: [...
|
|
7061
|
+
role: { type: "string", enum: [..._chunkISIO63Q5cjs.EFFECT_LAYER_ROLES], description: "background: under the artwork; subject: over the artwork; overlay: over everything. Default subject with a rect, else background." },
|
|
7058
7062
|
rect: RECT,
|
|
7059
7063
|
from: TIME("starts", "0: as its shot starts"),
|
|
7060
7064
|
until: TIME("stops", '{ "shots": 1 }: as the next shot starts'),
|
|
@@ -7144,7 +7148,7 @@ function animationShotLayerTools(controller, ctx) {
|
|
|
7144
7148
|
properties: {
|
|
7145
7149
|
shot: { ...SHOT2, description: "A shot id from get_animation (not the first shot)." },
|
|
7146
7150
|
effect: { ...ctx.effectIdSchema(["transition"]), description: "A transition effect id from search_effects (use transition)." },
|
|
7147
|
-
ms: { type: "number", exclusiveMinimum: 0, maximum: 6e4, description: `How long it takes, ms (default ${
|
|
7151
|
+
ms: { type: "number", exclusiveMinimum: 0, maximum: 6e4, description: `How long it takes, ms (default ${_chunkISIO63Q5cjs.EFFECT_TRANSITION_MS}).` },
|
|
7148
7152
|
preset: { type: "string", minLength: 1, description: "A preset of the transition by name, from describe_effect." },
|
|
7149
7153
|
values: ctx.valuesSchema("Control values over the transition's defaults (and the preset's)")
|
|
7150
7154
|
},
|
|
@@ -7180,7 +7184,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
7180
7184
|
if (!r.ok) throw new Error(r.error);
|
|
7181
7185
|
return { target, effect: info(r.effect), effects: controller.appliedEffects().filter((e) => e.targets.includes(target)).map(info), ...r.notes.length ? { notes: r.notes } : {} };
|
|
7182
7186
|
};
|
|
7183
|
-
return withAnimationPlayback(
|
|
7187
|
+
return withAnimationPlayback(_chunkISIO63Q5cjs.createEffectToolProvider.call(void 0, {
|
|
7184
7188
|
id: _nullishCoalesce(options.id, () => ( "animation-effects")),
|
|
7185
7189
|
namespace: options.namespace,
|
|
7186
7190
|
title: "Animation effects",
|
|
@@ -7215,7 +7219,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
7215
7219
|
extraTools: (ctx) => [
|
|
7216
7220
|
...animationCameraMoveTools(controller, ctx),
|
|
7217
7221
|
...animationShotLayerTools(controller, ctx),
|
|
7218
|
-
...
|
|
7222
|
+
..._chunkZ3BRH4JKcjs.effectTemplateTools.call(void 0,
|
|
7219
7223
|
{
|
|
7220
7224
|
provider: () => controller.effectsProvider,
|
|
7221
7225
|
fillDetails: "mode replace (default) makes a new scene from the template's shots, the size of its stage; mode append adds its shots after the current ones, scaled to the artwork. Each shot keeps its framing and camera moves, its layers and its transition; its title and caption become overlay word layers. Returns { template, mode, shots (new shot ids), layers (new layer ids), openSlots, notes }. Check the result with render_animation_frame.",
|