@pixerate/editor 0.129.0 → 0.130.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 +55 -55
- package/dist/animation-editor/index.d.cts +5 -5
- package/dist/animation-editor/index.d.ts +5 -5
- package/dist/animation-editor/index.js +2 -2
- package/dist/{bezier-CvgQiYRg.d.cts → bezier-CdoGygwG.d.cts} +1 -1
- package/dist/{bezier-DP4NnJp3.d.ts → bezier-CigmusV_.d.ts} +1 -1
- package/dist/canvas/index.d.cts +7 -7
- package/dist/canvas/index.d.ts +7 -7
- package/dist/{chunk-BEGEWQHD.cjs → chunk-2PXRKMOH.cjs} +36 -36
- package/dist/{chunk-BEGEWQHD.cjs.map → chunk-2PXRKMOH.cjs.map} +1 -1
- package/dist/{chunk-F7Q2NE2Y.js → chunk-ERYGCA72.js} +2 -2
- package/dist/{chunk-A6KHMKI4.js → chunk-L5OTIYOO.js} +2 -2
- package/dist/{chunk-ORE334I6.cjs → chunk-LXGOYRPE.cjs} +366 -68
- package/dist/chunk-LXGOYRPE.cjs.map +1 -0
- package/dist/{chunk-XLUYXUBD.cjs → chunk-PMHPXCJC.cjs} +82 -82
- package/dist/{chunk-XLUYXUBD.cjs.map → chunk-PMHPXCJC.cjs.map} +1 -1
- package/dist/{chunk-ROZFX4QI.js → chunk-PRYMC442.js} +302 -4
- package/dist/chunk-PRYMC442.js.map +1 -0
- package/dist/effects/index.d.cts +4 -4
- package/dist/effects/index.d.ts +4 -4
- package/dist/{export-Cbr9IqpJ.d.cts → export-5WDKJqTy.d.cts} +1 -1
- package/dist/{export-DotEEyXj.d.ts → export-B4r8b9Ft.d.ts} +3 -3
- package/dist/{export-ClPKUB-v.d.ts → export-CU_ARP3A.d.ts} +1 -1
- package/dist/{export-DRzNhrdx.d.cts → export-CejjC2iI.d.cts} +3 -3
- package/dist/{helpers-C5aAd44p.d.cts → helpers-CzZu51eI.d.cts} +33 -2
- package/dist/{helpers-CPWcK504.d.ts → helpers-X_rycLNJ.d.ts} +33 -2
- package/dist/image-editor/index.cjs +606 -606
- package/dist/image-editor/index.d.cts +8 -8
- package/dist/image-editor/index.d.ts +8 -8
- package/dist/image-editor/index.js +2 -2
- package/dist/{opentype-sQrF3Ry1.d.ts → opentype-CrHAsKh3.d.ts} +2 -2
- package/dist/{opentype-BOewaGQx.d.cts → opentype-DlRMYcCW.d.cts} +2 -2
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.d.cts +5 -5
- package/dist/paint-editor/index.d.ts +5 -5
- package/dist/paint-editor/index.js +2 -2
- package/dist/{pathfinder-CnkW7zLI.d.cts → pathfinder-CKfKOVP4.d.cts} +1 -1
- package/dist/{pathfinder-BwJx0_zM.d.ts → pathfinder-Dlss70hL.d.ts} +1 -1
- package/dist/{pool-CTrtciaN.d.ts → pool-DDOo0xJH.d.ts} +1 -1
- package/dist/{pool-C7GtrL34.d.cts → pool-DKic69LD.d.cts} +1 -1
- package/dist/{svg-C4LlFnEw.d.cts → svg-BRaii3pI.d.cts} +2 -2
- package/dist/{svg-CUzZa0EO.d.ts → svg-BYVZeVo0.d.ts} +2 -2
- package/dist/{tools-BpCmUNxb.d.cts → tools-CtheDLDr.d.cts} +1 -1
- package/dist/{tools-AugT22z3.d.ts → tools-D8bZ-7YG.d.ts} +1 -1
- package/dist/vector/index.cjs +884 -874
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +53 -10
- package/dist/vector/index.d.ts +53 -10
- package/dist/vector/index.js +15 -5
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +4 -4
- package/dist/video-editor/index.d.ts +4 -4
- package/dist/{warp-D62N_5VK.d.cts → warp-BFoYxy_s.d.cts} +2 -2
- package/dist/{warp-CIsO617e.d.ts → warp-CZVC8pB5.d.ts} +2 -2
- package/package.json +1 -1
- package/skills/pixerate-vector/SKILL.md +1 -1
- package/skills/pixerate-vector/references/commands.md +1 -0
- package/dist/chunk-ORE334I6.cjs.map +0 -1
- package/dist/chunk-ROZFX4QI.js.map +0 -1
- /package/dist/{chunk-F7Q2NE2Y.js.map → chunk-ERYGCA72.js.map} +0 -0
- /package/dist/{chunk-A6KHMKI4.js.map → chunk-L5OTIYOO.js.map} +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
pathBoolean,
|
|
13
13
|
pathToContours,
|
|
14
14
|
pointInBezierPath,
|
|
15
|
+
pointInRings,
|
|
15
16
|
polygonBoolean,
|
|
16
17
|
segmentBounds,
|
|
17
18
|
segmentDerivative,
|
|
@@ -124,7 +125,7 @@ var VECTOR_TOOLS = [
|
|
|
124
125
|
];
|
|
125
126
|
var VECTOR_TRANSFORM_HANDLES = ["nw", "n", "ne", "e", "se", "s", "sw", "w", "rotate"];
|
|
126
127
|
var VECTOR_PATHFINDER_OPERATIONS = ["divide", "trim", "merge", "crop", "outline", "minusBack"];
|
|
127
|
-
var VECTOR_EFFECT_TYPES = ["trim", "roundCorners", "puckerBloat", "twist", "zigzag", "wiggle", "offset", "merge", "repeater", "envelope", "contour", "blockShadow"];
|
|
128
|
+
var VECTOR_EFFECT_TYPES = ["trim", "roundCorners", "puckerBloat", "twist", "zigzag", "wiggle", "offset", "merge", "repeater", "envelope", "contour", "blockShadow", "extrude", "bevel"];
|
|
128
129
|
var VECTOR_MERGE_MODES = ["merge", "add", "subtract", "intersect", "exclude"];
|
|
129
130
|
var VECTOR_FILTER_TYPES = ["dropShadow", "innerShadow", "outerGlow", "innerGlow", "layerBlur", "feather"];
|
|
130
131
|
|
|
@@ -5550,6 +5551,227 @@ function vectorInstanceGroup(node, bake) {
|
|
|
5550
5551
|
}
|
|
5551
5552
|
var composeVectorMatrices = (a, b) => multiplyMatrices(a, b);
|
|
5552
5553
|
|
|
5554
|
+
// src/vector/extrude.ts
|
|
5555
|
+
function vectorPaintSolid(paint) {
|
|
5556
|
+
if (paint == null || paint === "none") return null;
|
|
5557
|
+
if (typeof paint === "string") return paint;
|
|
5558
|
+
const stops = paint.stops;
|
|
5559
|
+
if (stops?.length) return stops.reduce((a, b) => Math.abs(b.offset - 0.5) < Math.abs(a.offset - 0.5) ? b : a).color;
|
|
5560
|
+
const colors = paint.colors;
|
|
5561
|
+
if (colors?.length) return colors[0];
|
|
5562
|
+
const points = paint.points;
|
|
5563
|
+
return points?.find((p) => typeof p.color === "string")?.color ?? null;
|
|
5564
|
+
}
|
|
5565
|
+
function shadeVectorColor(color2, amount) {
|
|
5566
|
+
const c = parseVectorColor(color2);
|
|
5567
|
+
if (!c) return color2;
|
|
5568
|
+
const a = Math.min(1, Math.max(-1, amount));
|
|
5569
|
+
const target = a >= 0 ? 1 : 0;
|
|
5570
|
+
const h = (v2) => Math.round(Math.min(1, Math.max(0, v2)) * 255).toString(16).padStart(2, "0");
|
|
5571
|
+
const m = [0, 1, 2].map((k) => c[k] + (target - c[k]) * Math.abs(a));
|
|
5572
|
+
return `#${h(m[0])}${h(m[1])}${h(m[2])}`;
|
|
5573
|
+
}
|
|
5574
|
+
function vectorPathRings(path, tolerance = 0.5) {
|
|
5575
|
+
const rings = [];
|
|
5576
|
+
for (const contour of pathToContours(path)) {
|
|
5577
|
+
const ring = flattenChain(closeContour(contour, true), Math.max(1e-3, tolerance));
|
|
5578
|
+
if (ring.length >= 2) rings.push(ring);
|
|
5579
|
+
}
|
|
5580
|
+
return rings;
|
|
5581
|
+
}
|
|
5582
|
+
function vectorExtrudeFaces(path, params) {
|
|
5583
|
+
const box = bezierPathBounds(path);
|
|
5584
|
+
if (!box || !path.length) return [];
|
|
5585
|
+
const perspective = params.mode === "perspective";
|
|
5586
|
+
const rad2 = params.angle * Math.PI / 180;
|
|
5587
|
+
const d = [Math.cos(rad2) * Math.max(0, params.depth), Math.sin(rad2) * Math.max(0, params.depth)];
|
|
5588
|
+
const vp = [(box.minX + box.maxX) / 2 + params.vanishingPoint.x, (box.minY + box.maxY) / 2 + params.vanishingPoint.y];
|
|
5589
|
+
const pull = Math.min(1, Math.max(0, params.toward / 100));
|
|
5590
|
+
const back = (p) => perspective ? [p[0] + (vp[0] - p[0]) * pull, p[1] + (vp[1] - p[1]) * pull] : [p[0] + d[0], p[1] + d[1]];
|
|
5591
|
+
if (perspective ? pull <= 0 : Math.hypot(d[0], d[1]) < 1e-9) return [];
|
|
5592
|
+
const lr = params.lightAngle * Math.PI / 180;
|
|
5593
|
+
const light = [Math.cos(lr), Math.sin(lr)];
|
|
5594
|
+
const strength = Math.min(1, Math.max(0, params.shading / 100));
|
|
5595
|
+
const u = perspective ? [0, 0] : [d[0] / Math.hypot(d[0], d[1]), d[1] / Math.hypot(d[0], d[1])];
|
|
5596
|
+
const centre = [(box.minX + box.maxX) / 2, (box.minY + box.maxY) / 2];
|
|
5597
|
+
const aim = Math.atan2(centre[1] - vp[1], centre[0] - vp[0]);
|
|
5598
|
+
const across = (p) => {
|
|
5599
|
+
if (!perspective) return -p[0] * u[1] + p[1] * u[0];
|
|
5600
|
+
let a = Math.atan2(p[1] - vp[1], p[0] - vp[0]) - aim;
|
|
5601
|
+
while (a > Math.PI) a -= 2 * Math.PI;
|
|
5602
|
+
while (a <= -Math.PI) a += 2 * Math.PI;
|
|
5603
|
+
return a;
|
|
5604
|
+
};
|
|
5605
|
+
const towardBack = (p, q, l) => {
|
|
5606
|
+
const lp = across(p);
|
|
5607
|
+
const lq = across(q);
|
|
5608
|
+
const t = Math.abs(lq - lp) < 1e-12 ? 0.5 : Math.min(1, Math.max(0, (l - lp) / (lq - lp)));
|
|
5609
|
+
const x = [p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t];
|
|
5610
|
+
return perspective ? -Math.hypot(vp[0] - x[0], vp[1] - x[1]) : x[0] * u[0] + x[1] * u[1];
|
|
5611
|
+
};
|
|
5612
|
+
const faces = [];
|
|
5613
|
+
for (const ring of vectorPathRings(path, 0.25)) {
|
|
5614
|
+
for (let i = 0; i < ring.length; i++) {
|
|
5615
|
+
const p = ring[i];
|
|
5616
|
+
const q = ring[(i + 1) % ring.length];
|
|
5617
|
+
const ex = q[0] - p[0];
|
|
5618
|
+
const ey = q[1] - p[1];
|
|
5619
|
+
const len2 = Math.hypot(ex, ey);
|
|
5620
|
+
if (len2 < 1e-9) continue;
|
|
5621
|
+
const pb = back(p);
|
|
5622
|
+
const qb = back(q);
|
|
5623
|
+
const mid = [(p[0] + q[0]) / 2, (p[1] + q[1]) / 2];
|
|
5624
|
+
const away = perspective ? [vp[0] - mid[0], vp[1] - mid[1]] : d;
|
|
5625
|
+
let n2 = [ey / len2, -ex / len2];
|
|
5626
|
+
if (n2[0] * away[0] + n2[1] * away[1] < 0) n2 = [-n2[0], -n2[1]];
|
|
5627
|
+
const shade = (n2[0] * light[0] + n2[1] * light[1]) * strength;
|
|
5628
|
+
const lp = across(p);
|
|
5629
|
+
const lq = across(q);
|
|
5630
|
+
faces.push({
|
|
5631
|
+
p,
|
|
5632
|
+
q,
|
|
5633
|
+
lo: Math.min(lp, lq),
|
|
5634
|
+
hi: Math.max(lp, lq),
|
|
5635
|
+
key: towardBack(p, q, (lp + lq) / 2),
|
|
5636
|
+
face: {
|
|
5637
|
+
shade,
|
|
5638
|
+
path: [{ type: "M", x: p[0], y: p[1] }, { type: "L", x: q[0], y: q[1] }, { type: "L", x: qb[0], y: qb[1] }, { type: "L", x: pb[0], y: pb[1] }, { type: "Z" }]
|
|
5639
|
+
}
|
|
5640
|
+
});
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
faces.sort((a, b) => a.key - b.key);
|
|
5644
|
+
const n = faces.length;
|
|
5645
|
+
const after = faces.map(() => []);
|
|
5646
|
+
const before = new Array(n).fill(0);
|
|
5647
|
+
const eps = 1e-9;
|
|
5648
|
+
for (let i = 0; i < n; i++) {
|
|
5649
|
+
for (let j = i + 1; j < n; j++) {
|
|
5650
|
+
const lo = Math.max(faces[i].lo, faces[j].lo);
|
|
5651
|
+
const hi = Math.min(faces[i].hi, faces[j].hi);
|
|
5652
|
+
if (hi - lo <= eps * Math.max(1, Math.abs(hi))) continue;
|
|
5653
|
+
const l = (lo + hi) / 2;
|
|
5654
|
+
const di = towardBack(faces[i].p, faces[i].q, l);
|
|
5655
|
+
const dj = towardBack(faces[j].p, faces[j].q, l);
|
|
5656
|
+
if (Math.abs(di - dj) < 1e-9) continue;
|
|
5657
|
+
const [back0, front] = di < dj ? [i, j] : [j, i];
|
|
5658
|
+
after[back0].push(front);
|
|
5659
|
+
before[front]++;
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
const order = [];
|
|
5663
|
+
const done = new Array(n).fill(false);
|
|
5664
|
+
let next = 0;
|
|
5665
|
+
while (order.length < n) {
|
|
5666
|
+
let pick = -1;
|
|
5667
|
+
for (let i = next; i < n; i++) {
|
|
5668
|
+
if (!done[i] && before[i] === 0) {
|
|
5669
|
+
pick = i;
|
|
5670
|
+
break;
|
|
5671
|
+
}
|
|
5672
|
+
}
|
|
5673
|
+
if (pick < 0) pick = done.indexOf(false);
|
|
5674
|
+
done[pick] = true;
|
|
5675
|
+
order.push(pick);
|
|
5676
|
+
for (const k of after[pick]) before[k]--;
|
|
5677
|
+
while (next < n && done[next]) next++;
|
|
5678
|
+
}
|
|
5679
|
+
return order.map((i) => faces[i].face);
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5682
|
+
// src/vector/bevel.ts
|
|
5683
|
+
var MITER_LIMIT = 4;
|
|
5684
|
+
function crossing2(a, b, c, d) {
|
|
5685
|
+
const rx = b[0] - a[0];
|
|
5686
|
+
const ry = b[1] - a[1];
|
|
5687
|
+
const sx = d[0] - c[0];
|
|
5688
|
+
const sy = d[1] - c[1];
|
|
5689
|
+
const den = rx * sy - ry * sx;
|
|
5690
|
+
if (Math.abs(den) < 1e-12) return null;
|
|
5691
|
+
const t = ((c[0] - a[0]) * sy - (c[1] - a[1]) * sx) / den;
|
|
5692
|
+
const u = ((c[0] - a[0]) * ry - (c[1] - a[1]) * rx) / den;
|
|
5693
|
+
return t > 1e-9 && t <= 1 && u >= 0 && u <= 1 ? t : null;
|
|
5694
|
+
}
|
|
5695
|
+
function vectorBevelFaces(path, params, fillRule = "nonzero") {
|
|
5696
|
+
const width = Math.max(0, params.width);
|
|
5697
|
+
if (!path.length || width <= 0) return [];
|
|
5698
|
+
const rings = vectorPathRings(path, 0.25).filter((r) => r.length >= 3);
|
|
5699
|
+
const lr = params.lightAngle * Math.PI / 180;
|
|
5700
|
+
const light = [Math.cos(lr), Math.sin(lr)];
|
|
5701
|
+
const strength = Math.min(1, Math.max(0, params.shading / 100));
|
|
5702
|
+
const faces = [];
|
|
5703
|
+
for (const ring of rings) {
|
|
5704
|
+
const n = ring.length;
|
|
5705
|
+
let best = 0;
|
|
5706
|
+
let bestLen = -1;
|
|
5707
|
+
for (let i = 0; i < n; i++) {
|
|
5708
|
+
const q = ring[(i + 1) % n];
|
|
5709
|
+
const l = Math.hypot(q[0] - ring[i][0], q[1] - ring[i][1]);
|
|
5710
|
+
if (l > bestLen) [best, bestLen] = [i, l];
|
|
5711
|
+
}
|
|
5712
|
+
if (bestLen < 1e-9) continue;
|
|
5713
|
+
const bp = ring[best];
|
|
5714
|
+
const bq = ring[(best + 1) % n];
|
|
5715
|
+
const left2 = [-(bq[1] - bp[1]) / bestLen, (bq[0] - bp[0]) / bestLen];
|
|
5716
|
+
const probe = Math.min(bestLen / 4, 1e-3 * Math.max(1, bestLen));
|
|
5717
|
+
const sign = pointInRings([(bp[0] + bq[0]) / 2 + left2[0] * probe, (bp[1] + bq[1]) / 2 + left2[1] * probe], rings, fillRule) ? 1 : -1;
|
|
5718
|
+
const normals = ring.map((p, i) => {
|
|
5719
|
+
const q = ring[(i + 1) % n];
|
|
5720
|
+
const l = Math.hypot(q[0] - p[0], q[1] - p[1]);
|
|
5721
|
+
return l < 1e-9 ? null : [-(q[1] - p[1]) / l * sign, (q[0] - p[0]) / l * sign];
|
|
5722
|
+
});
|
|
5723
|
+
const normalAt = (i, step) => {
|
|
5724
|
+
for (let k = 0; k < n; k++) {
|
|
5725
|
+
const v2 = normals[((i + step * k) % n + n) % n];
|
|
5726
|
+
if (v2) return v2;
|
|
5727
|
+
}
|
|
5728
|
+
return [0, 0];
|
|
5729
|
+
};
|
|
5730
|
+
const inset = ring.map((p, i) => {
|
|
5731
|
+
const a = normalAt(i - 1, -1);
|
|
5732
|
+
const b = normalAt(i, 1);
|
|
5733
|
+
let bx = a[0] + b[0];
|
|
5734
|
+
let by = a[1] + b[1];
|
|
5735
|
+
const bl = Math.hypot(bx, by);
|
|
5736
|
+
if (bl < 1e-9) [bx, by] = [b[0], b[1]];
|
|
5737
|
+
else [bx, by] = [bx / bl, by / bl];
|
|
5738
|
+
const cos = bx * b[0] + by * b[1];
|
|
5739
|
+
let len2 = width / Math.max(cos, 1 / MITER_LIMIT);
|
|
5740
|
+
const end = [p[0] + bx * len2, p[1] + by * len2];
|
|
5741
|
+
let t = 1;
|
|
5742
|
+
for (const other of rings) {
|
|
5743
|
+
const m = other.length;
|
|
5744
|
+
for (let j = 0; j < m; j++) {
|
|
5745
|
+
const c = other[j];
|
|
5746
|
+
const d = other[(j + 1) % m];
|
|
5747
|
+
if (c === p || d === p) continue;
|
|
5748
|
+
const hit = crossing2(p, end, c, d);
|
|
5749
|
+
if (hit !== null && hit < t) t = hit;
|
|
5750
|
+
}
|
|
5751
|
+
}
|
|
5752
|
+
if (t < 1) len2 *= t / 2;
|
|
5753
|
+
return [p[0] + bx * len2, p[1] + by * len2];
|
|
5754
|
+
});
|
|
5755
|
+
for (let i = 0; i < n; i++) {
|
|
5756
|
+
const nrm = normals[i];
|
|
5757
|
+
if (!nrm) continue;
|
|
5758
|
+
const j = (i + 1) % n;
|
|
5759
|
+
const shade = (-nrm[0] * light[0] - nrm[1] * light[1]) * strength;
|
|
5760
|
+
faces.push({
|
|
5761
|
+
shade,
|
|
5762
|
+
path: [
|
|
5763
|
+
{ type: "M", x: ring[i][0], y: ring[i][1] },
|
|
5764
|
+
{ type: "L", x: ring[j][0], y: ring[j][1] },
|
|
5765
|
+
{ type: "L", x: inset[j][0], y: inset[j][1] },
|
|
5766
|
+
{ type: "L", x: inset[i][0], y: inset[i][1] },
|
|
5767
|
+
{ type: "Z" }
|
|
5768
|
+
]
|
|
5769
|
+
});
|
|
5770
|
+
}
|
|
5771
|
+
}
|
|
5772
|
+
return faces;
|
|
5773
|
+
}
|
|
5774
|
+
|
|
5553
5775
|
// src/geom/warp.ts
|
|
5554
5776
|
var WARP_STYLES = [
|
|
5555
5777
|
"arc",
|
|
@@ -6269,7 +6491,9 @@ var VECTOR_EFFECT_DEFAULTS = {
|
|
|
6269
6491
|
},
|
|
6270
6492
|
envelope: { style: "arc", bend: 50, horizontal: 0, vertical: 0, orientation: "horizontal", rows: 2, columns: 2, mesh: null },
|
|
6271
6493
|
contour: { direction: "inside", steps: 4, offset: 6, join: "round", miterLimit: 4, fillColor: "#ffffff", strokeColor: null, acceleration: 0 },
|
|
6272
|
-
blockShadow: { angle: 45, distance: 20, color: "#1e293b", opacity: 100, endOpacity: 100 }
|
|
6494
|
+
blockShadow: { angle: 45, distance: 20, color: "#1e293b", opacity: 100, endOpacity: 100 },
|
|
6495
|
+
extrude: { mode: "parallel", angle: 45, depth: 30, vanishingPoint: { x: 0, y: -300 }, toward: 30, color: null, lightAngle: -135, shading: 60 },
|
|
6496
|
+
bevel: { width: 8, lightAngle: -135, shading: 60, color: null }
|
|
6273
6497
|
};
|
|
6274
6498
|
var VECTOR_EFFECT_LABELS = {
|
|
6275
6499
|
trim: "Trim Paths",
|
|
@@ -6283,7 +6507,9 @@ var VECTOR_EFFECT_LABELS = {
|
|
|
6283
6507
|
repeater: "Repeater",
|
|
6284
6508
|
envelope: "Envelope",
|
|
6285
6509
|
contour: "Contour",
|
|
6286
|
-
blockShadow: "Block Shadow"
|
|
6510
|
+
blockShadow: "Block Shadow",
|
|
6511
|
+
extrude: "Extrude",
|
|
6512
|
+
bevel: "Bevel"
|
|
6287
6513
|
};
|
|
6288
6514
|
var VECTOR_EFFECT_PARAM_SPECS = {
|
|
6289
6515
|
trim: [
|
|
@@ -6385,6 +6611,30 @@ var VECTOR_EFFECT_PARAM_SPECS = {
|
|
|
6385
6611
|
{ key: "opacity", label: "Opacity %", kind: "number", min: 0, max: 100, step: 1, slider: true },
|
|
6386
6612
|
{ key: "endOpacity", label: "End opacity %", kind: "number", min: 0, max: 100, step: 1, slider: true }
|
|
6387
6613
|
],
|
|
6614
|
+
extrude: [
|
|
6615
|
+
{
|
|
6616
|
+
key: "mode",
|
|
6617
|
+
label: "Mode",
|
|
6618
|
+
kind: "select",
|
|
6619
|
+
options: [
|
|
6620
|
+
{ value: "parallel", label: "Parallel" },
|
|
6621
|
+
{ value: "perspective", label: "Perspective" }
|
|
6622
|
+
]
|
|
6623
|
+
},
|
|
6624
|
+
{ key: "angle", label: "Angle \xB0", kind: "number", min: -360, max: 360, step: 1, slider: true },
|
|
6625
|
+
{ key: "depth", label: "Depth", kind: "number", min: 0, max: 2e3, step: 1, slider: true },
|
|
6626
|
+
{ key: "vanishingPoint", label: "Vanishing point", kind: "vec2", step: 1 },
|
|
6627
|
+
{ key: "toward", label: "Toward VP %", kind: "number", min: 0, max: 100, step: 1, slider: true },
|
|
6628
|
+
{ key: "color", label: "Colour", kind: "color" },
|
|
6629
|
+
{ key: "lightAngle", label: "Light \xB0", kind: "number", min: -360, max: 360, step: 1, slider: true },
|
|
6630
|
+
{ key: "shading", label: "Shading %", kind: "number", min: 0, max: 100, step: 1, slider: true }
|
|
6631
|
+
],
|
|
6632
|
+
bevel: [
|
|
6633
|
+
{ key: "width", label: "Width", kind: "number", min: 0, max: 500, step: 0.5, slider: true },
|
|
6634
|
+
{ key: "lightAngle", label: "Light \xB0", kind: "number", min: -360, max: 360, step: 1, slider: true },
|
|
6635
|
+
{ key: "shading", label: "Shading %", kind: "number", min: 0, max: 100, step: 1, slider: true },
|
|
6636
|
+
{ key: "color", label: "Colour", kind: "color" }
|
|
6637
|
+
],
|
|
6388
6638
|
repeater: [
|
|
6389
6639
|
{ key: "copies", label: "Copies", kind: "number", min: 0, max: 50, step: 0.1, slider: true },
|
|
6390
6640
|
{ key: "offset", label: "Offset", kind: "number", min: -10, max: 10, step: 0.1, slider: true },
|
|
@@ -6701,6 +6951,43 @@ function blockShadowShapes(shapes, b) {
|
|
|
6701
6951
|
}
|
|
6702
6952
|
return [...shadows, ...shapes.map((s) => ({ ...s, order: [1, ...s.order] }))];
|
|
6703
6953
|
}
|
|
6954
|
+
function extrudeShapes(shapes, x) {
|
|
6955
|
+
const out = [];
|
|
6956
|
+
for (const s of shapes) {
|
|
6957
|
+
const base = x.color ?? vectorPaintSolid(s.source.fill) ?? "#808080";
|
|
6958
|
+
vectorExtrudeFaces(s.path, x).forEach((f, k) => {
|
|
6959
|
+
const color2 = shadeVectorColor(base, f.shade);
|
|
6960
|
+
const source = { ...s.source, fill: color2, stroke: color2, strokeWidth: 0.5, strokeLinejoin: "round", strokeAlign: void 0, fills: void 0, strokes: void 0, fillRule: "nonzero", startArrow: void 0, endArrow: void 0, strokeDasharray: void 0, strokeWidthProfile: void 0, filters: void 0 };
|
|
6961
|
+
out.push({ source, path: f.path, opacity: s.opacity, order: [...s.order, 0, k] });
|
|
6962
|
+
});
|
|
6963
|
+
out.push({ ...s, order: [...s.order, 1] });
|
|
6964
|
+
}
|
|
6965
|
+
return out;
|
|
6966
|
+
}
|
|
6967
|
+
function bevelShapes(shapes, b) {
|
|
6968
|
+
const out = [];
|
|
6969
|
+
for (const s of shapes) {
|
|
6970
|
+
const fillRule = s.source.fillRule === "evenodd" ? "evenodd" : "nonzero";
|
|
6971
|
+
const faces = vectorBevelFaces(s.path, b, fillRule);
|
|
6972
|
+
if (!faces.length) {
|
|
6973
|
+
out.push(s);
|
|
6974
|
+
continue;
|
|
6975
|
+
}
|
|
6976
|
+
const base = b.color ?? vectorPaintSolid(s.source.fill) ?? "#808080";
|
|
6977
|
+
const fillOnly = { ...s.source, stroke: null, strokes: void 0 };
|
|
6978
|
+
out.push({ ...s, source: fillOnly, order: [...s.order, 0] });
|
|
6979
|
+
faces.forEach((f, k) => {
|
|
6980
|
+
const color2 = shadeVectorColor(base, f.shade);
|
|
6981
|
+
const source = { ...s.source, fill: color2, stroke: color2, strokeWidth: 0.5, strokeLinejoin: "round", strokeAlign: void 0, fills: void 0, strokes: void 0, fillRule: "nonzero", startArrow: void 0, endArrow: void 0, strokeDasharray: void 0, strokeWidthProfile: void 0, filters: void 0 };
|
|
6982
|
+
out.push({ source, path: f.path, opacity: s.opacity, order: [...s.order, 1, k] });
|
|
6983
|
+
});
|
|
6984
|
+
const [middle] = offsetPaths([s.path], -b.width, "miter", 4, 1, 0);
|
|
6985
|
+
if (middle?.length) out.push({ ...s, source: fillOnly, path: middle, order: [...s.order, 2] });
|
|
6986
|
+
const hasStroke = s.source.strokes?.length || s.source.stroke != null && s.source.stroke !== "none";
|
|
6987
|
+
if (hasStroke) out.push({ ...s, source: { ...s.source, fill: null, fills: void 0 }, order: [...s.order, 3] });
|
|
6988
|
+
}
|
|
6989
|
+
return out;
|
|
6990
|
+
}
|
|
6704
6991
|
function applyVectorEffects(shapes, effects) {
|
|
6705
6992
|
let list = shapes.slice();
|
|
6706
6993
|
for (const e of effects ?? []) {
|
|
@@ -6747,6 +7034,12 @@ function applyVectorEffects(shapes, effects) {
|
|
|
6747
7034
|
case "blockShadow":
|
|
6748
7035
|
list = blockShadowShapes(list, e.params);
|
|
6749
7036
|
break;
|
|
7037
|
+
case "extrude":
|
|
7038
|
+
list = extrudeShapes(list, e.params);
|
|
7039
|
+
break;
|
|
7040
|
+
case "bevel":
|
|
7041
|
+
list = bevelShapes(list, e.params);
|
|
7042
|
+
break;
|
|
6750
7043
|
case "repeater": {
|
|
6751
7044
|
const r = e.params;
|
|
6752
7045
|
const copies = repeatPaths(
|
|
@@ -9909,6 +10202,11 @@ export {
|
|
|
9909
10202
|
prefixVectorIds,
|
|
9910
10203
|
vectorInstanceGroup,
|
|
9911
10204
|
composeVectorMatrices,
|
|
10205
|
+
vectorPaintSolid,
|
|
10206
|
+
shadeVectorColor,
|
|
10207
|
+
vectorPathRings,
|
|
10208
|
+
vectorExtrudeFaces,
|
|
10209
|
+
vectorBevelFaces,
|
|
9912
10210
|
WARP_STYLES,
|
|
9913
10211
|
WARP_STYLE_LABELS,
|
|
9914
10212
|
warpPresetGrid,
|
|
@@ -10037,4 +10335,4 @@ export {
|
|
|
10037
10335
|
lineSubpath,
|
|
10038
10336
|
roundSubpaths
|
|
10039
10337
|
};
|
|
10040
|
-
//# sourceMappingURL=chunk-
|
|
10338
|
+
//# sourceMappingURL=chunk-PRYMC442.js.map
|