@pixerate/editor 0.155.0 → 0.157.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/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/animation-editor/index.cjs +58 -58
- package/dist/animation-editor/index.js +4 -4
- package/dist/{brushstrokeRender-YAZVQUXY.cjs → brushstrokeRender-5WANQIG4.cjs} +10 -10
- package/dist/{brushstrokeRender-EUDQTDYS.js → brushstrokeRender-Q4LI22QV.js} +3 -3
- package/dist/canvas/index.cjs +14 -14
- package/dist/canvas/index.js +3 -3
- package/dist/chart/index.cjs +90 -88
- package/dist/chart/index.js +9 -7
- package/dist/chart/spec.d.cts +2 -1
- package/dist/chart/spec.d.ts +2 -1
- package/dist/chart/types.d.cts +5 -0
- package/dist/chart/types.d.ts +5 -0
- package/dist/{chunk-AGZ47XY2.js → chunk-2N2QPO3H.js} +6 -2
- package/dist/{chunk-NMXPOKF3.js → chunk-45XXVHVG.js} +1 -1
- package/dist/{chunk-2WDZI6QD.cjs → chunk-4T44CJ5K.cjs} +15 -15
- package/dist/{chunk-XTU6QO2W.cjs → chunk-4YWAEV4W.cjs} +36 -27
- package/dist/{chunk-4YQKRHMI.cjs → chunk-57JLBGJ5.cjs} +8 -8
- package/dist/{chunk-SVINJIGK.js → chunk-5QBRAIVK.js} +3 -3
- package/dist/{chunk-R3PECGTQ.cjs → chunk-6LUYFHHN.cjs} +51 -51
- package/dist/{chunk-FLOGD3QB.js → chunk-6UPGM3JB.js} +2 -2
- package/dist/{chunk-6FUAHCVI.cjs → chunk-7NW46N7I.cjs} +16 -16
- package/dist/{chunk-ORDXMBD4.js → chunk-A5UCR2TO.js} +10 -3
- package/dist/{chunk-ML2II3Y3.cjs → chunk-AKDWAWSY.cjs} +58 -46
- package/dist/{chunk-PI45JMP7.cjs → chunk-CD7PLU77.cjs} +81 -81
- package/dist/{chunk-EQ4SF4X4.js → chunk-DBIVICAO.js} +1 -1
- package/dist/{chunk-LRRCMRSL.cjs → chunk-EBDCRTZI.cjs} +20 -16
- package/dist/{chunk-OLCYQLFE.js → chunk-EL5PAHNP.js} +1 -1
- package/dist/{chunk-PUC43JPT.cjs → chunk-EYVVIZJ3.cjs} +1 -1
- package/dist/{chunk-SUVZJ2CP.js → chunk-H5XX4KHB.js} +11 -1
- package/dist/{chunk-BXMIBMVG.cjs → chunk-JGKCC5OF.cjs} +65 -58
- package/dist/{chunk-LIXLD433.cjs → chunk-MHEXLG3M.cjs} +35 -35
- package/dist/{chunk-37RLSNQ3.js → chunk-Q6PA362P.js} +2 -2
- package/dist/{chunk-RHXW4TA5.cjs → chunk-QMI5HZWA.cjs} +7 -7
- package/dist/{chunk-DSZCDNTM.js → chunk-R3QY7PPL.js} +11 -2
- package/dist/{chunk-4RF2H3N3.js → chunk-SSCL7QQ4.js} +15 -3
- package/dist/{chunk-TLMRGLQQ.cjs → chunk-TVO6W2Q6.cjs} +20 -17
- package/dist/{chunk-EIUTJPEL.js → chunk-UM3RPYC5.js} +5 -2
- package/dist/{chunk-UILRJQFD.js → chunk-WNAAWLZ5.js} +1 -1
- package/dist/{chunk-I4AHLP7F.cjs → chunk-WPPJH6X4.cjs} +12 -2
- package/dist/{chunk-RZJCYJWO.cjs → chunk-XNQ5EFB4.cjs} +16 -16
- package/dist/{chunk-R6HNWN7B.js → chunk-YABNLNY7.js} +3 -3
- package/dist/{chunk-Y64YPIFT.js → chunk-ZQWLWDZI.js} +1 -1
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/image-editor/index.cjs +686 -686
- package/dist/image-editor/index.js +5 -5
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/dist/paint/grain.d.cts +7 -0
- package/dist/paint/grain.d.ts +7 -0
- package/dist/paint/index.cjs +3 -3
- package/dist/paint/index.js +2 -2
- package/dist/paint-editor/controller.d.cts +30 -0
- package/dist/paint-editor/controller.d.ts +30 -0
- package/dist/paint-editor/document.d.cts +8 -0
- package/dist/paint-editor/document.d.ts +8 -0
- package/dist/paint-editor/index.cjs +403 -256
- package/dist/paint-editor/index.js +158 -11
- package/dist/paint-editor/paper.d.cts +8 -0
- package/dist/paint-editor/paper.d.ts +8 -0
- package/dist/paint-editor/stencils.d.cts +2 -0
- package/dist/paint-editor/stencils.d.ts +2 -0
- package/dist/paint-editor/wet.d.cts +1 -0
- package/dist/paint-editor/wet.d.ts +1 -0
- package/dist/vector/index.cjs +950 -950
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-chart/SKILL.md +4 -1
- package/skills/pixerate-paint-editor/SKILL.md +9 -1
|
@@ -1281,6 +1281,8 @@ var PaperGrain = (_class5 = class {
|
|
|
1281
1281
|
|
|
1282
1282
|
|
|
1283
1283
|
|
|
1284
|
+
|
|
1285
|
+
|
|
1284
1286
|
constructor(paper, media = "dry") {;_class5.prototype.__init22.call(this);
|
|
1285
1287
|
const raw = grainHeights(paper.pattern, paper.seed);
|
|
1286
1288
|
const t = paper[media];
|
|
@@ -1296,6 +1298,8 @@ var PaperGrain = (_class5 = class {
|
|
|
1296
1298
|
}
|
|
1297
1299
|
this.scale = paper.scale;
|
|
1298
1300
|
this.mirror = paper.tiling === "mirror";
|
|
1301
|
+
this.ox = _nullishCoalesce(_optionalChain([paper, 'access', _5 => _5.offset, 'optionalAccess', _6 => _6.x]), () => ( 0));
|
|
1302
|
+
this.oy = _nullishCoalesce(_optionalChain([paper, 'access', _7 => _7.offset, 'optionalAccess', _8 => _8.y]), () => ( 0));
|
|
1299
1303
|
}
|
|
1300
1304
|
/** Tile cell index for a coordinate in grain pixels (mirrored on odd tiles when mirroring). */
|
|
1301
1305
|
wrap(v) {
|
|
@@ -1306,8 +1310,8 @@ var PaperGrain = (_class5 = class {
|
|
|
1306
1310
|
}
|
|
1307
1311
|
/** Height 0..1 at document position (x, y). */
|
|
1308
1312
|
at(x, y) {
|
|
1309
|
-
const u = x / this.scale - 0.5;
|
|
1310
|
-
const v = y / this.scale - 0.5;
|
|
1313
|
+
const u = (x - this.ox) / this.scale - 0.5;
|
|
1314
|
+
const v = (y - this.oy) / this.scale - 0.5;
|
|
1311
1315
|
const x0 = Math.floor(u);
|
|
1312
1316
|
const y0 = Math.floor(v);
|
|
1313
1317
|
const fx = u - x0;
|
|
@@ -1363,10 +1367,10 @@ function pathStrokeDabs(samples, options) {
|
|
|
1363
1367
|
const tilt = _nullishCoalesce(options.tilt, () => ( {}));
|
|
1364
1368
|
const minSize = Math.min(1, Math.max(0, _nullishCoalesce(options.minSize, () => ( 0))));
|
|
1365
1369
|
let index = 0;
|
|
1366
|
-
const t0 = _nullishCoalesce(_optionalChain([pts, 'access',
|
|
1370
|
+
const t0 = _nullishCoalesce(_optionalChain([pts, 'access', _9 => _9.find, 'call', _10 => _10((s) => typeof s.t === "number" && Number.isFinite(s.t)), 'optionalAccess', _11 => _11.t]), () => ( null));
|
|
1367
1371
|
const dab = (x, y, p, l, dir, travel = 0, time = null, speed = null) => {
|
|
1368
1372
|
const pr = Math.min(1, Math.max(0, p));
|
|
1369
|
-
const lean0 = _nullishCoalesce(_optionalChain([l, 'optionalAccess',
|
|
1373
|
+
const lean0 = _nullishCoalesce(_optionalChain([l, 'optionalAccess', _12 => _12.amount]), () => ( 0));
|
|
1370
1374
|
const size = brush.size * (brush.pressureSize ? minSize + (1 - minSize) * pr : 1) * (1 + 1.5 * (_nullishCoalesce(tilt.size, () => ( 0))) * lean0);
|
|
1371
1375
|
let angle = brush.angle * Math.PI / 180;
|
|
1372
1376
|
if (options.followPath) angle += dir;
|
|
@@ -1433,9 +1437,9 @@ function pathStrokeCoverage(samples, options) {
|
|
|
1433
1437
|
const brush = normalizeBrush(options.brush);
|
|
1434
1438
|
const coverage = new CoverageMap();
|
|
1435
1439
|
const dabs = pathStrokeDabs(samples, options);
|
|
1436
|
-
const g = _optionalChain([options, 'access',
|
|
1440
|
+
const g = _optionalChain([options, 'access', _13 => _13.gradient, 'optionalAccess', _14 => _14.paint, 'access', _15 => _15.type]) === "gradient" ? options.gradient : null;
|
|
1437
1441
|
const sampler = g ? new PaintGradientSampler(resolvePaintGradient(g.paint, _nullishCoalesce(g.colors, () => ( { paint: "#000000", secondary: "#ffffff" }))), _nullishCoalesce(g.seed, () => ( 0))) : null;
|
|
1438
|
-
const tipTable = _optionalChain([sampler, 'optionalAccess',
|
|
1442
|
+
const tipTable = _optionalChain([sampler, 'optionalAccess', _16 => _16.acrossTip]) ? sampler.tipTable(TIP_GRADIENT_STEPS) : null;
|
|
1439
1443
|
const scratch = { field: new Float32Array(0), sample: { rgb: [0, 0, 0], alpha: 1 } };
|
|
1440
1444
|
let buf = new Float32Array(0);
|
|
1441
1445
|
let bounds = null;
|
|
@@ -1459,7 +1463,7 @@ function pathStrokeCoverage(samples, options) {
|
|
|
1459
1463
|
}
|
|
1460
1464
|
const grain = options.grain;
|
|
1461
1465
|
if (grain && grain.depth > 0 && dabs.length) {
|
|
1462
|
-
const pressure = dabs.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'access',
|
|
1466
|
+
const pressure = dabs.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'access', _17 => _17.params, 'optionalAccess', _18 => _18.pressure]), () => ( 1))), 0) / dabs.length;
|
|
1463
1467
|
for (const [key, t] of coverage.tiles) {
|
|
1464
1468
|
const { tx, ty } = _chunkCWM3CUUXcjs.tileCoord.call(void 0, key);
|
|
1465
1469
|
for (let y = 0, k = 0; y < _chunkCWM3CUUXcjs.TILE; y++) {
|
|
@@ -1475,11 +1479,11 @@ function paintPathStroke(surface, samples, options) {
|
|
|
1475
1479
|
const brush = normalizeBrush(options.brush);
|
|
1476
1480
|
const hex = (c) => "#" + [0, 1, 2].map((i) => Math.round(Math.min(255, Math.max(0, c[i]))).toString(16).padStart(2, "0")).join("");
|
|
1477
1481
|
let color = options.color;
|
|
1478
|
-
if (_optionalChain([options, 'access',
|
|
1482
|
+
if (_optionalChain([options, 'access', _19 => _19.paint, 'optionalAccess', _20 => _20.paint, 'access', _21 => _21.type]) === "color") {
|
|
1479
1483
|
const rgb = hexToPaintRgb(options.paint.paint.color).map((v) => Math.round(v * 255));
|
|
1480
1484
|
color = [rgb[0], rgb[1], rgb[2], color[3]];
|
|
1481
1485
|
}
|
|
1482
|
-
const gradient = _optionalChain([options, 'access',
|
|
1486
|
+
const gradient = _optionalChain([options, 'access', _22 => _22.paint, 'optionalAccess', _23 => _23.paint, 'access', _24 => _24.type]) === "gradient" ? { ...options.paint, colors: _nullishCoalesce(options.paint.colors, () => ( { paint: hex(color), secondary: "#ffffff" })) } : null;
|
|
1483
1487
|
const { coverage, bounds, dabs } = pathStrokeCoverage(samples, { ...options, gradient });
|
|
1484
1488
|
if (!bounds) return { surface, bounds: null, dabs };
|
|
1485
1489
|
const offset = _nullishCoalesce(options.offset, () => ( { x: 0, y: 0 }));
|
|
@@ -1496,7 +1500,7 @@ function paintPathStroke(surface, samples, options) {
|
|
|
1496
1500
|
const tiles = new Map(surface.tiles);
|
|
1497
1501
|
for (const { tx, ty } of _chunkCWM3CUUXcjs.tilesInRect.call(void 0, { x: bounds.x - offset.x, y: bounds.y - offset.y, width: bounds.width, height: bounds.height })) {
|
|
1498
1502
|
const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
|
|
1499
|
-
const src = _optionalChain([surface, 'access',
|
|
1503
|
+
const src = _optionalChain([surface, 'access', _25 => _25.tiles, 'access', _26 => _26.get, 'call', _27 => _27(key), 'optionalAccess', _28 => _28.data]);
|
|
1500
1504
|
const base = src && src.length === _chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4 ? src : new Uint8ClampedArray(_chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4);
|
|
1501
1505
|
const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, applyStrokeToTile(coverage, base, 4, tx, ty, apply), 4, surface.defaultValue);
|
|
1502
1506
|
if (t) tiles.set(key, t);
|
|
@@ -1592,7 +1596,7 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1592
1596
|
let scale = finite2(options.scale) && options.scale > 0 ? Math.min(_chunkYQGCPL5Xcjs.BRUSHSTROKE_MAX_SCALE, Math.max(_chunkYQGCPL5Xcjs.BRUSHSTROKE_MIN_SCALE, options.scale)) : 1;
|
|
1593
1597
|
if (!samples.length) return { image: { width: 0, height: 0, data: new Uint8ClampedArray(0) }, bounds: null, scale, dabs: 0 };
|
|
1594
1598
|
const tip = strokeOptions.brush;
|
|
1595
|
-
const reach = tip.size * (1 + 1.5 * (_nullishCoalesce(_optionalChain([strokeOptions, 'access',
|
|
1599
|
+
const reach = tip.size * (1 + 1.5 * (_nullishCoalesce(_optionalChain([strokeOptions, 'access', _29 => _29.tilt, 'optionalAccess', _30 => _30.size]), () => ( 0)))) + 4;
|
|
1596
1600
|
let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
1597
1601
|
for (const s of samples) {
|
|
1598
1602
|
x0 = Math.min(x0, s.x);
|
|
@@ -1615,8 +1619,8 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1615
1619
|
let grain;
|
|
1616
1620
|
if (paper && depth > 0) {
|
|
1617
1621
|
const g = paperGrain(paper);
|
|
1618
|
-
const ox = _nullishCoalesce(_optionalChain([ch, 'access',
|
|
1619
|
-
const oy = _nullishCoalesce(_optionalChain([ch, 'access',
|
|
1622
|
+
const ox = _nullishCoalesce(_optionalChain([ch, 'access', _31 => _31.origin, 'optionalAccess', _32 => _32.x]), () => ( 0));
|
|
1623
|
+
const oy = _nullishCoalesce(_optionalChain([ch, 'access', _33 => _33.origin, 'optionalAccess', _34 => _34.y]), () => ( 0));
|
|
1620
1624
|
const k = (finite2(ch.unit) && ch.unit > 0 ? ch.unit : 1) / scale;
|
|
1621
1625
|
grain = { depth, at: (x, y) => g.at(ox + x * k, oy + y * k) };
|
|
1622
1626
|
}
|
|
@@ -1734,7 +1738,7 @@ var PaintExchange = (_class7 = class {
|
|
|
1734
1738
|
}
|
|
1735
1739
|
/** The prepared pigment of the last `paint` colour (pigment mixing only), for `deposit`. */
|
|
1736
1740
|
get paintPigment() {
|
|
1737
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1741
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _35 => _35.pig, 'optionalAccess', _36 => _36.paint]), () => ( null));
|
|
1738
1742
|
}
|
|
1739
1743
|
/** Recolours the reservoir without refilling it (a multi-coloured brush, per dab). */
|
|
1740
1744
|
setReservoirColor(r, g, b) {
|
|
@@ -1771,7 +1775,7 @@ var PaintExchange = (_class7 = class {
|
|
|
1771
1775
|
if (!this.well) this.well = [sample.rgb[0], sample.rgb[1], sample.rgb[2]];
|
|
1772
1776
|
else {
|
|
1773
1777
|
if (pig) _chunkCWM3CUUXcjs.setPigmentColor.call(void 0, pig.canvas, sample.rgb[0], sample.rgb[1], sample.rgb[2]);
|
|
1774
|
-
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess',
|
|
1778
|
+
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _37 => _37.well]), () => ( null)), sample.rgb, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _38 => _38.canvas]), () => ( null)), this.rates.pickup * sample.contact);
|
|
1775
1779
|
this.well = [o[0], o[1], o[2]];
|
|
1776
1780
|
}
|
|
1777
1781
|
if (pig) _chunkCWM3CUUXcjs.setPigmentColor.call(void 0, pig.well, this.well[0], this.well[1], this.well[2]);
|
|
@@ -1789,7 +1793,7 @@ var PaintExchange = (_class7 = class {
|
|
|
1789
1793
|
if (!(total > 1e-6)) return 0;
|
|
1790
1794
|
const pig = this.pig;
|
|
1791
1795
|
if (res && this.well) {
|
|
1792
|
-
const m = this.mix(res, _nullishCoalesce(_optionalChain([pig, 'optionalAccess',
|
|
1796
|
+
const m = this.mix(res, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _39 => _39.res]), () => ( null)), this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _40 => _40.well]), () => ( null)), wp / total);
|
|
1793
1797
|
out[0] = m[0];
|
|
1794
1798
|
out[1] = m[1];
|
|
1795
1799
|
out[2] = m[2];
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-
|
|
77
|
+
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-5WANQIG4.cjs"))).catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -231,6 +231,7 @@ var CHART_AXIS_SCALES = ["linear", "log"];
|
|
|
231
231
|
var CHART_SERIES_TYPES = ["bar", "line", "area", "scatter"];
|
|
232
232
|
var CHART_STACKINGS = ["none", "stacked", "percent"];
|
|
233
233
|
var CHART_CURVES = ["linear", "smooth", "step"];
|
|
234
|
+
var CHART_RADAR_GRATICULES = ["polygon", "circle"];
|
|
234
235
|
var CHART_ORIENTATIONS = ["vertical", "horizontal"];
|
|
235
236
|
var CHART_LEGEND_POSITIONS = ["top", "bottom", "left", "right"];
|
|
236
237
|
var CHART_NUMBER_STYLES = ["number", "percent", "currency", "compact"];
|
|
@@ -652,6 +653,12 @@ function normalizeChartSpec(input) {
|
|
|
652
653
|
if (Number.isInteger(b) && b >= 1 && b <= 500) bins = b;
|
|
653
654
|
else issues.push({ path: "bins", message: "bins must be a whole number from 1 to 500, or null for automatic." });
|
|
654
655
|
}
|
|
656
|
+
let radarTicks = null;
|
|
657
|
+
if (value.radarTicks !== void 0 && value.radarTicks !== null) {
|
|
658
|
+
const t = Number(value.radarTicks);
|
|
659
|
+
if (Number.isInteger(t) && t >= 1 && t <= 50) radarTicks = t;
|
|
660
|
+
else issues.push({ path: "radarTicks", message: "radarTicks must be a whole number from 1 to 50, or null for round-number rings." });
|
|
661
|
+
}
|
|
655
662
|
const spec = {
|
|
656
663
|
version: 1,
|
|
657
664
|
type,
|
|
@@ -674,7 +681,9 @@ function normalizeChartSpec(input) {
|
|
|
674
681
|
gapWidth,
|
|
675
682
|
overlap,
|
|
676
683
|
bins,
|
|
677
|
-
showTotal: flag(value.showTotal, true, "showTotal", issues)
|
|
684
|
+
showTotal: flag(value.showTotal, true, "showTotal", issues),
|
|
685
|
+
radarTicks,
|
|
686
|
+
radarGraticule: pick(value.radarGraticule, CHART_RADAR_GRATICULES, "polygon", "radarGraticule", issues)
|
|
678
687
|
};
|
|
679
688
|
if (spec.stacking === "percent")
|
|
680
689
|
for (const name of ["yAxis", "yAxis2"]) {
|
|
@@ -793,6 +802,7 @@ export {
|
|
|
793
802
|
CHART_SERIES_TYPES,
|
|
794
803
|
CHART_STACKINGS,
|
|
795
804
|
CHART_CURVES,
|
|
805
|
+
CHART_RADAR_GRATICULES,
|
|
796
806
|
CHART_ORIENTATIONS,
|
|
797
807
|
CHART_LEGEND_POSITIONS,
|
|
798
808
|
CHART_NUMBER_STYLES,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkEBDCRTZIcjs = require('./chunk-EBDCRTZI.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -73,7 +73,13 @@ function paperPreset(id) {
|
|
|
73
73
|
return p ? clonePaper(p) : void 0;
|
|
74
74
|
}
|
|
75
75
|
function clonePaper(p) {
|
|
76
|
-
return { ...p, dry: { ...p.dry }, wet: { ...p.wet } };
|
|
76
|
+
return { ...p, dry: { ...p.dry }, wet: { ...p.wet }, ...p.offset ? { offset: { ...p.offset } } : {} };
|
|
77
|
+
}
|
|
78
|
+
function readOffset(raw, d) {
|
|
79
|
+
const o = raw && typeof raw === "object" ? raw : null;
|
|
80
|
+
const x = o && typeof o.x === "number" && Number.isFinite(o.x) ? Math.round(o.x) : _nullishCoalesce(_optionalChain([d, 'optionalAccess', _3 => _3.x]), () => ( 0));
|
|
81
|
+
const y = o && typeof o.y === "number" && Number.isFinite(o.y) ? Math.round(o.y) : _nullishCoalesce(_optionalChain([d, 'optionalAccess', _4 => _4.y]), () => ( 0));
|
|
82
|
+
return x || y ? { offset: { x, y } } : {};
|
|
77
83
|
}
|
|
78
84
|
function readTuning(raw, d) {
|
|
79
85
|
const r = raw && typeof raw === "object" ? raw : {};
|
|
@@ -86,7 +92,7 @@ function normalizePaper(raw = {}, base) {
|
|
|
86
92
|
preset: typeof r.preset === "string" && r.preset ? r.preset : b.preset,
|
|
87
93
|
name: typeof r.name === "string" && r.name.trim() ? r.name.trim() : b.name,
|
|
88
94
|
family: PAPER_FAMILIES.includes(r.family) ? r.family : b.family,
|
|
89
|
-
pattern:
|
|
95
|
+
pattern: _chunkEBDCRTZIcjs.GRAIN_PATTERNS.includes(r.pattern) ? r.pattern : b.pattern,
|
|
90
96
|
seed: typeof r.seed === "number" && Number.isFinite(r.seed) ? Math.round(Math.abs(r.seed)) % 2147483647 : b.seed,
|
|
91
97
|
color: typeof r.color === "string" && HEX.test(r.color) ? r.color.toLowerCase() : b.color,
|
|
92
98
|
scale: clampNum(r.scale, 0.25, 8, b.scale),
|
|
@@ -98,14 +104,15 @@ function normalizePaper(raw = {}, base) {
|
|
|
98
104
|
absorption: unit(r.absorption, b.absorption),
|
|
99
105
|
permeability: unit(r.permeability, b.permeability),
|
|
100
106
|
roughness: unit(r.roughness, b.roughness),
|
|
101
|
-
...unit(r.metallic, _nullishCoalesce(b.metallic, () => ( 0))) > 0 ? { metallic: unit(r.metallic, _nullishCoalesce(b.metallic, () => ( 0))) } : {}
|
|
107
|
+
...unit(r.metallic, _nullishCoalesce(b.metallic, () => ( 0))) > 0 ? { metallic: unit(r.metallic, _nullishCoalesce(b.metallic, () => ( 0))) } : {},
|
|
108
|
+
...readOffset(r.offset, b.offset)
|
|
102
109
|
};
|
|
103
110
|
}
|
|
104
111
|
function hexToRgb8(hex) {
|
|
105
112
|
const n = parseInt(hex.slice(1, 7), 16);
|
|
106
113
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
107
114
|
}
|
|
108
|
-
function renderPaper(paper, rect, grain = new (0,
|
|
115
|
+
function renderPaper(paper, rect, grain = new (0, _chunkEBDCRTZIcjs.PaperGrain)(paper), light) {
|
|
109
116
|
const [r, g, b] = hexToRgb8(paper.color);
|
|
110
117
|
const out = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
111
118
|
const shade = grain.flat ? 0 : paper.shading * 0.16;
|
|
@@ -267,22 +274,22 @@ var PenDabWalker = (_class2 = class {
|
|
|
267
274
|
const i = this.index++;
|
|
268
275
|
const seed = this.seed;
|
|
269
276
|
let diameter = this.diameter(s);
|
|
270
|
-
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter *
|
|
277
|
+
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter * _chunkEBDCRTZIcjs.randSigned.call(void 0, seed, i, 1 /* Size */));
|
|
271
278
|
const base = tip.angle * Math.PI / 180;
|
|
272
279
|
let angle;
|
|
273
280
|
if (rotation === "stroke") angle = this.dir + base;
|
|
274
281
|
else if (rotation === "barrel" && s.twist !== null) angle = this.mapAngle(base - s.twist * Math.PI / 180);
|
|
275
282
|
else if (dyn.tiltRoundness > 0 && s.lean > 0.02) angle = this.mapAngle(base - s.azimuth);
|
|
276
283
|
else angle = this.mapAngle(base);
|
|
277
|
-
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI *
|
|
284
|
+
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI * _chunkEBDCRTZIcjs.randSigned.call(void 0, seed, i, 2 /* Angle */);
|
|
278
285
|
let opacity = tip.pressureOpacity ? s.pressure : 1;
|
|
279
286
|
opacity *= 1 - dyn.tiltOpacity * s.lean * 0.8;
|
|
280
287
|
if (s.speed !== null && dyn.velocityOpacity) opacity *= Math.max(0, 1 + dyn.velocityOpacity * (Math.min(1, s.speed / FULL_SPEED) - 0.5));
|
|
281
|
-
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (
|
|
288
|
+
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (_chunkEBDCRTZIcjs.randSigned.call(void 0, seed, i, 3 /* Opacity */) * 0.5 + 0.5);
|
|
282
289
|
const flow = tip.flow * (1 - dyn.pressureFlow + dyn.pressureFlow * s.pressure);
|
|
283
290
|
let { x, y } = s;
|
|
284
291
|
if (dyn.scatter) {
|
|
285
|
-
const off = dyn.scatter * diameter *
|
|
292
|
+
const off = dyn.scatter * diameter * _chunkEBDCRTZIcjs.randSigned.call(void 0, seed, i, 4 /* Scatter */);
|
|
286
293
|
x += Math.sin(this.dir) * off;
|
|
287
294
|
y += Math.cos(this.dir) * off;
|
|
288
295
|
}
|
|
@@ -366,13 +373,13 @@ var DryStroke = (_class3 = class {
|
|
|
366
373
|
this.brush = brush;
|
|
367
374
|
this.options = options;
|
|
368
375
|
this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
|
|
369
|
-
this.copies = _optionalChain([options, 'access',
|
|
376
|
+
this.copies = _optionalChain([options, 'access', _5 => _5.copies, 'optionalAccess', _6 => _6.length]) ? options.copies : [IDENTITY_COPY];
|
|
370
377
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(brush, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear));
|
|
371
378
|
this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
|
|
372
379
|
}
|
|
373
380
|
|
|
374
381
|
|
|
375
|
-
__init12() {this.coverage = new (0,
|
|
382
|
+
__init12() {this.coverage = new (0, _chunkEBDCRTZIcjs.CoverageMap)()}
|
|
376
383
|
__init13() {this.dabCount = 0}
|
|
377
384
|
|
|
378
385
|
|
|
@@ -406,16 +413,16 @@ var DryStroke = (_class3 = class {
|
|
|
406
413
|
const hardness = this.brush.tip.hardness;
|
|
407
414
|
const grain = this.options.grain;
|
|
408
415
|
for (const d of dabs) {
|
|
409
|
-
const rect =
|
|
416
|
+
const rect = _chunkEBDCRTZIcjs.dabRect.call(void 0, d, hardness);
|
|
410
417
|
const n = rect.width * rect.height;
|
|
411
418
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
412
419
|
const vals = this.buf.subarray(0, n);
|
|
413
|
-
|
|
420
|
+
_chunkEBDCRTZIcjs.rasterizeDab.call(void 0, d, hardness, rect, vals);
|
|
414
421
|
if (this.depth > 0 && grain) {
|
|
415
422
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
416
423
|
const y = rect.y + yy + 0.5;
|
|
417
424
|
for (let xx = 0; xx < rect.width; xx++, k++) {
|
|
418
|
-
if (vals[k] > 0) vals[k] *=
|
|
425
|
+
if (vals[k] > 0) vals[k] *= _chunkEBDCRTZIcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, y), this.depth, d.pressure);
|
|
419
426
|
}
|
|
420
427
|
}
|
|
421
428
|
}
|
|
@@ -488,14 +495,14 @@ function stampCoverage(kind, u, v, t) {
|
|
|
488
495
|
}
|
|
489
496
|
case "splat": {
|
|
490
497
|
let rr = 0.55;
|
|
491
|
-
for (let k = 1; k <= 3; k++) rr += 0.08 * Math.sin(a * (k + 2) +
|
|
498
|
+
for (let k = 1; k <= 3; k++) rr += 0.08 * Math.sin(a * (k + 2) + _chunkEBDCRTZIcjs.hash2.call(void 0, k, 1, t) * 6.28) / k;
|
|
492
499
|
let c = edge(rr - r);
|
|
493
500
|
for (let k = 0; k < 4; k++) {
|
|
494
|
-
const ang =
|
|
495
|
-
const dist = 0.72 + 0.2 *
|
|
501
|
+
const ang = _chunkEBDCRTZIcjs.hash2.call(void 0, k, 7, t) * Math.PI * 2;
|
|
502
|
+
const dist = 0.72 + 0.2 * _chunkEBDCRTZIcjs.hash2.call(void 0, k, 9, t);
|
|
496
503
|
const dx = u - Math.cos(ang) * dist;
|
|
497
504
|
const dy = v - Math.sin(ang) * dist;
|
|
498
|
-
c = Math.max(c, edge(0.08 + 0.06 *
|
|
505
|
+
c = Math.max(c, edge(0.08 + 0.06 * _chunkEBDCRTZIcjs.hash2.call(void 0, k, 11, t) - Math.hypot(dx, dy)));
|
|
499
506
|
}
|
|
500
507
|
return c;
|
|
501
508
|
}
|
|
@@ -533,7 +540,7 @@ function drawSticker(medium, s) {
|
|
|
533
540
|
c /= 4;
|
|
534
541
|
if (c <= 0) continue;
|
|
535
542
|
cov[p] = c;
|
|
536
|
-
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (
|
|
543
|
+
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (_chunkEBDCRTZIcjs.hash2.call(void 0, px, rect.y + yy, s.seed) - 0.5);
|
|
537
544
|
field[p * 3] = Math.min(1, Math.max(0, r * shade));
|
|
538
545
|
field[p * 3 + 1] = Math.min(1, Math.max(0, g * shade));
|
|
539
546
|
field[p * 3 + 2] = Math.min(1, Math.max(0, b * shade));
|
|
@@ -544,8 +551,8 @@ function drawSticker(medium, s) {
|
|
|
544
551
|
}
|
|
545
552
|
function jitterColor(hex, amount, seed, i) {
|
|
546
553
|
const [r, g, b] = hexRgb(hex);
|
|
547
|
-
const l = (
|
|
548
|
-
const h = (
|
|
554
|
+
const l = (_chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 61) - 0.5) * amount * 0.6;
|
|
555
|
+
const h = (_chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 63) - 0.5) * amount;
|
|
549
556
|
const m = (r + g + b) / 3;
|
|
550
557
|
const rot = (c0, c1) => c0 + (c1 - c0) * h;
|
|
551
558
|
const out = [rot(r, g), rot(g, b), rot(b, r)].map((c) => Math.min(1, Math.max(0, c + l + (c - m) * 0)));
|
|
@@ -560,7 +567,7 @@ var StickerSpray = (_class4 = class {
|
|
|
560
567
|
const spacing = Math.max(0.05, 1 / Math.max(0.05, b.sticker.density * 4));
|
|
561
568
|
const walk = { ...b, tip: { ...b.tip, spacing }, dynamics: { ...b.dynamics, scatter: 0, sizeJitter: 0, angleJitter: 0 } };
|
|
562
569
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(walk, init.seed + i * 7919 | 0, c.linear));
|
|
563
|
-
this.medium = new (0,
|
|
570
|
+
this.medium = new (0, _chunkEBDCRTZIcjs.TileMedium)(init.target, {});
|
|
564
571
|
this.next = init.nextId;
|
|
565
572
|
}
|
|
566
573
|
|
|
@@ -603,21 +610,21 @@ var StickerSpray = (_class4 = class {
|
|
|
603
610
|
const st = this.init.brush.sticker;
|
|
604
611
|
const i = this.next;
|
|
605
612
|
const seed = this.init.seed;
|
|
606
|
-
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 *
|
|
613
|
+
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 * _chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 51));
|
|
607
614
|
const off = st.scatter * d.radius * 2;
|
|
608
|
-
const a =
|
|
609
|
-
const dist =
|
|
615
|
+
const a = _chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 53) * Math.PI * 2;
|
|
616
|
+
const dist = _chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 55) * off;
|
|
610
617
|
const base = this.colorAt(d, Math.cos(a) * dist, Math.sin(a) * dist);
|
|
611
618
|
const sticker = {
|
|
612
619
|
id: `st${this.next++}`,
|
|
613
|
-
stamp: _nullishCoalesce(st.stamps[Math.floor(
|
|
620
|
+
stamp: _nullishCoalesce(st.stamps[Math.floor(_chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 57) * st.stamps.length)], () => ( "dot")),
|
|
614
621
|
x: Math.round((d.x + Math.cos(a) * dist) * 100) / 100,
|
|
615
622
|
y: Math.round((d.y + Math.sin(a) * dist) * 100) / 100,
|
|
616
623
|
size: Math.max(2, Math.round(size * 10) / 10),
|
|
617
|
-
rotation: Math.round((-d.angle * 180 / Math.PI + (
|
|
624
|
+
rotation: Math.round((-d.angle * 180 / Math.PI + (_chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 59) * 2 - 1) * 180 * st.rotationJitter) * 10) / 10,
|
|
618
625
|
color: st.colorJitter > 0 ? jitterColor(base.color, st.colorJitter, seed, i) : base.color,
|
|
619
626
|
opacity: Math.round(Math.min(1, d.opacity * this.init.brush.tip.opacity * base.alpha) * 1e3) / 1e3,
|
|
620
|
-
seed: Math.floor(
|
|
627
|
+
seed: Math.floor(_chunkEBDCRTZIcjs.rand01.call(void 0, seed, i, 65) * 1e9)
|
|
621
628
|
};
|
|
622
629
|
this.stickers.push(sticker);
|
|
623
630
|
rects.push(drawSticker(this.medium, sticker));
|
|
@@ -628,13 +635,13 @@ var StickerSpray = (_class4 = class {
|
|
|
628
635
|
colorAt(d, dx, dy) {
|
|
629
636
|
const g = this.init.paint;
|
|
630
637
|
if (!g) return { color: this.init.color, alpha: 1 };
|
|
631
|
-
this.sampler ??= new (0,
|
|
638
|
+
this.sampler ??= new (0, _chunkEBDCRTZIcjs.PaintGradientSampler)(g, this.init.seed);
|
|
632
639
|
const s = g.map.by === "across-tip" ? this.sampler.sample(((dx * Math.sin(d.direction) + dy * Math.cos(d.direction)) / Math.max(0.5, d.radius) + 1) / 2) : this.sampler.dab(d);
|
|
633
640
|
return { color: "#" + s.rgb.map((c) => Math.round(Math.min(1, Math.max(0, c)) * 255).toString(16).padStart(2, "0")).join(""), alpha: s.alpha };
|
|
634
641
|
}
|
|
635
642
|
}, _class4);
|
|
636
643
|
function renderStickers(stickers, target) {
|
|
637
|
-
const medium = new (0,
|
|
644
|
+
const medium = new (0, _chunkEBDCRTZIcjs.TileMedium)(target, {});
|
|
638
645
|
for (const s of stickers) drawSticker(medium, s);
|
|
639
646
|
}
|
|
640
647
|
function normalizeStickerUpdate(u) {
|
|
@@ -694,10 +701,10 @@ var MarkStroke = (_class5 = class {
|
|
|
694
701
|
constructor(brush, options) {;_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);_class5.prototype.__init25.call(this);_class5.prototype.__init26.call(this);_class5.prototype.__init27.call(this);
|
|
695
702
|
this.brush = brush;
|
|
696
703
|
this.options = options;
|
|
697
|
-
this.sampler = options.paint ? new (0,
|
|
698
|
-
this.tipTable = _optionalChain([this, 'access',
|
|
704
|
+
this.sampler = options.paint ? new (0, _chunkEBDCRTZIcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
705
|
+
this.tipTable = _optionalChain([this, 'access', _7 => _7.sampler, 'optionalAccess', _8 => _8.acrossTip]) ? this.sampler.tipTable(_chunkEBDCRTZIcjs.TIP_GRADIENT_STEPS) : null;
|
|
699
706
|
this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
|
|
700
|
-
this.copies = _optionalChain([options, 'access',
|
|
707
|
+
this.copies = _optionalChain([options, 'access', _9 => _9.copies, 'optionalAccess', _10 => _10.length]) ? options.copies : [IDENTITY_COPY];
|
|
701
708
|
this.seed = _nullishCoalesce(options.seed, () => ( 0));
|
|
702
709
|
const fine = { ...brush, tip: { ...brush.tip, spacing: Math.max(0.01, Math.min(0.25, STEP_PX / Math.max(1, brush.tip.size))) } };
|
|
703
710
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(fine, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear));
|
|
@@ -705,7 +712,7 @@ var MarkStroke = (_class5 = class {
|
|
|
705
712
|
}
|
|
706
713
|
|
|
707
714
|
|
|
708
|
-
__init21() {this.coverage = new (0,
|
|
715
|
+
__init21() {this.coverage = new (0, _chunkEBDCRTZIcjs.CoverageMap)()}
|
|
709
716
|
__init22() {this.dabCount = 0}
|
|
710
717
|
|
|
711
718
|
|
|
@@ -767,16 +774,16 @@ var MarkStroke = (_class5 = class {
|
|
|
767
774
|
if (!(r > 0.05) || !(alpha > 0)) return;
|
|
768
775
|
const dab = { x, y, radius: Math.max(0.5, r), alpha: Math.min(1, alpha), opacity: Math.min(1, opacity), angle: 0, roundness: 1 };
|
|
769
776
|
const hardness = this.brush.tip.hardness;
|
|
770
|
-
const rect =
|
|
777
|
+
const rect = _chunkEBDCRTZIcjs.dabRect.call(void 0, dab, hardness);
|
|
771
778
|
const n = rect.width * rect.height;
|
|
772
779
|
if (n <= 0) return;
|
|
773
780
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
774
781
|
const vals = this.buf.subarray(0, n);
|
|
775
|
-
|
|
782
|
+
_chunkEBDCRTZIcjs.rasterizeDab.call(void 0, dab, hardness, rect, vals);
|
|
776
783
|
const grain = this.options.grain;
|
|
777
784
|
if (this.depth > 0 && grain) {
|
|
778
785
|
for (let yy = 0, k = 0; yy < rect.height; yy++)
|
|
779
|
-
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *=
|
|
786
|
+
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *= _chunkEBDCRTZIcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, rect.y + yy + 0.5), this.depth, pressure);
|
|
780
787
|
}
|
|
781
788
|
const color = this.markColor(x, y);
|
|
782
789
|
if (color && color.alpha < 1) for (let k = 0; k < n; k++) vals[k] *= color.alpha;
|
|
@@ -819,7 +826,7 @@ function curl(x, y, seed) {
|
|
|
819
826
|
const fy = v - y0;
|
|
820
827
|
const sx = fx * fx * (3 - 2 * fx);
|
|
821
828
|
const sy = fy * fy * (3 - 2 * fy);
|
|
822
|
-
const h = (a2, b2) =>
|
|
829
|
+
const h = (a2, b2) => _chunkEBDCRTZIcjs.rand01.call(void 0, seed, a2 * 73856093 + b2 * 19349663, 41);
|
|
823
830
|
const a = h(x0, y0);
|
|
824
831
|
const b = h(x0 + 1, y0);
|
|
825
832
|
const c = h(x0, y0 + 1);
|
|
@@ -843,11 +850,11 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
843
850
|
const list = this.sets[copy];
|
|
844
851
|
const size = Math.max(1, d.radius * 2);
|
|
845
852
|
for (let i = 0; i < (s.kind === "flow" ? 0 : s.count); i++) {
|
|
846
|
-
const r =
|
|
847
|
-
const a =
|
|
853
|
+
const r = _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 3 + copy) * s.spread * size * 0.5;
|
|
854
|
+
const a = _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 5 + copy) * Math.PI * 2;
|
|
848
855
|
const ox = Math.cos(a) * r;
|
|
849
856
|
const oy = Math.sin(a) * r;
|
|
850
|
-
const p = { x: d.x + ox, y: d.y + oy, vx: 0, vy: 0, ox, oy, k: 0.6 + 0.8 *
|
|
857
|
+
const p = { x: d.x + ox, y: d.y + oy, vx: 0, vy: 0, ox, oy, k: 0.6 + 0.8 * _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 7), phase: a, age: 0, run: 0, bead: 0, alive: true };
|
|
851
858
|
if (s.kind === "string") p.strand = Array.from({ length: 6 }, () => ({ x: d.x + ox, y: d.y + oy, vx: 0, vy: 0 }));
|
|
852
859
|
if (s.kind === "orbit") {
|
|
853
860
|
p.ox = Math.max(1, r + size * 0.15);
|
|
@@ -872,8 +879,8 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
872
879
|
while (this.spawn >= 1) {
|
|
873
880
|
this.spawn -= 1;
|
|
874
881
|
const i = this.dabCount + list.length * 31 + Math.floor(d.index);
|
|
875
|
-
const a =
|
|
876
|
-
const r =
|
|
882
|
+
const a = _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 11 + copy) * Math.PI * 2;
|
|
883
|
+
const r = _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 13 + copy) * s.spread * size * 0.5;
|
|
877
884
|
list.push({ x: d.x + Math.cos(a) * r, y: d.y + Math.sin(a) * r, vx: 0, vy: 0, ox: 0, oy: 0, k: 1, phase: a, age: 0, run: 0, bead: 0, alive: true });
|
|
878
885
|
}
|
|
879
886
|
}
|
|
@@ -908,7 +915,7 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
908
915
|
break;
|
|
909
916
|
}
|
|
910
917
|
case "orbit": {
|
|
911
|
-
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 *
|
|
918
|
+
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 * _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 17));
|
|
912
919
|
p.x = d.x + Math.cos(p.phase) * p.ox;
|
|
913
920
|
p.y = d.y + Math.sin(p.phase) * p.ox + g * p.ox;
|
|
914
921
|
break;
|
|
@@ -967,16 +974,16 @@ var BristleStroke = class extends MarkStroke {
|
|
|
967
974
|
const s = this.s;
|
|
968
975
|
this.tufts = this.copies.map(
|
|
969
976
|
(_, c) => Array.from({ length: s.count }, (_2, i) => {
|
|
970
|
-
const a =
|
|
971
|
-
const r = Math.sqrt(
|
|
977
|
+
const a = _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 21 + c) * Math.PI * 2;
|
|
978
|
+
const r = Math.sqrt(_chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 23 + c));
|
|
972
979
|
return {
|
|
973
980
|
u: Math.cos(a) * r,
|
|
974
981
|
v: Math.sin(a) * r,
|
|
975
982
|
x: 0,
|
|
976
983
|
y: 0,
|
|
977
|
-
paint: 1 - s.jitter * 0.4 *
|
|
978
|
-
thirst: 1 + s.jitter * (
|
|
979
|
-
w: 1 + s.jitter * 0.6 * (
|
|
984
|
+
paint: 1 - s.jitter * 0.4 * _chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 25 + c),
|
|
985
|
+
thirst: 1 + s.jitter * (_chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 27 + c) * 2 - 1),
|
|
986
|
+
w: 1 + s.jitter * 0.6 * (_chunkEBDCRTZIcjs.rand01.call(void 0, this.seed, i, 29 + c) - 0.5),
|
|
980
987
|
started: false
|
|
981
988
|
};
|
|
982
989
|
})
|
|
@@ -1175,12 +1182,12 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1175
1182
|
if (rb.dirty !== void 0) mixerIn.cleanEachStroke = !rb.dirty;
|
|
1176
1183
|
if (rb.mixing !== void 0) mixerIn.mixing = rb.mixing;
|
|
1177
1184
|
}
|
|
1178
|
-
const mixer =
|
|
1185
|
+
const mixer = _chunkEBDCRTZIcjs.normalizeMixer.call(void 0, mixerIn);
|
|
1179
1186
|
let behavior = normalizeBehavior(rb, b.behavior);
|
|
1180
1187
|
if (engine === "mixer") behavior = { ...behavior, pickup: mixer.wet, mix: mixer.mix, dirty: !mixer.cleanEachStroke, mixing: mixer.mixing };
|
|
1181
1188
|
let paint = _nullishCoalesce(b.paint, () => ( null));
|
|
1182
1189
|
if (raw.paint !== void 0) {
|
|
1183
|
-
const p =
|
|
1190
|
+
const p = _chunkEBDCRTZIcjs.readPaintSource.call(void 0, raw.paint);
|
|
1184
1191
|
paint = p && p.type === "gradient" ? p : null;
|
|
1185
1192
|
} else if (rb.multicolor !== void 0) {
|
|
1186
1193
|
const mc = normalizeMultiColor(rb.multicolor, _nullishCoalesce(paintToMultiColor(paint), () => ( DEFAULT_MULTI_COLOR)));
|
|
@@ -1192,7 +1199,7 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1192
1199
|
name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, 80) : b.name,
|
|
1193
1200
|
category: PAINT_BRUSH_CATEGORIES.includes(raw.category) ? raw.category : b.category,
|
|
1194
1201
|
engine,
|
|
1195
|
-
tip:
|
|
1202
|
+
tip: _chunkEBDCRTZIcjs.normalizeBrush.call(void 0, { ...b.tip, ..._nullishCoalesce(raw.tip, () => ( {})) }),
|
|
1196
1203
|
grain: unit4(raw.grain, b.grain),
|
|
1197
1204
|
pressureSmoothing: range(raw.pressureSmoothing, 0, 0.95, b.pressureSmoothing),
|
|
1198
1205
|
rotation: BRUSH_ROTATIONS.includes(raw.rotation) ? raw.rotation : b.rotation,
|
|
@@ -1200,8 +1207,8 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1200
1207
|
mixer,
|
|
1201
1208
|
loadsColor: typeof raw.loadsColor === "boolean" ? raw.loadsColor : b.loadsColor,
|
|
1202
1209
|
behavior,
|
|
1203
|
-
blender:
|
|
1204
|
-
smudge:
|
|
1210
|
+
blender: _chunkEBDCRTZIcjs.normalizeBlender.call(void 0, _nullishCoalesce(raw.blender, () => ( {})), b.blender),
|
|
1211
|
+
smudge: _chunkEBDCRTZIcjs.normalizeSmudge.call(void 0, _nullishCoalesce(raw.smudge, () => ( {})), b.smudge),
|
|
1205
1212
|
wet: normalizeWetBrush(_nullishCoalesce(raw.wet, () => ( {})), _nullishCoalesce(b.wet, () => ( DEFAULT_WET_BRUSH))),
|
|
1206
1213
|
impasto: normalizeImpasto(_nullishCoalesce(raw.impasto, () => ( {})), _nullishCoalesce(b.impasto, () => ( DEFAULT_IMPASTO))),
|
|
1207
1214
|
particle: normalizeParticle(_nullishCoalesce(raw.particle, () => ( {})), _nullishCoalesce(b.particle, () => ( DEFAULT_PARTICLE))),
|
|
@@ -1216,16 +1223,16 @@ var BASE_BRUSH = {
|
|
|
1216
1223
|
name: "Round",
|
|
1217
1224
|
category: "custom",
|
|
1218
1225
|
engine: "dab",
|
|
1219
|
-
tip: { ...
|
|
1226
|
+
tip: { ..._chunkEBDCRTZIcjs.DEFAULT_BRUSH },
|
|
1220
1227
|
grain: 0,
|
|
1221
1228
|
pressureSmoothing: 0,
|
|
1222
1229
|
rotation: "fixed",
|
|
1223
1230
|
dynamics: { ...DEFAULT_DYNAMICS },
|
|
1224
|
-
mixer: { ...
|
|
1231
|
+
mixer: { ..._chunkEBDCRTZIcjs.DEFAULT_MIXER },
|
|
1225
1232
|
loadsColor: true,
|
|
1226
1233
|
behavior: { ...DEFAULT_BEHAVIOR, multicolor: { ...DEFAULT_MULTI_COLOR, colors: [] } },
|
|
1227
|
-
blender: { ...
|
|
1228
|
-
smudge: { ...
|
|
1234
|
+
blender: { ..._chunkEBDCRTZIcjs.DEFAULT_BLENDER },
|
|
1235
|
+
smudge: { ..._chunkEBDCRTZIcjs.DEFAULT_SMUDGE },
|
|
1229
1236
|
wet: { ...DEFAULT_WET_BRUSH },
|
|
1230
1237
|
impasto: { ...DEFAULT_IMPASTO },
|
|
1231
1238
|
particle: { ...DEFAULT_PARTICLE },
|