@pixerate/editor 0.239.0 → 0.241.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 +58 -58
- package/dist/animation-editor/index.js +3 -3
- package/dist/{brushstrokeRender-WB67GMUP.js → brushstrokeRender-MOYGEXOC.js} +2 -2
- package/dist/{brushstrokeRender-MPOM7BFW.cjs → brushstrokeRender-UKADOV5D.cjs} +5 -5
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NKTNLJUJ.cjs → chunk-5BR7LC24.cjs} +99 -11
- package/dist/{chunk-ZXNO3ZOX.cjs → chunk-7F4G74UQ.cjs} +35 -35
- package/dist/{chunk-AD7GA3TL.cjs → chunk-AFLMXITL.cjs} +23 -23
- package/dist/{chunk-PP6BXVRL.cjs → chunk-HGGJ36HR.cjs} +1 -1
- package/dist/{chunk-BBUE3UJL.cjs → chunk-HW72ABGR.cjs} +86 -86
- package/dist/{chunk-7YGBSFC6.js → chunk-ILM6GYAX.js} +1 -1
- package/dist/{chunk-THXFU3JB.cjs → chunk-KCMV2534.cjs} +2 -2
- package/dist/{chunk-3E36VDMJ.js → chunk-NE6OOKWJ.js} +1 -1
- package/dist/{chunk-RV5DKZHU.js → chunk-QP2B3MID.js} +1 -1
- package/dist/{chunk-UUBO6RB5.js → chunk-UDBDYZET.js} +1 -1
- package/dist/{chunk-PJYG6FCF.js → chunk-XBZK47LV.js} +98 -10
- package/dist/{chunk-XK4SST43.js → chunk-ZDPLZDTT.js} +1 -1
- package/dist/image-editor/index.cjs +775 -775
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/controller.d.cts +158 -1
- package/dist/paint-editor/controller.d.ts +158 -1
- package/dist/paint-editor/document.d.cts +7 -2
- package/dist/paint-editor/document.d.ts +7 -2
- package/dist/paint-editor/effect-paint.d.cts +60 -3
- package/dist/paint-editor/effect-paint.d.ts +60 -3
- package/dist/paint-editor/index.cjs +1246 -430
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +888 -72
- package/dist/paint-editor/live-strokes.d.cts +24 -0
- package/dist/paint-editor/live-strokes.d.ts +24 -0
- package/dist/paint-editor/stickers.d.cts +6 -0
- package/dist/paint-editor/stickers.d.ts +6 -0
- package/dist/paint-editor/thick.d.cts +4 -0
- package/dist/paint-editor/thick.d.ts +4 -0
- package/dist/paint-editor/ui.d.cts +24 -4
- package/dist/paint-editor/ui.d.ts +24 -4
- package/dist/paint-editor/wet.d.cts +8 -0
- package/dist/paint-editor/wet.d.ts +8 -0
- package/dist/vector/index.cjs +962 -962
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +38 -27
- package/skills/pixerate-paint-editor/references/effect-paint.md +25 -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 _chunk7F4G74UQcjs = require('../chunk-7F4G74UQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -39,8 +39,8 @@ var _chunkJWCKJNDRcjs = require('../chunk-JWCKJNDR.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../chunk-
|
|
42
|
+
var _chunkKCMV2534cjs = require('../chunk-KCMV2534.cjs');
|
|
43
|
+
require('../chunk-5BR7LC24.cjs');
|
|
44
44
|
require('../chunk-CVFAAZXE.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
@@ -697,7 +697,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
697
697
|
function motionTextLayout(nodes, id) {
|
|
698
698
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
699
699
|
if (!group || group.type !== "group") return null;
|
|
700
|
-
const letters =
|
|
700
|
+
const letters = _chunkKCMV2534cjs.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);
|
|
701
701
|
if (!letters.length) return null;
|
|
702
702
|
const lines = [];
|
|
703
703
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -782,21 +782,21 @@ function indexMotionNodes(nodes) {
|
|
|
782
782
|
const out = /* @__PURE__ */ new Map();
|
|
783
783
|
const walk = (list, parentWorld, ancestors) => {
|
|
784
784
|
for (const node of list) {
|
|
785
|
-
const local =
|
|
786
|
-
const bounds =
|
|
785
|
+
const local = _chunkKCMV2534cjs.vectorNodeBounds.call(void 0, node);
|
|
786
|
+
const bounds = _chunkKCMV2534cjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
787
787
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
788
788
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
789
|
-
if (node.type === "group") walk(node.children,
|
|
789
|
+
if (node.type === "group") walk(node.children, _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
790
790
|
}
|
|
791
791
|
};
|
|
792
|
-
walk(nodes,
|
|
792
|
+
walk(nodes, _chunkKCMV2534cjs.IDENTITY_MATRIX, []);
|
|
793
793
|
indexCache.set(nodes, out);
|
|
794
794
|
return out;
|
|
795
795
|
}
|
|
796
796
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
797
797
|
function firstPaint(node, key) {
|
|
798
798
|
if (node.type === "path") return solid(node[key]);
|
|
799
|
-
for (const p of
|
|
799
|
+
for (const p of _chunkKCMV2534cjs.collectPathNodes.call(void 0, node)) {
|
|
800
800
|
const s = solid(p[key]);
|
|
801
801
|
if (s) return s;
|
|
802
802
|
}
|
|
@@ -804,7 +804,7 @@ function firstPaint(node, key) {
|
|
|
804
804
|
}
|
|
805
805
|
function strokeReach(node) {
|
|
806
806
|
let reach = 0;
|
|
807
|
-
for (const p of node.type === "path" ? [node] :
|
|
807
|
+
for (const p of node.type === "path" ? [node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node)) {
|
|
808
808
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
809
809
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
810
810
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -874,7 +874,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
874
874
|
case "stroke":
|
|
875
875
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
876
876
|
case "strokeWidth": {
|
|
877
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
877
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkKCMV2534cjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
878
878
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
879
879
|
}
|
|
880
880
|
case "shape":
|
|
@@ -985,12 +985,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
985
985
|
const r = camera;
|
|
986
986
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
987
987
|
}
|
|
988
|
-
function motionPathLength(node, parentWorld =
|
|
988
|
+
function motionPathLength(node, parentWorld = _chunkKCMV2534cjs.IDENTITY_MATRIX) {
|
|
989
989
|
let longest = 0;
|
|
990
|
-
const paths = node.type === "path" ? [node] :
|
|
990
|
+
const paths = node.type === "path" ? [node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node);
|
|
991
991
|
for (const p of paths) {
|
|
992
992
|
try {
|
|
993
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
993
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
994
994
|
} catch (e2) {
|
|
995
995
|
}
|
|
996
996
|
}
|
|
@@ -1266,12 +1266,12 @@ function compileMotionScene(scene) {
|
|
|
1266
1266
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1267
1267
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1268
1268
|
if (order2 === "together" && pace === "time") return null;
|
|
1269
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1269
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, entry.node);
|
|
1270
1270
|
let list = paths.map((p) => {
|
|
1271
1271
|
const at = nodes.get(p.id);
|
|
1272
1272
|
let first = { x: 0, y: 0 };
|
|
1273
1273
|
try {
|
|
1274
|
-
const m =
|
|
1274
|
+
const m = _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunkKCMV2534cjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1275
1275
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1276
1276
|
} catch (e3) {
|
|
1277
1277
|
}
|
|
@@ -1383,17 +1383,17 @@ function compileMotionScene(scene) {
|
|
|
1383
1383
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1384
1384
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1385
1385
|
if (command3.to) {
|
|
1386
|
-
const inv =
|
|
1387
|
-
const target =
|
|
1386
|
+
const inv = _chunkKCMV2534cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1387
|
+
const target = _chunkKCMV2534cjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1388
1388
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1389
1389
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1390
1390
|
}
|
|
1391
1391
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1392
|
-
const inv =
|
|
1392
|
+
const inv = _chunkKCMV2534cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1393
1393
|
const x0 = num2("x");
|
|
1394
1394
|
const y0 = num2("y");
|
|
1395
1395
|
const add = command3.blend === "add";
|
|
1396
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1396
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkKCMV2534cjs.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 }];
|
|
1397
1397
|
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")));
|
|
1398
1398
|
for (const axis of ["x", "y"]) {
|
|
1399
1399
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2016,13 +2016,13 @@ function morphBetween(a, b) {
|
|
|
2016
2016
|
let inner = morphCache.get(a);
|
|
2017
2017
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2018
2018
|
let morph = inner.get(b);
|
|
2019
|
-
if (!morph) inner.set(b, morph =
|
|
2019
|
+
if (!morph) inner.set(b, morph = _chunk7F4G74UQcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2020
2020
|
return morph;
|
|
2021
2021
|
}
|
|
2022
2022
|
function shapeIn(entry, shape) {
|
|
2023
2023
|
if (shape === entry) return entry.node;
|
|
2024
|
-
const m =
|
|
2025
|
-
return { ...shape.node, ...
|
|
2024
|
+
const m = _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkKCMV2534cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2025
|
+
return { ...shape.node, ..._chunkKCMV2534cjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2026
2026
|
}
|
|
2027
2027
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2028
2028
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2042,7 +2042,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2042
2042
|
function motionFollowRoute(entry, path) {
|
|
2043
2043
|
if (!path || path.node.type !== "path") return null;
|
|
2044
2044
|
try {
|
|
2045
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2045
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkKCMV2534cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2046
2046
|
} catch (e6) {
|
|
2047
2047
|
return null;
|
|
2048
2048
|
}
|
|
@@ -2076,9 +2076,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2076
2076
|
const scaleX = read("scaleX", 1);
|
|
2077
2077
|
const scaleY = read("scaleY", 1);
|
|
2078
2078
|
const c = entry.center;
|
|
2079
|
-
let matrix =
|
|
2079
|
+
let matrix = _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkKCMV2534cjs.rotateMatrix.call(void 0, rotation, c)), _chunkKCMV2534cjs.translateMatrix.call(void 0, dx, dy));
|
|
2080
2080
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2081
|
-
if (along) matrix =
|
|
2081
|
+
if (along) matrix = _chunkKCMV2534cjs.multiplyMatrices.call(void 0, matrix, _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkKCMV2534cjs.rotateMatrix.call(void 0, along.angle)), _chunkKCMV2534cjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2082
2082
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2083
2083
|
}
|
|
2084
2084
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2145,7 +2145,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2145
2145
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2146
2146
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2147
2147
|
if (start > 0 || end < 1) {
|
|
2148
|
-
const trim =
|
|
2148
|
+
const trim = _chunkKCMV2534cjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2149
2149
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
@@ -2159,8 +2159,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2159
2159
|
if (o >= 1) delete out.opacity;
|
|
2160
2160
|
}
|
|
2161
2161
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2162
|
-
if (offset && !
|
|
2163
|
-
const m =
|
|
2162
|
+
if (offset && !_chunkKCMV2534cjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2163
|
+
const m = _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _chunkKCMV2534cjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2164
2164
|
out = { ...out, transform: m };
|
|
2165
2165
|
}
|
|
2166
2166
|
return out;
|
|
@@ -2181,8 +2181,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2181
2181
|
const wrap = { ...options.wrap };
|
|
2182
2182
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2183
2183
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2184
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2185
|
-
const art =
|
|
2184
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunkKCMV2534cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2185
|
+
const art = _chunkKCMV2534cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2186
2186
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2187
2187
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2188
2188
|
if (transition) {
|
|
@@ -2373,8 +2373,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2373
2373
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2374
2374
|
const circle = clip("clipCircle");
|
|
2375
2375
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2376
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2377
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2376
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2377
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkKCMV2534cjs.collectPathNodes.call(void 0, node).length === 0 || _chunkKCMV2534cjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2378
2378
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2379
2379
|
return typeof v !== "number" || v > 0.01;
|
|
2380
2380
|
}));
|
|
@@ -2461,7 +2461,7 @@ function checkMotionScene(scene) {
|
|
|
2461
2461
|
}
|
|
2462
2462
|
for (const id of targets) {
|
|
2463
2463
|
const node = nodes.get(id).node;
|
|
2464
|
-
const paths = node.type === "path" ? [node] :
|
|
2464
|
+
const paths = node.type === "path" ? [node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node);
|
|
2465
2465
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2466
2466
|
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] }));
|
|
2467
2467
|
}
|
|
@@ -2474,7 +2474,7 @@ function checkMotionScene(scene) {
|
|
|
2474
2474
|
else
|
|
2475
2475
|
for (const id of targets) {
|
|
2476
2476
|
const node = nodes.get(id).node;
|
|
2477
|
-
const paths = node.type === "path" ? [node] :
|
|
2477
|
+
const paths = node.type === "path" ? [node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node);
|
|
2478
2478
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2479
2479
|
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] }));
|
|
2480
2480
|
}
|
|
@@ -2919,7 +2919,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2919
2919
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2920
2920
|
const timeline = compileMotionScene(scene);
|
|
2921
2921
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2922
|
-
const centre =
|
|
2922
|
+
const centre = _chunkKCMV2534cjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2923
2923
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2924
2924
|
const fill = paint("fill");
|
|
2925
2925
|
const stroke = paint("stroke");
|
|
@@ -3266,7 +3266,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3266
3266
|
raw: (t) => transformAt(t, true)
|
|
3267
3267
|
});
|
|
3268
3268
|
}
|
|
3269
|
-
const paths = node.type === "path" ? [node] :
|
|
3269
|
+
const paths = node.type === "path" ? [node] : _chunkKCMV2534cjs.collectPathNodes.call(void 0, node);
|
|
3270
3270
|
for (const path of paths) {
|
|
3271
3271
|
if (pathsSeen.has(path.id)) continue;
|
|
3272
3272
|
pathsSeen.add(path.id);
|
|
@@ -3288,7 +3288,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3288
3288
|
if (shapeSegments.length) {
|
|
3289
3289
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
3290
3290
|
else {
|
|
3291
|
-
const inverse =
|
|
3291
|
+
const inverse = _chunkKCMV2534cjs.invertMatrix.call(void 0, _chunkKCMV2534cjs.nodeMatrix.call(void 0, node));
|
|
3292
3292
|
channels.push({
|
|
3293
3293
|
id,
|
|
3294
3294
|
kind: "attr",
|
|
@@ -3297,9 +3297,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3297
3297
|
exact: () => false,
|
|
3298
3298
|
value: (t) => {
|
|
3299
3299
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3300
|
-
const now =
|
|
3300
|
+
const now = _chunkKCMV2534cjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3301
3301
|
if (!now || now.type !== "path") return "";
|
|
3302
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3302
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, now, _chunkKCMV2534cjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3303
3303
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3304
3304
|
}
|
|
3305
3305
|
});
|
|
@@ -3439,7 +3439,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3439
3439
|
}
|
|
3440
3440
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3441
3441
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3442
|
-
let svg =
|
|
3442
|
+
let svg = _chunkKCMV2534cjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkKCMV2534cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3443
3443
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3444
3444
|
let motion = { svg, animate };
|
|
3445
3445
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3537,14 +3537,14 @@ function easingOf(ease, fallback) {
|
|
|
3537
3537
|
return fallback;
|
|
3538
3538
|
}
|
|
3539
3539
|
function poseOf(value, entry) {
|
|
3540
|
-
const t =
|
|
3541
|
-
const o =
|
|
3540
|
+
const t = _chunkKCMV2534cjs.parseSvgTransform.call(void 0, String(value));
|
|
3541
|
+
const o = _chunkKCMV2534cjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkKCMV2534cjs.invertMatrix.call(void 0, _chunkKCMV2534cjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3542
3542
|
const sx = Math.hypot(o[0], o[1]);
|
|
3543
3543
|
if (!(sx > 1e-9)) return null;
|
|
3544
3544
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3545
3545
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3546
3546
|
const c = entry.center;
|
|
3547
|
-
const moved =
|
|
3547
|
+
const moved = _chunkKCMV2534cjs.applyMatrix.call(void 0, o, c);
|
|
3548
3548
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3549
3549
|
}
|
|
3550
3550
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3629,7 +3629,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3629
3629
|
const notes = [];
|
|
3630
3630
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3631
3631
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3632
|
-
const artwork =
|
|
3632
|
+
const artwork = _chunkKCMV2534cjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3633
3633
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3634
3634
|
const byStep = /* @__PURE__ */ new Map();
|
|
3635
3635
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3876,9 +3876,9 @@ function toLottie(scene, options = {}) {
|
|
|
3876
3876
|
const items = [];
|
|
3877
3877
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3878
3878
|
const geometryAt = (t) => {
|
|
3879
|
-
if (!shapeSegments.length) return
|
|
3879
|
+
if (!shapeSegments.length) return _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3880
3880
|
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]);
|
|
3881
|
-
return now && now.type === "path" ?
|
|
3881
|
+
return now && now.type === "path" ? _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, _chunkKCMV2534cjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkKCMV2534cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3882
3882
|
};
|
|
3883
3883
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3884
3884
|
rest.forEach((contour, n2) => {
|
|
@@ -3951,13 +3951,13 @@ function toLottie(scene, options = {}) {
|
|
|
3951
3951
|
const innerTr = STATIC_TR();
|
|
3952
3952
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3953
3953
|
else if (node.type === "text" || node.type === "instance") {
|
|
3954
|
-
const drawn =
|
|
3954
|
+
const drawn = _chunkKCMV2534cjs.expandVectorAppearance.call(void 0, node);
|
|
3955
3955
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3956
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3956
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkKCMV2534cjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3957
3957
|
} else {
|
|
3958
3958
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3959
|
-
const m =
|
|
3960
|
-
if (m !==
|
|
3959
|
+
const m = _chunkKCMV2534cjs.nodeMatrix.call(void 0, node);
|
|
3960
|
+
if (m !== _chunkKCMV2534cjs.IDENTITY_MATRIX) {
|
|
3961
3961
|
const parts = staticParts(m);
|
|
3962
3962
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3963
3963
|
else {
|
|
@@ -3970,7 +3970,7 @@ function toLottie(scene, options = {}) {
|
|
|
3970
3970
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3971
3971
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3972
3972
|
};
|
|
3973
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3973
|
+
const artwork = { ...scene.artwork, nodes: _chunkKCMV2534cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3974
3974
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3975
3975
|
if (artwork.background && rgba(artwork.background))
|
|
3976
3976
|
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()] });
|
|
@@ -4069,11 +4069,11 @@ function preset(prst, w, h) {
|
|
|
4069
4069
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4070
4070
|
switch (prst) {
|
|
4071
4071
|
case "rect":
|
|
4072
|
-
return [
|
|
4072
|
+
return [_chunkKCMV2534cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4073
4073
|
case "roundRect":
|
|
4074
|
-
return [
|
|
4074
|
+
return [_chunkKCMV2534cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4075
4075
|
case "ellipse":
|
|
4076
|
-
return [
|
|
4076
|
+
return [_chunkKCMV2534cjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4077
4077
|
case "triangle":
|
|
4078
4078
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4079
4079
|
case "rtTriangle":
|
|
@@ -4181,7 +4181,7 @@ function shapes(ctx, tree, map) {
|
|
|
4181
4181
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4182
4182
|
if (!subpaths) {
|
|
4183
4183
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4184
|
-
subpaths = [
|
|
4184
|
+
subpaths = [_chunkKCMV2534cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4185
4185
|
}
|
|
4186
4186
|
const style = kid(el, "style");
|
|
4187
4187
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4570,7 +4570,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4570
4570
|
walk(scene.artwork.nodes);
|
|
4571
4571
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4572
4572
|
}
|
|
4573
|
-
var motionArtworkSvg = (artwork) =>
|
|
4573
|
+
var motionArtworkSvg = (artwork) => _chunkKCMV2534cjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4574
4574
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4575
4575
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4576
4576
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -6142,7 +6142,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6142
6142
|
handler: ({ svg }) => {
|
|
6143
6143
|
let artwork;
|
|
6144
6144
|
try {
|
|
6145
|
-
artwork =
|
|
6145
|
+
artwork = _chunkKCMV2534cjs.parseVectorSvg.call(void 0, svg);
|
|
6146
6146
|
} catch (error) {
|
|
6147
6147
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6148
6148
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZDPLZDTT.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-ILM6GYAX.js";
|
|
43
|
+
import "../chunk-XBZK47LV.js";
|
|
44
44
|
import "../chunk-M6DNZNVY.js";
|
|
45
45
|
import {
|
|
46
46
|
bezierPathLength,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathDataToPolyline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QP2B3MID.js";
|
|
4
4
|
import {
|
|
5
5
|
parseCssColor
|
|
6
6
|
} from "./chunk-3CI7FRMK.js";
|
|
7
7
|
import {
|
|
8
8
|
BUILTIN_BRUSHES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XBZK47LV.js";
|
|
10
10
|
import {
|
|
11
11
|
formatNumber,
|
|
12
12
|
getShapeSvg,
|
|
@@ -1,12 +1,12 @@
|
|
|
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; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHGGJ36HRcjs = require('./chunk-HGGJ36HR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk5BR7LC24cjs = require('./chunk-5BR7LC24.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -26,14 +26,14 @@ require('./chunk-7AHBW2CQ.cjs');
|
|
|
26
26
|
require('./chunk-IPJ3TEYR.cjs');
|
|
27
27
|
|
|
28
28
|
// src/canvas/brushstrokeRender.ts
|
|
29
|
-
var DRY =
|
|
29
|
+
var DRY = _chunk5BR7LC24cjs.BUILTIN_BRUSHES.filter((b) => _chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, b));
|
|
30
30
|
function listCanvasBrushes() {
|
|
31
31
|
return DRY.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size }));
|
|
32
32
|
}
|
|
33
33
|
function resolveCanvasBrush(brush, width) {
|
|
34
34
|
const given = width !== void 0 && Number.isFinite(width) ? Math.max(1, width) : void 0;
|
|
35
35
|
if (typeof brush === "string") {
|
|
36
|
-
const preset =
|
|
36
|
+
const preset = _chunk5BR7LC24cjs.BUILTIN_BRUSHES.find((b) => b.id === brush);
|
|
37
37
|
const ids = DRY.map((b) => b.id).join(", ");
|
|
38
38
|
if (!preset) throw new Error(`Unknown brush '${brush}'. Use one of the dry paint presets (${ids}) or tip settings ({ hardness, spacing, flow, \u2026 }).`);
|
|
39
39
|
if (!_chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, preset)) {
|
|
@@ -75,7 +75,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
75
75
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
76
76
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
77
77
|
const brush = resolveCanvasBrush(shape.brush.brush, size);
|
|
78
|
-
const points =
|
|
78
|
+
const points = _chunkHGGJ36HRcjs.pathDataToPolyline.call(void 0, shape.d);
|
|
79
79
|
if (!points.length) return null;
|
|
80
80
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
81
81
|
const input = {
|