@pixerate/editor 0.271.0 → 0.272.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 -60
- package/dist/animation-editor/index.js +4 -4
- package/dist/brushes/index.cjs +69 -66
- package/dist/brushes/index.js +6 -3
- package/dist/brushes/patch.d.cts +1 -1
- package/dist/brushes/patch.d.ts +1 -1
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/types.d.cts +8 -0
- package/dist/brushes/types.d.ts +8 -0
- package/dist/{brushstrokeRender-WR2N5HHY.cjs → brushstrokeRender-5YBCLFDQ.cjs} +15 -15
- package/dist/{brushstrokeRender-A727TTNQ.js → brushstrokeRender-DZGFU3J4.js} +3 -3
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-YNFSH72F.js → chunk-2F3YDXCN.js} +1 -1
- package/dist/{chunk-QYXUE37Q.js → chunk-2XDNF73E.js} +1 -1
- package/dist/{chunk-3KNQ2W6X.cjs → chunk-3JKCREEU.cjs} +59 -53
- package/dist/{chunk-B5W677L7.js → chunk-5HP2VSAS.js} +1 -1
- package/dist/{chunk-BPJSI4NT.cjs → chunk-7W2EQQBP.cjs} +2 -2
- package/dist/{chunk-LETF75CA.js → chunk-CLB2I2FU.js} +1 -1
- package/dist/{chunk-BAZMCFVL.js → chunk-DZVRH63Y.js} +1 -1
- package/dist/{chunk-U2ASNGO6.cjs → chunk-FXVCB6YG.cjs} +35 -35
- package/dist/{chunk-EU2ZZA6L.cjs → chunk-GHGBIAWQ.cjs} +126 -39
- package/dist/{chunk-2WOGXEDX.cjs → chunk-M3RZOF3G.cjs} +1 -1
- package/dist/{chunk-GSTSZPSR.js → chunk-N3SKPQEH.js} +225 -18
- package/dist/{chunk-J5VQYK7T.cjs → chunk-N5IMDAHM.cjs} +251 -44
- package/dist/{chunk-ININNHLM.js → chunk-NAHJV3O6.js} +11 -5
- package/dist/{chunk-JJ2H25JG.cjs → chunk-SNAFFCAX.cjs} +200 -174
- package/dist/{chunk-M2ZVPU7L.cjs → chunk-TNLKFW7D.cjs} +23 -23
- package/dist/{chunk-KZI3YWKW.js → chunk-UXYCY3HP.js} +93 -6
- package/dist/{chunk-DDL3ZBHK.cjs → chunk-YJANF2BL.cjs} +86 -86
- package/dist/{chunk-TNHDCP4R.js → chunk-ZEI7ZEA4.js} +31 -5
- package/dist/image-editor/index.cjs +789 -789
- package/dist/image-editor/index.js +5 -5
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.js +1 -1
- package/dist/paint/wet/world.d.cts +37 -1
- package/dist/paint/wet/world.d.ts +37 -1
- package/dist/paint-editor/brush-controls.d.cts +2 -0
- package/dist/paint-editor/brush-controls.d.ts +2 -0
- package/dist/paint-editor/brush-model.d.cts +14 -1
- package/dist/paint-editor/brush-model.d.ts +14 -1
- package/dist/paint-editor/index.cjs +343 -306
- package/dist/paint-editor/index.js +48 -11
- package/dist/paint-editor/ui.d.cts +1 -1
- package/dist/paint-editor/ui.d.ts +1 -1
- package/dist/paint-editor/wet.d.cts +8 -1
- package/dist/paint-editor/wet.d.ts +8 -1
- package/dist/vector/index.cjs +999 -999
- package/dist/vector/index.js +5 -5
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +4 -11
- package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
- package/skills/pixerate-paint-editor/references/ghost.md +47 -0
- package/skills/pixerate-paint-watercolour/SKILL.md +1 -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(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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 _chunkFXVCB6YGcjs = require('../chunk-FXVCB6YG.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 _chunkSNAFFCAXcjs = require('../chunk-SNAFFCAX.cjs');
|
|
43
|
+
require('../chunk-GHGBIAWQ.cjs');
|
|
44
44
|
require('../chunk-RDFHWAHL.cjs');
|
|
45
45
|
require('../chunk-SPIO2GJU.cjs');
|
|
46
46
|
|
|
@@ -74,7 +74,7 @@ var _chunkEBFPMSJOcjs = require('../chunk-EBFPMSJO.cjs');
|
|
|
74
74
|
|
|
75
75
|
var _chunkL2JTLW6Bcjs = require('../chunk-L2JTLW6B.cjs');
|
|
76
76
|
require('../chunk-WOFXZ3XU.cjs');
|
|
77
|
-
require('../chunk-
|
|
77
|
+
require('../chunk-N5IMDAHM.cjs');
|
|
78
78
|
require('../chunk-STLTOISW.cjs');
|
|
79
79
|
require('../chunk-NIBFKXMD.cjs');
|
|
80
80
|
require('../chunk-3K6HWEXZ.cjs');
|
|
@@ -706,7 +706,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
706
706
|
function motionTextLayout(nodes, id) {
|
|
707
707
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
708
708
|
if (!group || group.type !== "group") return null;
|
|
709
|
-
const letters =
|
|
709
|
+
const letters = _chunkSNAFFCAXcjs.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
710
|
if (!letters.length) return null;
|
|
711
711
|
const lines = [];
|
|
712
712
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -791,21 +791,21 @@ function indexMotionNodes(nodes) {
|
|
|
791
791
|
const out = /* @__PURE__ */ new Map();
|
|
792
792
|
const walk = (list, parentWorld, ancestors) => {
|
|
793
793
|
for (const node of list) {
|
|
794
|
-
const local =
|
|
795
|
-
const bounds =
|
|
794
|
+
const local = _chunkSNAFFCAXcjs.vectorNodeBounds.call(void 0, node);
|
|
795
|
+
const bounds = _chunkSNAFFCAXcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
796
796
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
797
797
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
798
|
-
if (node.type === "group") walk(node.children,
|
|
798
|
+
if (node.type === "group") walk(node.children, _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
799
799
|
}
|
|
800
800
|
};
|
|
801
|
-
walk(nodes,
|
|
801
|
+
walk(nodes, _chunkSNAFFCAXcjs.IDENTITY_MATRIX, []);
|
|
802
802
|
indexCache.set(nodes, out);
|
|
803
803
|
return out;
|
|
804
804
|
}
|
|
805
805
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
806
806
|
function firstPaint(node, key) {
|
|
807
807
|
if (node.type === "path") return solid(node[key]);
|
|
808
|
-
for (const p of
|
|
808
|
+
for (const p of _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node)) {
|
|
809
809
|
const s = solid(p[key]);
|
|
810
810
|
if (s) return s;
|
|
811
811
|
}
|
|
@@ -813,7 +813,7 @@ function firstPaint(node, key) {
|
|
|
813
813
|
}
|
|
814
814
|
function strokeReach(node) {
|
|
815
815
|
let reach = 0;
|
|
816
|
-
for (const p of node.type === "path" ? [node] :
|
|
816
|
+
for (const p of node.type === "path" ? [node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node)) {
|
|
817
817
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
818
818
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
819
819
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -883,7 +883,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
883
883
|
case "stroke":
|
|
884
884
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
885
885
|
case "strokeWidth": {
|
|
886
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
886
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
887
887
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
888
888
|
}
|
|
889
889
|
case "shape":
|
|
@@ -994,12 +994,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
994
994
|
const r = camera;
|
|
995
995
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
996
996
|
}
|
|
997
|
-
function motionPathLength(node, parentWorld =
|
|
997
|
+
function motionPathLength(node, parentWorld = _chunkSNAFFCAXcjs.IDENTITY_MATRIX) {
|
|
998
998
|
let longest = 0;
|
|
999
|
-
const paths = node.type === "path" ? [node] :
|
|
999
|
+
const paths = node.type === "path" ? [node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node);
|
|
1000
1000
|
for (const p of paths) {
|
|
1001
1001
|
try {
|
|
1002
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
1002
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
1003
1003
|
} catch (e2) {
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
@@ -1275,12 +1275,12 @@ function compileMotionScene(scene) {
|
|
|
1275
1275
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1276
1276
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1277
1277
|
if (order2 === "together" && pace === "time") return null;
|
|
1278
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1278
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, entry.node);
|
|
1279
1279
|
let list = paths.map((p) => {
|
|
1280
1280
|
const at = nodes.get(p.id);
|
|
1281
1281
|
let first = { x: 0, y: 0 };
|
|
1282
1282
|
try {
|
|
1283
|
-
const m =
|
|
1283
|
+
const m = _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunkSNAFFCAXcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1284
1284
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1285
1285
|
} catch (e3) {
|
|
1286
1286
|
}
|
|
@@ -1392,17 +1392,17 @@ function compileMotionScene(scene) {
|
|
|
1392
1392
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1393
1393
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1394
1394
|
if (command3.to) {
|
|
1395
|
-
const inv =
|
|
1396
|
-
const target =
|
|
1395
|
+
const inv = _chunkSNAFFCAXcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1396
|
+
const target = _chunkSNAFFCAXcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1397
1397
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1398
1398
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1399
1399
|
}
|
|
1400
1400
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1401
|
-
const inv =
|
|
1401
|
+
const inv = _chunkSNAFFCAXcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1402
1402
|
const x0 = num2("x");
|
|
1403
1403
|
const y0 = num2("y");
|
|
1404
1404
|
const add = command3.blend === "add";
|
|
1405
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1405
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkSNAFFCAXcjs.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
1406
|
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
1407
|
for (const axis of ["x", "y"]) {
|
|
1408
1408
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2025,13 +2025,13 @@ function morphBetween(a, b) {
|
|
|
2025
2025
|
let inner = morphCache.get(a);
|
|
2026
2026
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2027
2027
|
let morph = inner.get(b);
|
|
2028
|
-
if (!morph) inner.set(b, morph =
|
|
2028
|
+
if (!morph) inner.set(b, morph = _chunkFXVCB6YGcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2029
2029
|
return morph;
|
|
2030
2030
|
}
|
|
2031
2031
|
function shapeIn(entry, shape) {
|
|
2032
2032
|
if (shape === entry) return entry.node;
|
|
2033
|
-
const m =
|
|
2034
|
-
return { ...shape.node, ...
|
|
2033
|
+
const m = _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkSNAFFCAXcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2034
|
+
return { ...shape.node, ..._chunkSNAFFCAXcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2035
2035
|
}
|
|
2036
2036
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2037
2037
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2051,7 +2051,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2051
2051
|
function motionFollowRoute(entry, path) {
|
|
2052
2052
|
if (!path || path.node.type !== "path") return null;
|
|
2053
2053
|
try {
|
|
2054
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2054
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkSNAFFCAXcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2055
2055
|
} catch (e6) {
|
|
2056
2056
|
return null;
|
|
2057
2057
|
}
|
|
@@ -2085,9 +2085,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2085
2085
|
const scaleX = read("scaleX", 1);
|
|
2086
2086
|
const scaleY = read("scaleY", 1);
|
|
2087
2087
|
const c = entry.center;
|
|
2088
|
-
let matrix =
|
|
2088
|
+
let matrix = _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkSNAFFCAXcjs.rotateMatrix.call(void 0, rotation, c)), _chunkSNAFFCAXcjs.translateMatrix.call(void 0, dx, dy));
|
|
2089
2089
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2090
|
-
if (along) matrix =
|
|
2090
|
+
if (along) matrix = _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, matrix, _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkSNAFFCAXcjs.rotateMatrix.call(void 0, along.angle)), _chunkSNAFFCAXcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2091
2091
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2092
2092
|
}
|
|
2093
2093
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2154,7 +2154,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2154
2154
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2155
2155
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2156
2156
|
if (start > 0 || end < 1) {
|
|
2157
|
-
const trim =
|
|
2157
|
+
const trim = _chunkSNAFFCAXcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2158
2158
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2159
2159
|
}
|
|
2160
2160
|
}
|
|
@@ -2168,8 +2168,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2168
2168
|
if (o >= 1) delete out.opacity;
|
|
2169
2169
|
}
|
|
2170
2170
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2171
|
-
if (offset && !
|
|
2172
|
-
const m =
|
|
2171
|
+
if (offset && !_chunkSNAFFCAXcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2172
|
+
const m = _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2173
2173
|
out = { ...out, transform: m };
|
|
2174
2174
|
}
|
|
2175
2175
|
return out;
|
|
@@ -2190,8 +2190,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2190
2190
|
const wrap = { ...options.wrap };
|
|
2191
2191
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2192
2192
|
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 =
|
|
2193
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunkSNAFFCAXcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2194
|
+
const art = _chunkSNAFFCAXcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2195
2195
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2196
2196
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2197
2197
|
if (transition) {
|
|
@@ -2382,8 +2382,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2382
2382
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2383
2383
|
const circle = clip("clipCircle");
|
|
2384
2384
|
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" ||
|
|
2385
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2386
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node).length === 0 || _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2387
2387
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2388
2388
|
return typeof v !== "number" || v > 0.01;
|
|
2389
2389
|
}));
|
|
@@ -2470,7 +2470,7 @@ function checkMotionScene(scene) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
for (const id of targets) {
|
|
2472
2472
|
const node = nodes.get(id).node;
|
|
2473
|
-
const paths = node.type === "path" ? [node] :
|
|
2473
|
+
const paths = node.type === "path" ? [node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node);
|
|
2474
2474
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2475
2475
|
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
2476
|
}
|
|
@@ -2483,7 +2483,7 @@ function checkMotionScene(scene) {
|
|
|
2483
2483
|
else
|
|
2484
2484
|
for (const id of targets) {
|
|
2485
2485
|
const node = nodes.get(id).node;
|
|
2486
|
-
const paths = node.type === "path" ? [node] :
|
|
2486
|
+
const paths = node.type === "path" ? [node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node);
|
|
2487
2487
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2488
2488
|
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
2489
|
}
|
|
@@ -2928,7 +2928,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2928
2928
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2929
2929
|
const timeline = compileMotionScene(scene);
|
|
2930
2930
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2931
|
-
const centre =
|
|
2931
|
+
const centre = _chunkSNAFFCAXcjs.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
2932
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2933
2933
|
const fill = paint("fill");
|
|
2934
2934
|
const stroke = paint("stroke");
|
|
@@ -3275,7 +3275,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3275
3275
|
raw: (t) => transformAt(t, true)
|
|
3276
3276
|
});
|
|
3277
3277
|
}
|
|
3278
|
-
const paths = node.type === "path" ? [node] :
|
|
3278
|
+
const paths = node.type === "path" ? [node] : _chunkSNAFFCAXcjs.collectPathNodes.call(void 0, node);
|
|
3279
3279
|
for (const path of paths) {
|
|
3280
3280
|
if (pathsSeen.has(path.id)) continue;
|
|
3281
3281
|
pathsSeen.add(path.id);
|
|
@@ -3297,7 +3297,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3297
3297
|
if (shapeSegments.length) {
|
|
3298
3298
|
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
3299
|
else {
|
|
3300
|
-
const inverse =
|
|
3300
|
+
const inverse = _chunkSNAFFCAXcjs.invertMatrix.call(void 0, _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, node));
|
|
3301
3301
|
channels.push({
|
|
3302
3302
|
id,
|
|
3303
3303
|
kind: "attr",
|
|
@@ -3306,9 +3306,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3306
3306
|
exact: () => false,
|
|
3307
3307
|
value: (t) => {
|
|
3308
3308
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3309
|
-
const now =
|
|
3309
|
+
const now = _chunkSNAFFCAXcjs.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
3310
|
if (!now || now.type !== "path") return "";
|
|
3311
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3311
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, now, _chunkSNAFFCAXcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3312
3312
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3313
3313
|
}
|
|
3314
3314
|
});
|
|
@@ -3448,7 +3448,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3450
3450
|
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 =
|
|
3451
|
+
let svg = _chunkSNAFFCAXcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkSNAFFCAXcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3452
3452
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3453
3453
|
let motion = { svg, animate };
|
|
3454
3454
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3546,14 +3546,14 @@ function easingOf(ease, fallback) {
|
|
|
3546
3546
|
return fallback;
|
|
3547
3547
|
}
|
|
3548
3548
|
function poseOf(value, entry) {
|
|
3549
|
-
const t =
|
|
3550
|
-
const o =
|
|
3549
|
+
const t = _chunkSNAFFCAXcjs.parseSvgTransform.call(void 0, String(value));
|
|
3550
|
+
const o = _chunkSNAFFCAXcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkSNAFFCAXcjs.invertMatrix.call(void 0, _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3551
3551
|
const sx = Math.hypot(o[0], o[1]);
|
|
3552
3552
|
if (!(sx > 1e-9)) return null;
|
|
3553
3553
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3554
3554
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3555
3555
|
const c = entry.center;
|
|
3556
|
-
const moved =
|
|
3556
|
+
const moved = _chunkSNAFFCAXcjs.applyMatrix.call(void 0, o, c);
|
|
3557
3557
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3558
3558
|
}
|
|
3559
3559
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3638,7 +3638,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3638
3638
|
const notes = [];
|
|
3639
3639
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3640
3640
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3641
|
-
const artwork =
|
|
3641
|
+
const artwork = _chunkSNAFFCAXcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3642
3642
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3643
3643
|
const byStep = /* @__PURE__ */ new Map();
|
|
3644
3644
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3885,9 +3885,9 @@ function toLottie(scene, options = {}) {
|
|
|
3885
3885
|
const items = [];
|
|
3886
3886
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3887
3887
|
const geometryAt = (t) => {
|
|
3888
|
-
if (!shapeSegments.length) return
|
|
3888
|
+
if (!shapeSegments.length) return _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3889
3889
|
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" ?
|
|
3890
|
+
return now && now.type === "path" ? _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, _chunkSNAFFCAXcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3891
3891
|
};
|
|
3892
3892
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3893
3893
|
rest.forEach((contour, n2) => {
|
|
@@ -3960,13 +3960,13 @@ function toLottie(scene, options = {}) {
|
|
|
3960
3960
|
const innerTr = STATIC_TR();
|
|
3961
3961
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3962
3962
|
else if (node.type === "text" || node.type === "instance") {
|
|
3963
|
-
const drawn =
|
|
3963
|
+
const drawn = _chunkSNAFFCAXcjs.expandVectorAppearance.call(void 0, node);
|
|
3964
3964
|
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${
|
|
3965
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkSNAFFCAXcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3966
3966
|
} else {
|
|
3967
3967
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3968
|
-
const m =
|
|
3969
|
-
if (m !==
|
|
3968
|
+
const m = _chunkSNAFFCAXcjs.nodeMatrix.call(void 0, node);
|
|
3969
|
+
if (m !== _chunkSNAFFCAXcjs.IDENTITY_MATRIX) {
|
|
3970
3970
|
const parts = staticParts(m);
|
|
3971
3971
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3972
3972
|
else {
|
|
@@ -3979,7 +3979,7 @@ function toLottie(scene, options = {}) {
|
|
|
3979
3979
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3980
3980
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3981
3981
|
};
|
|
3982
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3982
|
+
const artwork = { ...scene.artwork, nodes: _chunkSNAFFCAXcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3983
3983
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3984
3984
|
if (artwork.background && rgba(artwork.background))
|
|
3985
3985
|
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 +4078,11 @@ function preset(prst, w, h) {
|
|
|
4078
4078
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4079
4079
|
switch (prst) {
|
|
4080
4080
|
case "rect":
|
|
4081
|
-
return [
|
|
4081
|
+
return [_chunkSNAFFCAXcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4082
4082
|
case "roundRect":
|
|
4083
|
-
return [
|
|
4083
|
+
return [_chunkSNAFFCAXcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4084
4084
|
case "ellipse":
|
|
4085
|
-
return [
|
|
4085
|
+
return [_chunkSNAFFCAXcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4086
4086
|
case "triangle":
|
|
4087
4087
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4088
4088
|
case "rtTriangle":
|
|
@@ -4190,7 +4190,7 @@ function shapes(ctx, tree, map) {
|
|
|
4190
4190
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4191
4191
|
if (!subpaths) {
|
|
4192
4192
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4193
|
-
subpaths = [
|
|
4193
|
+
subpaths = [_chunkSNAFFCAXcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4194
4194
|
}
|
|
4195
4195
|
const style = kid(el, "style");
|
|
4196
4196
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4579,7 +4579,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4579
4579
|
walk(scene.artwork.nodes);
|
|
4580
4580
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4581
4581
|
}
|
|
4582
|
-
var motionArtworkSvg = (artwork) =>
|
|
4582
|
+
var motionArtworkSvg = (artwork) => _chunkSNAFFCAXcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4583
4583
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4584
4584
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4585
4585
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4912,7 +4912,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4912
4912
|
const entry = indexMotionNodes(artwork.nodes).get(path.node);
|
|
4913
4913
|
if (!entry) throw new Error(`There is no node "${path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4914
4914
|
if (entry.node.type !== "path") throw new Error(`Node "${path.node}" is a ${entry.node.type}, not a path; pass a path node (find_animation_elements shows each node's type).`);
|
|
4915
|
-
const value2 = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4915
|
+
const value2 = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunkSNAFFCAXcjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4916
4916
|
return { control, value: value2, place: "viewBox" };
|
|
4917
4917
|
}
|
|
4918
4918
|
const provider = this.effects.require();
|
|
@@ -6214,7 +6214,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6214
6214
|
handler: ({ svg }) => {
|
|
6215
6215
|
let artwork;
|
|
6216
6216
|
try {
|
|
6217
|
-
artwork =
|
|
6217
|
+
artwork = _chunkSNAFFCAXcjs.parseVectorSvg.call(void 0, svg);
|
|
6218
6218
|
} catch (error) {
|
|
6219
6219
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6220
6220
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2XDNF73E.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-ZEI7ZEA4.js";
|
|
43
|
+
import "../chunk-UXYCY3HP.js";
|
|
44
44
|
import "../chunk-JL6YH5WD.js";
|
|
45
45
|
import "../chunk-RWDSSK2I.js";
|
|
46
46
|
import {
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
resolveEffectValues
|
|
75
75
|
} from "../chunk-MV7CYFMJ.js";
|
|
76
76
|
import "../chunk-V2ZCJRDM.js";
|
|
77
|
-
import "../chunk-
|
|
77
|
+
import "../chunk-N3SKPQEH.js";
|
|
78
78
|
import "../chunk-W6JDUXP3.js";
|
|
79
79
|
import "../chunk-ACTHSQOI.js";
|
|
80
80
|
import "../chunk-4D6KP5BV.js";
|