@pixerate/editor 0.264.1 → 0.265.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/dist/animation-editor/index.cjs +60 -61
- package/dist/animation-editor/index.js +4 -5
- package/dist/brushes/index.cjs +73 -60
- package/dist/brushes/index.d.cts +1 -0
- package/dist/brushes/index.d.ts +1 -0
- package/dist/brushes/index.js +17 -4
- package/dist/brushes/preview.d.cts +59 -0
- package/dist/brushes/preview.d.ts +59 -0
- package/dist/brushes/tools.d.cts +12 -5
- package/dist/brushes/tools.d.ts +12 -5
- package/dist/{brushstrokeRender-3MOI7PH4.js → brushstrokeRender-4UB6NRJW.js} +11 -4
- package/dist/{brushstrokeRender-SMMPIJF2.cjs → brushstrokeRender-JQ2XQRUD.cjs} +22 -15
- package/dist/canvas/brushstroke.d.cts +6 -1
- package/dist/canvas/brushstroke.d.ts +6 -1
- package/dist/canvas/index.cjs +16 -17
- package/dist/canvas/index.js +2 -3
- package/dist/{chunk-F3KKR6DD.cjs → chunk-5OE4ZZ6V.cjs} +30 -30
- package/dist/{chunk-BY5EBP26.cjs → chunk-677777GH.cjs} +3 -3
- package/dist/{chunk-G5ADO47G.cjs → chunk-7NQOGWLM.cjs} +3 -2
- package/dist/{chunk-WWI6FLH2.js → chunk-7PW6VCNW.js} +2 -2
- package/dist/{chunk-CECCP2V7.js → chunk-BLR4KWYQ.js} +1 -1
- package/dist/chunk-DEBIFWY6.cjs +77 -0
- package/dist/{chunk-KXNZNOEF.cjs → chunk-DGXTEPCU.cjs} +94 -94
- package/dist/{chunk-3CI7FRMK.js → chunk-DVPQFMH6.js} +13 -1
- package/dist/{chunk-EE7SAYBF.js → chunk-J4SGJCPW.js} +3 -3
- package/dist/{chunk-A2IS7EHE.cjs → chunk-JBZRVLXV.cjs} +14 -2
- package/dist/{chunk-V7MJ4HIN.cjs → chunk-NOP4Y5AB.cjs} +23 -23
- package/dist/{chunk-FQC5TDB6.cjs → chunk-O53MOGXG.cjs} +35 -35
- package/dist/{chunk-4OJC4MCD.js → chunk-Q6RVVJW6.js} +1 -1
- package/dist/{chunk-HAUDEVMC.js → chunk-WY23AUCA.js} +2 -2
- package/dist/{chunk-JEML4FSA.js → chunk-XDNWQMHY.js} +3 -2
- package/dist/{chunk-ROBSFJ6F.js → chunk-Z2Z2OHRM.js} +1 -1
- package/dist/{chunk-USJX5SW4.cjs → chunk-ZHRVCW3M.cjs} +12 -12
- package/dist/chunk-ZS7LB2MV.js +77 -0
- package/dist/image-editor/index.cjs +788 -790
- package/dist/image-editor/index.js +6 -8
- package/dist/paint-editor/index.cjs +88 -84
- package/dist/paint-editor/index.js +12 -8
- package/dist/vector/index.cjs +970 -971
- package/dist/vector/index.js +5 -6
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +7 -2
- package/dist/chunk-FJBQTZS4.js +0 -17
- package/dist/chunk-LRTR4ASZ.cjs +0 -17
|
@@ -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 _chunkO53MOGXGcjs = require('../chunk-O53MOGXG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -39,8 +39,8 @@ var _chunk557BDWKOcjs = require('../chunk-557BDWKO.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../chunk-
|
|
42
|
+
var _chunkZHRVCW3Mcjs = require('../chunk-ZHRVCW3M.cjs');
|
|
43
|
+
require('../chunk-677777GH.cjs');
|
|
44
44
|
require('../chunk-OTN6VB5S.cjs');
|
|
45
45
|
require('../chunk-CVFAAZXE.cjs');
|
|
46
46
|
|
|
@@ -51,8 +51,7 @@ require('../chunk-CVFAAZXE.cjs');
|
|
|
51
51
|
|
|
52
52
|
var _chunkGF2RBSDMcjs = require('../chunk-GF2RBSDM.cjs');
|
|
53
53
|
require('../chunk-NM3G4VQT.cjs');
|
|
54
|
-
require('../chunk-
|
|
55
|
-
require('../chunk-A2IS7EHE.cjs');
|
|
54
|
+
require('../chunk-JBZRVLXV.cjs');
|
|
56
55
|
require('../chunk-U67EN7GG.cjs');
|
|
57
56
|
|
|
58
57
|
|
|
@@ -706,7 +705,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
706
705
|
function motionTextLayout(nodes, id) {
|
|
707
706
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
708
707
|
if (!group || group.type !== "group") return null;
|
|
709
|
-
const letters =
|
|
708
|
+
const letters = _chunkZHRVCW3Mcjs.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);
|
|
710
709
|
if (!letters.length) return null;
|
|
711
710
|
const lines = [];
|
|
712
711
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -791,21 +790,21 @@ function indexMotionNodes(nodes) {
|
|
|
791
790
|
const out = /* @__PURE__ */ new Map();
|
|
792
791
|
const walk = (list, parentWorld, ancestors) => {
|
|
793
792
|
for (const node of list) {
|
|
794
|
-
const local =
|
|
795
|
-
const bounds =
|
|
793
|
+
const local = _chunkZHRVCW3Mcjs.vectorNodeBounds.call(void 0, node);
|
|
794
|
+
const bounds = _chunkZHRVCW3Mcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
796
795
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
797
796
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
798
|
-
if (node.type === "group") walk(node.children,
|
|
797
|
+
if (node.type === "group") walk(node.children, _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
799
798
|
}
|
|
800
799
|
};
|
|
801
|
-
walk(nodes,
|
|
800
|
+
walk(nodes, _chunkZHRVCW3Mcjs.IDENTITY_MATRIX, []);
|
|
802
801
|
indexCache.set(nodes, out);
|
|
803
802
|
return out;
|
|
804
803
|
}
|
|
805
804
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
806
805
|
function firstPaint(node, key) {
|
|
807
806
|
if (node.type === "path") return solid(node[key]);
|
|
808
|
-
for (const p of
|
|
807
|
+
for (const p of _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node)) {
|
|
809
808
|
const s = solid(p[key]);
|
|
810
809
|
if (s) return s;
|
|
811
810
|
}
|
|
@@ -813,7 +812,7 @@ function firstPaint(node, key) {
|
|
|
813
812
|
}
|
|
814
813
|
function strokeReach(node) {
|
|
815
814
|
let reach = 0;
|
|
816
|
-
for (const p of node.type === "path" ? [node] :
|
|
815
|
+
for (const p of node.type === "path" ? [node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node)) {
|
|
817
816
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
818
817
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
819
818
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -883,7 +882,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
883
882
|
case "stroke":
|
|
884
883
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
885
884
|
case "strokeWidth": {
|
|
886
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
885
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
887
886
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
888
887
|
}
|
|
889
888
|
case "shape":
|
|
@@ -994,12 +993,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
994
993
|
const r = camera;
|
|
995
994
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
996
995
|
}
|
|
997
|
-
function motionPathLength(node, parentWorld =
|
|
996
|
+
function motionPathLength(node, parentWorld = _chunkZHRVCW3Mcjs.IDENTITY_MATRIX) {
|
|
998
997
|
let longest = 0;
|
|
999
|
-
const paths = node.type === "path" ? [node] :
|
|
998
|
+
const paths = node.type === "path" ? [node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node);
|
|
1000
999
|
for (const p of paths) {
|
|
1001
1000
|
try {
|
|
1002
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
1001
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
1003
1002
|
} catch (e2) {
|
|
1004
1003
|
}
|
|
1005
1004
|
}
|
|
@@ -1275,12 +1274,12 @@ function compileMotionScene(scene) {
|
|
|
1275
1274
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1276
1275
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1277
1276
|
if (order2 === "together" && pace === "time") return null;
|
|
1278
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1277
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, entry.node);
|
|
1279
1278
|
let list = paths.map((p) => {
|
|
1280
1279
|
const at = nodes.get(p.id);
|
|
1281
1280
|
let first = { x: 0, y: 0 };
|
|
1282
1281
|
try {
|
|
1283
|
-
const m =
|
|
1282
|
+
const m = _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunkZHRVCW3Mcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1284
1283
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1285
1284
|
} catch (e3) {
|
|
1286
1285
|
}
|
|
@@ -1392,17 +1391,17 @@ function compileMotionScene(scene) {
|
|
|
1392
1391
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1393
1392
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1394
1393
|
if (command3.to) {
|
|
1395
|
-
const inv =
|
|
1396
|
-
const target =
|
|
1394
|
+
const inv = _chunkZHRVCW3Mcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1395
|
+
const target = _chunkZHRVCW3Mcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1397
1396
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1398
1397
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1399
1398
|
}
|
|
1400
1399
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1401
|
-
const inv =
|
|
1400
|
+
const inv = _chunkZHRVCW3Mcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1402
1401
|
const x0 = num2("x");
|
|
1403
1402
|
const y0 = num2("y");
|
|
1404
1403
|
const add = command3.blend === "add";
|
|
1405
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1404
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkZHRVCW3Mcjs.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 }];
|
|
1406
1405
|
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")));
|
|
1407
1406
|
for (const axis of ["x", "y"]) {
|
|
1408
1407
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2025,13 +2024,13 @@ function morphBetween(a, b) {
|
|
|
2025
2024
|
let inner = morphCache.get(a);
|
|
2026
2025
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2027
2026
|
let morph = inner.get(b);
|
|
2028
|
-
if (!morph) inner.set(b, morph =
|
|
2027
|
+
if (!morph) inner.set(b, morph = _chunkO53MOGXGcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2029
2028
|
return morph;
|
|
2030
2029
|
}
|
|
2031
2030
|
function shapeIn(entry, shape) {
|
|
2032
2031
|
if (shape === entry) return entry.node;
|
|
2033
|
-
const m =
|
|
2034
|
-
return { ...shape.node, ...
|
|
2032
|
+
const m = _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkZHRVCW3Mcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2033
|
+
return { ...shape.node, ..._chunkZHRVCW3Mcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2035
2034
|
}
|
|
2036
2035
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2037
2036
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2051,7 +2050,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2051
2050
|
function motionFollowRoute(entry, path) {
|
|
2052
2051
|
if (!path || path.node.type !== "path") return null;
|
|
2053
2052
|
try {
|
|
2054
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2053
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkZHRVCW3Mcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2055
2054
|
} catch (e6) {
|
|
2056
2055
|
return null;
|
|
2057
2056
|
}
|
|
@@ -2085,9 +2084,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2085
2084
|
const scaleX = read("scaleX", 1);
|
|
2086
2085
|
const scaleY = read("scaleY", 1);
|
|
2087
2086
|
const c = entry.center;
|
|
2088
|
-
let matrix =
|
|
2087
|
+
let matrix = _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkZHRVCW3Mcjs.rotateMatrix.call(void 0, rotation, c)), _chunkZHRVCW3Mcjs.translateMatrix.call(void 0, dx, dy));
|
|
2089
2088
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2090
|
-
if (along) matrix =
|
|
2089
|
+
if (along) matrix = _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, matrix, _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkZHRVCW3Mcjs.rotateMatrix.call(void 0, along.angle)), _chunkZHRVCW3Mcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2091
2090
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2092
2091
|
}
|
|
2093
2092
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2154,7 +2153,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2154
2153
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2155
2154
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2156
2155
|
if (start > 0 || end < 1) {
|
|
2157
|
-
const trim =
|
|
2156
|
+
const trim = _chunkZHRVCW3Mcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2158
2157
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2159
2158
|
}
|
|
2160
2159
|
}
|
|
@@ -2168,8 +2167,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2168
2167
|
if (o >= 1) delete out.opacity;
|
|
2169
2168
|
}
|
|
2170
2169
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2171
|
-
if (offset && !
|
|
2172
|
-
const m =
|
|
2170
|
+
if (offset && !_chunkZHRVCW3Mcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2171
|
+
const m = _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2173
2172
|
out = { ...out, transform: m };
|
|
2174
2173
|
}
|
|
2175
2174
|
return out;
|
|
@@ -2190,8 +2189,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2190
2189
|
const wrap = { ...options.wrap };
|
|
2191
2190
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2192
2191
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2193
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2194
|
-
const art =
|
|
2192
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunkZHRVCW3Mcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2193
|
+
const art = _chunkZHRVCW3Mcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2195
2194
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2196
2195
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2197
2196
|
if (transition) {
|
|
@@ -2382,8 +2381,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2382
2381
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2383
2382
|
const circle = clip("clipCircle");
|
|
2384
2383
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2385
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2386
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2384
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2385
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node).length === 0 || _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2387
2386
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2388
2387
|
return typeof v !== "number" || v > 0.01;
|
|
2389
2388
|
}));
|
|
@@ -2470,7 +2469,7 @@ function checkMotionScene(scene) {
|
|
|
2470
2469
|
}
|
|
2471
2470
|
for (const id of targets) {
|
|
2472
2471
|
const node = nodes.get(id).node;
|
|
2473
|
-
const paths = node.type === "path" ? [node] :
|
|
2472
|
+
const paths = node.type === "path" ? [node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node);
|
|
2474
2473
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2475
2474
|
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] }));
|
|
2476
2475
|
}
|
|
@@ -2483,7 +2482,7 @@ function checkMotionScene(scene) {
|
|
|
2483
2482
|
else
|
|
2484
2483
|
for (const id of targets) {
|
|
2485
2484
|
const node = nodes.get(id).node;
|
|
2486
|
-
const paths = node.type === "path" ? [node] :
|
|
2485
|
+
const paths = node.type === "path" ? [node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node);
|
|
2487
2486
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2488
2487
|
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] }));
|
|
2489
2488
|
}
|
|
@@ -2928,7 +2927,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2928
2927
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2929
2928
|
const timeline = compileMotionScene(scene);
|
|
2930
2929
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2931
|
-
const centre =
|
|
2930
|
+
const centre = _chunkZHRVCW3Mcjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2932
2931
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2933
2932
|
const fill = paint("fill");
|
|
2934
2933
|
const stroke = paint("stroke");
|
|
@@ -3275,7 +3274,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3275
3274
|
raw: (t) => transformAt(t, true)
|
|
3276
3275
|
});
|
|
3277
3276
|
}
|
|
3278
|
-
const paths = node.type === "path" ? [node] :
|
|
3277
|
+
const paths = node.type === "path" ? [node] : _chunkZHRVCW3Mcjs.collectPathNodes.call(void 0, node);
|
|
3279
3278
|
for (const path of paths) {
|
|
3280
3279
|
if (pathsSeen.has(path.id)) continue;
|
|
3281
3280
|
pathsSeen.add(path.id);
|
|
@@ -3297,7 +3296,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3297
3296
|
if (shapeSegments.length) {
|
|
3298
3297
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
3299
3298
|
else {
|
|
3300
|
-
const inverse =
|
|
3299
|
+
const inverse = _chunkZHRVCW3Mcjs.invertMatrix.call(void 0, _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, node));
|
|
3301
3300
|
channels.push({
|
|
3302
3301
|
id,
|
|
3303
3302
|
kind: "attr",
|
|
@@ -3306,9 +3305,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3306
3305
|
exact: () => false,
|
|
3307
3306
|
value: (t) => {
|
|
3308
3307
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3309
|
-
const now =
|
|
3308
|
+
const now = _chunkZHRVCW3Mcjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3310
3309
|
if (!now || now.type !== "path") return "";
|
|
3311
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3310
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, now, _chunkZHRVCW3Mcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3312
3311
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3313
3312
|
}
|
|
3314
3313
|
});
|
|
@@ -3448,7 +3447,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3448
3447
|
}
|
|
3449
3448
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3450
3449
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3451
|
-
let svg =
|
|
3450
|
+
let svg = _chunkZHRVCW3Mcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkZHRVCW3Mcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3452
3451
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3453
3452
|
let motion = { svg, animate };
|
|
3454
3453
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3546,14 +3545,14 @@ function easingOf(ease, fallback) {
|
|
|
3546
3545
|
return fallback;
|
|
3547
3546
|
}
|
|
3548
3547
|
function poseOf(value, entry) {
|
|
3549
|
-
const t =
|
|
3550
|
-
const o =
|
|
3548
|
+
const t = _chunkZHRVCW3Mcjs.parseSvgTransform.call(void 0, String(value));
|
|
3549
|
+
const o = _chunkZHRVCW3Mcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkZHRVCW3Mcjs.invertMatrix.call(void 0, _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3551
3550
|
const sx = Math.hypot(o[0], o[1]);
|
|
3552
3551
|
if (!(sx > 1e-9)) return null;
|
|
3553
3552
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3554
3553
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3555
3554
|
const c = entry.center;
|
|
3556
|
-
const moved =
|
|
3555
|
+
const moved = _chunkZHRVCW3Mcjs.applyMatrix.call(void 0, o, c);
|
|
3557
3556
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3558
3557
|
}
|
|
3559
3558
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3638,7 +3637,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3638
3637
|
const notes = [];
|
|
3639
3638
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3640
3639
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3641
|
-
const artwork =
|
|
3640
|
+
const artwork = _chunkZHRVCW3Mcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3642
3641
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3643
3642
|
const byStep = /* @__PURE__ */ new Map();
|
|
3644
3643
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3885,9 +3884,9 @@ function toLottie(scene, options = {}) {
|
|
|
3885
3884
|
const items = [];
|
|
3886
3885
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3887
3886
|
const geometryAt = (t) => {
|
|
3888
|
-
if (!shapeSegments.length) return
|
|
3887
|
+
if (!shapeSegments.length) return _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3889
3888
|
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]);
|
|
3890
|
-
return now && now.type === "path" ?
|
|
3889
|
+
return now && now.type === "path" ? _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, _chunkZHRVCW3Mcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3891
3890
|
};
|
|
3892
3891
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3893
3892
|
rest.forEach((contour, n2) => {
|
|
@@ -3960,13 +3959,13 @@ function toLottie(scene, options = {}) {
|
|
|
3960
3959
|
const innerTr = STATIC_TR();
|
|
3961
3960
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3962
3961
|
else if (node.type === "text" || node.type === "instance") {
|
|
3963
|
-
const drawn =
|
|
3962
|
+
const drawn = _chunkZHRVCW3Mcjs.expandVectorAppearance.call(void 0, node);
|
|
3964
3963
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3965
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3964
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkZHRVCW3Mcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3966
3965
|
} else {
|
|
3967
3966
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3968
|
-
const m =
|
|
3969
|
-
if (m !==
|
|
3967
|
+
const m = _chunkZHRVCW3Mcjs.nodeMatrix.call(void 0, node);
|
|
3968
|
+
if (m !== _chunkZHRVCW3Mcjs.IDENTITY_MATRIX) {
|
|
3970
3969
|
const parts = staticParts(m);
|
|
3971
3970
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3972
3971
|
else {
|
|
@@ -3979,7 +3978,7 @@ function toLottie(scene, options = {}) {
|
|
|
3979
3978
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3980
3979
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3981
3980
|
};
|
|
3982
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3981
|
+
const artwork = { ...scene.artwork, nodes: _chunkZHRVCW3Mcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3983
3982
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3984
3983
|
if (artwork.background && rgba(artwork.background))
|
|
3985
3984
|
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()] });
|
|
@@ -4078,11 +4077,11 @@ function preset(prst, w, h) {
|
|
|
4078
4077
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4079
4078
|
switch (prst) {
|
|
4080
4079
|
case "rect":
|
|
4081
|
-
return [
|
|
4080
|
+
return [_chunkZHRVCW3Mcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4082
4081
|
case "roundRect":
|
|
4083
|
-
return [
|
|
4082
|
+
return [_chunkZHRVCW3Mcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4084
4083
|
case "ellipse":
|
|
4085
|
-
return [
|
|
4084
|
+
return [_chunkZHRVCW3Mcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4086
4085
|
case "triangle":
|
|
4087
4086
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4088
4087
|
case "rtTriangle":
|
|
@@ -4190,7 +4189,7 @@ function shapes(ctx, tree, map) {
|
|
|
4190
4189
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4191
4190
|
if (!subpaths) {
|
|
4192
4191
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4193
|
-
subpaths = [
|
|
4192
|
+
subpaths = [_chunkZHRVCW3Mcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4194
4193
|
}
|
|
4195
4194
|
const style = kid(el, "style");
|
|
4196
4195
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4579,7 +4578,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4579
4578
|
walk(scene.artwork.nodes);
|
|
4580
4579
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4581
4580
|
}
|
|
4582
|
-
var motionArtworkSvg = (artwork) =>
|
|
4581
|
+
var motionArtworkSvg = (artwork) => _chunkZHRVCW3Mcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4583
4582
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4584
4583
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4585
4584
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4923,7 +4922,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4923
4922
|
const entry = indexMotionNodes(this.scene.artwork.nodes).get(options.path.node);
|
|
4924
4923
|
if (!entry) throw new Error(`There is no node "${options.path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4925
4924
|
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).`);
|
|
4926
|
-
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4925
|
+
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunkZHRVCW3Mcjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4927
4926
|
place ??= "viewBox";
|
|
4928
4927
|
} else {
|
|
4929
4928
|
const provider = this.effects.require();
|
|
@@ -6184,7 +6183,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6184
6183
|
handler: ({ svg }) => {
|
|
6185
6184
|
let artwork;
|
|
6186
6185
|
try {
|
|
6187
|
-
artwork =
|
|
6186
|
+
artwork = _chunkZHRVCW3Mcjs.parseVectorSvg.call(void 0, svg);
|
|
6188
6187
|
} catch (error) {
|
|
6189
6188
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6190
6189
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Z2Z2OHRM.js";
|
|
4
4
|
import {
|
|
5
5
|
MOTION_ISSUE_CODES,
|
|
6
6
|
motionIssue,
|
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
vectorNodeBounds,
|
|
40
40
|
vectorPathWorldBezier,
|
|
41
41
|
vectorTextHasOutlines
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-7PW6VCNW.js";
|
|
43
|
+
import "../chunk-J4SGJCPW.js";
|
|
44
44
|
import "../chunk-ACFSFUQH.js";
|
|
45
45
|
import "../chunk-M6DNZNVY.js";
|
|
46
46
|
import {
|
|
@@ -51,8 +51,7 @@ import {
|
|
|
51
51
|
transformBezierPath
|
|
52
52
|
} from "../chunk-WEIK3UYB.js";
|
|
53
53
|
import "../chunk-PWBZH3FK.js";
|
|
54
|
-
import "../chunk-
|
|
55
|
-
import "../chunk-3CI7FRMK.js";
|
|
54
|
+
import "../chunk-DVPQFMH6.js";
|
|
56
55
|
import "../chunk-SZTI6EER.js";
|
|
57
56
|
import {
|
|
58
57
|
EffectRendererPool
|