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