@pixerate/editor 0.275.1 → 0.276.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 +62 -62
- package/dist/animation-editor/index.js +6 -6
- package/dist/brushes/index.cjs +81 -70
- package/dist/brushes/index.js +17 -6
- package/dist/brushes/patch.d.cts +1 -1
- package/dist/brushes/patch.d.ts +1 -1
- package/dist/brushes/profiles.d.cts +2 -0
- package/dist/brushes/profiles.d.ts +2 -0
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/types.d.cts +22 -1
- package/dist/brushes/types.d.ts +22 -1
- package/dist/{brushstrokeRender-WGY4DZHF.js → brushstrokeRender-FK3ASUUJ.js} +5 -5
- package/dist/{brushstrokeRender-2RQL46WB.cjs → brushstrokeRender-I6MYFCOU.cjs} +21 -21
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-Y2ISSVPH.js → chunk-4EM5NGCL.js} +167 -9
- package/dist/{chunk-Y354ETAE.cjs → chunk-5HR5CSLC.cjs} +49 -49
- package/dist/{chunk-LMG57L5A.js → chunk-CTHWXW5M.js} +121 -8
- package/dist/{chunk-43XJC3PP.js → chunk-CVBTJVRN.js} +1 -1
- package/dist/{chunk-RJGW3RQS.js → chunk-GHYJAMMS.js} +1 -1
- package/dist/{chunk-NIBFKXMD.cjs → chunk-IFWLZZCW.cjs} +619 -2
- package/dist/{chunk-G5TCMKX5.js → chunk-IJ6NSWKM.js} +2 -2
- package/dist/{chunk-C6VB7CPY.cjs → chunk-ISCAJBPQ.cjs} +1 -1
- package/dist/{chunk-W6JDUXP3.js → chunk-J23JOHPR.js} +1 -1
- package/dist/{chunk-IEEY5RJV.js → chunk-JNMNM3SL.js} +1 -1
- package/dist/{chunk-HVO6XCI4.js → chunk-JPB65KQ6.js} +1 -1
- package/dist/{chunk-ACTHSQOI.js → chunk-LDZOXESA.js} +618 -1
- package/dist/{chunk-DHC4E2DU.cjs → chunk-MITQGHN3.cjs} +121 -8
- package/dist/{chunk-STLTOISW.cjs → chunk-NPPMKMCU.cjs} +17 -17
- package/dist/{chunk-75SYKUOT.js → chunk-OS6OG7DN.js} +1 -1
- package/dist/{chunk-OLZXXAER.cjs → chunk-OY24XRYF.cjs} +408 -250
- package/dist/{chunk-6QNDGMK7.cjs → chunk-Q33V5PEF.cjs} +123 -42
- package/dist/{chunk-JDXWLCXF.cjs → chunk-QNNZA3V5.cjs} +2 -2
- package/dist/{chunk-T6KNJVBP.cjs → chunk-U26LUXCJ.cjs} +35 -35
- package/dist/{chunk-62MFUHSI.cjs → chunk-UQXULAMQ.cjs} +16 -16
- package/dist/{chunk-RAPNRK4R.cjs → chunk-X7XBEX3O.cjs} +88 -88
- package/dist/{chunk-MSWLJI4G.js → chunk-XMSH66VU.js} +2 -2
- package/dist/{chunk-ZM7IKQ4X.js → chunk-XVPQNX7O.js} +89 -8
- package/dist/{chunk-YYZC2EQO.cjs → chunk-ZIE6EJGR.cjs} +23 -23
- package/dist/image-editor/index.cjs +880 -852
- package/dist/image-editor/index.js +36 -8
- package/dist/paint/index.cjs +33 -5
- package/dist/paint/index.d.cts +1 -0
- package/dist/paint/index.d.ts +1 -0
- package/dist/paint/index.js +32 -4
- package/dist/paint/live-patterns.d.cts +149 -0
- package/dist/paint/live-patterns.d.ts +149 -0
- package/dist/paint/wet/world.d.cts +13 -0
- package/dist/paint/wet/world.d.ts +13 -0
- package/dist/paint-editor/brush-model.d.cts +7 -1
- package/dist/paint-editor/brush-model.d.ts +7 -1
- package/dist/paint-editor/controller.d.cts +52 -0
- package/dist/paint-editor/controller.d.ts +52 -0
- package/dist/paint-editor/index.cjs +850 -510
- package/dist/paint-editor/index.js +355 -15
- package/dist/paint-editor/ui.d.cts +5 -1
- package/dist/paint-editor/ui.d.ts +5 -1
- package/dist/paint-editor/wet-tools.d.cts +42 -0
- package/dist/paint-editor/wet-tools.d.ts +42 -0
- package/dist/paint-editor/wet.d.cts +22 -1
- package/dist/paint-editor/wet.d.ts +22 -1
- package/dist/vector/index.cjs +1002 -1002
- package/dist/vector/index.js +7 -7
- package/package.json +1 -1
|
@@ -9,17 +9,21 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_BLENDER,
|
|
11
11
|
DEFAULT_BRUSH,
|
|
12
|
+
DEFAULT_LIVE_PATTERNS,
|
|
12
13
|
DEFAULT_MIXER,
|
|
13
14
|
DEFAULT_SMUDGE,
|
|
14
15
|
GRAIN_PATTERNS,
|
|
16
|
+
LIVE_PATTERN_KINDS,
|
|
17
|
+
LIVE_PATTERN_PRESETS,
|
|
15
18
|
MAX_BRUSH_SIZE,
|
|
16
19
|
PAINT_GRADIENT_JSON_SCHEMA,
|
|
17
20
|
normalizeBlender,
|
|
18
21
|
normalizeBrush,
|
|
22
|
+
normalizeLivePatterns,
|
|
19
23
|
normalizeMixer,
|
|
20
24
|
normalizeSmudge,
|
|
21
25
|
readPaintSource
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-LDZOXESA.js";
|
|
23
27
|
import {
|
|
24
28
|
BLEND_MODES
|
|
25
29
|
} from "./chunk-IRSTHLQQ.js";
|
|
@@ -278,6 +282,29 @@ var BRUSH_PRESETS = [
|
|
|
278
282
|
behaviour: { surface: "wet", exchange: { pickup: 0.4, mix: 0.4 }, wet: { water: 0.8, pigment: 0.45, rewet: 0.2 } },
|
|
279
283
|
colour: { default: { type: "gradient", stops: [{ offset: 0, color: "paint" }, { offset: 1, color: "secondary" }], space: "pigment", map: { by: "distance", length: 500, repeat: "mirror", unit: "px" } } }
|
|
280
284
|
},
|
|
285
|
+
// Live patterns: Gray-Scott reaction-diffusion that grows inside the wet wash and freezes as it dries.
|
|
286
|
+
{
|
|
287
|
+
id: "turing-wash",
|
|
288
|
+
name: "Turing wash",
|
|
289
|
+
kind: "mark",
|
|
290
|
+
medium: "paint",
|
|
291
|
+
variety: "watercolor",
|
|
292
|
+
tip: { shape: "round", size: 36, hardness: 0.5, spacing: 0.12 },
|
|
293
|
+
dynamics: { smoothing: 0.25, pressureOpacity: true, minSize: 0.35 },
|
|
294
|
+
behaviour: { surface: "wet", exchange: { pickup: 0.45 }, wet: { water: 0.75, pigment: 0.55, rewet: 0.2 } },
|
|
295
|
+
livePatterns: { pattern: "spots", contrast: 1.2, secondColor: "#0ea5e9", relief: 0.25 }
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
id: "coral-ink",
|
|
299
|
+
name: "Coral ink",
|
|
300
|
+
kind: "mark",
|
|
301
|
+
medium: "ink",
|
|
302
|
+
variety: "watercolor",
|
|
303
|
+
tip: { shape: "round", size: 22, hardness: 0.65, spacing: 0.12 },
|
|
304
|
+
dynamics: { smoothing: 0.3, pressureOpacity: true, minSize: 0.3 },
|
|
305
|
+
behaviour: { surface: "wet", exchange: { pickup: 0.35 }, wet: { water: 0.7, pigment: 0.75, rewet: 0.15 } },
|
|
306
|
+
livePatterns: { pattern: "coral", scale: 1.2, contrast: 1.3 }
|
|
307
|
+
},
|
|
281
308
|
{
|
|
282
309
|
id: "watercolor-detail",
|
|
283
310
|
name: "Watercolour rigger",
|
|
@@ -1152,6 +1179,12 @@ function countAndFlip(raw, base) {
|
|
|
1152
1179
|
return { ...n > 1 ? { count: n } : {}, ...flip !== "none" ? { flip } : {} };
|
|
1153
1180
|
}
|
|
1154
1181
|
var withTipGrain = (g) => g ? { tipGrain: g } : {};
|
|
1182
|
+
var withLivePatterns = (lp) => lp ? { livePatterns: lp } : {};
|
|
1183
|
+
function readLivePatterns(raw, base) {
|
|
1184
|
+
if (raw === null) return null;
|
|
1185
|
+
if (!raw || typeof raw !== "object") return base;
|
|
1186
|
+
return normalizeLivePatterns(raw, base ?? DEFAULT_LIVE_PATTERNS);
|
|
1187
|
+
}
|
|
1155
1188
|
function readTipGrain(raw, base) {
|
|
1156
1189
|
if (raw === null) return null;
|
|
1157
1190
|
if (!raw || typeof raw !== "object") return base;
|
|
@@ -1299,6 +1332,7 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1299
1332
|
stamp: readStamp(raw.stamp, b.stamp ?? null),
|
|
1300
1333
|
spray: readSpray(raw.spray, b.spray ?? null),
|
|
1301
1334
|
...withTipGrain(readTipGrain(raw.tipGrain, b.tipGrain ?? null)),
|
|
1335
|
+
...withLivePatterns(readLivePatterns(raw.livePatterns, b.livePatterns ?? null)),
|
|
1302
1336
|
paint,
|
|
1303
1337
|
...raw.builtin ? { builtin: true } : {}
|
|
1304
1338
|
};
|
|
@@ -1352,6 +1386,23 @@ var ONE_STAMP = {
|
|
|
1352
1386
|
toEngine: (v) => v[0] ?? null,
|
|
1353
1387
|
toFacet: (v) => v ? [v] : void 0
|
|
1354
1388
|
};
|
|
1389
|
+
var LIVE_PATTERNS_MAP = {
|
|
1390
|
+
toEngine: (v) => v !== null && typeof v === "object" ? JSON.parse(JSON.stringify(v)) : v,
|
|
1391
|
+
toFacet: (v) => {
|
|
1392
|
+
if (!v || typeof v !== "object") return void 0;
|
|
1393
|
+
const lp = v;
|
|
1394
|
+
const preset = LIVE_PATTERN_PRESETS[lp.pattern] ?? LIVE_PATTERN_PRESETS.spots;
|
|
1395
|
+
return {
|
|
1396
|
+
pattern: lp.pattern,
|
|
1397
|
+
...lp.feed !== preset.feed ? { feed: lp.feed } : {},
|
|
1398
|
+
...lp.kill !== preset.kill ? { kill: lp.kill } : {},
|
|
1399
|
+
...lp.scale !== DEFAULT_LIVE_PATTERNS.scale ? { scale: lp.scale } : {},
|
|
1400
|
+
...lp.contrast !== DEFAULT_LIVE_PATTERNS.contrast ? { contrast: lp.contrast } : {},
|
|
1401
|
+
...lp.secondColor !== null ? { secondColor: lp.secondColor } : {},
|
|
1402
|
+
...lp.relief !== DEFAULT_LIVE_PATTERNS.relief ? { relief: lp.relief } : {}
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1355
1406
|
var f = (facet, engine, engines = ALL, extra = {}) => ({ facet, engine, engines, ...extra });
|
|
1356
1407
|
var each = (facetPrefix, enginePrefix, keys, engines) => keys.map((k) => f(`${facetPrefix}.${k}`, `${enginePrefix}.${k}`, engines));
|
|
1357
1408
|
var BRUSH_FIELDS = [
|
|
@@ -1390,6 +1441,7 @@ var BRUSH_FIELDS = [
|
|
|
1390
1441
|
f("behaviour.strength", "wet.strength", ["wet"]),
|
|
1391
1442
|
// Surfaces.
|
|
1392
1443
|
...each("behaviour.wet", "wet", ["medium", "water", "pigment", "body", "rewet", "load", "thinner"], ["wet"]),
|
|
1444
|
+
f("livePatterns", "livePatterns", ["wet"], { map: LIVE_PATTERNS_MAP }),
|
|
1393
1445
|
...each("ghost", "ghost", ["linger", "smear", "trigger"], ["wet"]),
|
|
1394
1446
|
...each("mutation", "mutation", ["settle", "patience", "fade"], ["dab", "wet", "impasto", "particle", "bristle"]),
|
|
1395
1447
|
f("behaviour.thick.applicator", "impasto.tool", ["impasto"]),
|
|
@@ -1486,6 +1538,7 @@ function resolveBrush(brush, options = {}) {
|
|
|
1486
1538
|
if (brush.iridescence && FILM.includes(engine)) input.iridescence = { ...input.iridescence ?? {} };
|
|
1487
1539
|
if (engine === "wet") {
|
|
1488
1540
|
setPath(input, "wet.tool", brush.kind === "tool" ? WET_TOOL_OF[brush.tool] : "paint");
|
|
1541
|
+
if (brush.kind === "tool") delete input.livePatterns;
|
|
1489
1542
|
const medium = resolveWetMedium(brush);
|
|
1490
1543
|
if (medium) setPath(input, "wet.medium", medium);
|
|
1491
1544
|
if (brush.kind !== "tool" && brush.ghost) input.ghost = { ...input.ghost ?? {} };
|
|
@@ -1574,7 +1627,7 @@ function skeleton(b) {
|
|
|
1574
1627
|
}
|
|
1575
1628
|
}
|
|
1576
1629
|
}
|
|
1577
|
-
var ORDER = ["id", "name", "description", "tags", "kind", "medium", "variety", "tool", "tip", "marks", "dynamics", "behaviour", "light", "fluorescence", "thermochromic", "iridescence", "ghost", "mutation", "motion", "colour"];
|
|
1630
|
+
var ORDER = ["id", "name", "description", "tags", "kind", "medium", "variety", "tool", "tip", "marks", "dynamics", "behaviour", "light", "fluorescence", "thermochromic", "iridescence", "ghost", "mutation", "motion", "livePatterns", "colour"];
|
|
1578
1631
|
function migrateBrushV1(raw) {
|
|
1579
1632
|
const b = normalizePaintBrush(raw);
|
|
1580
1633
|
const brush = skeleton(b);
|
|
@@ -1818,6 +1871,19 @@ var MOTION = object("Animation after painting.", {
|
|
|
1818
1871
|
fps: int(1, 60, "Suggested playback rate in frames per second."),
|
|
1819
1872
|
waveSpeed: unit3("Particle waves: how fast they run by stroke time; 0 they stand still (default 0), 1 about four a second.")
|
|
1820
1873
|
});
|
|
1874
|
+
var LIVE_PATTERNS = object("Gray-Scott reaction-diffusion patterns (spots, stripes, coral, maze, worms) that grow inside wet paint (behaviour.surface: wet) and freeze where the paint dries.", {
|
|
1875
|
+
pattern: oneOf2(LIVE_PATTERN_KINDS, "Named Pearson feed/kill preset: spots (default, dividing mitosis spots), stripes (labyrinthine stripes), coral (branching dendrites), maze (winding channels) or worms (vermicular tracks)."),
|
|
1876
|
+
feed: num(0.01, 0.1, "Gray-Scott feed rate F (0.01..0.1; default from pattern)."),
|
|
1877
|
+
kill: num(0.03, 0.08, "Gray-Scott kill rate k (0.03..0.08; default from pattern)."),
|
|
1878
|
+
scale: num(0.5, 4, "Spatial scale of the pattern (diffusion multiplier, 0.5..4, default 1)."),
|
|
1879
|
+
contrast: num(0, 2, "Visual contrast of the V concentration field (0..2, default 1)."),
|
|
1880
|
+
secondColor: {
|
|
1881
|
+
type: ["string", "null"],
|
|
1882
|
+
pattern: "^#[0-9a-fA-F]{6}$",
|
|
1883
|
+
description: "Optional second colour (#rrggbb) that V blends the wet paint towards; null or omitted modulates pigment density/contrast."
|
|
1884
|
+
},
|
|
1885
|
+
relief: unit3("Impasto relief height written to the layer thick map as patterns grow (0..1, default 0).")
|
|
1886
|
+
});
|
|
1821
1887
|
var SOLID = {
|
|
1822
1888
|
type: "string",
|
|
1823
1889
|
pattern: "^(#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*(,\\s*(0|1|0?\\.\\d+)\\s*)?\\))$",
|
|
@@ -1882,6 +1948,7 @@ var BRUSH_JSON_SCHEMA = object(
|
|
|
1882
1948
|
ghost: GHOST,
|
|
1883
1949
|
mutation: MUTATION,
|
|
1884
1950
|
motion: MOTION,
|
|
1951
|
+
livePatterns: LIVE_PATTERNS,
|
|
1885
1952
|
colour: COLOUR
|
|
1886
1953
|
},
|
|
1887
1954
|
["id", "name", "kind", "tip"]
|
|
@@ -1899,6 +1966,7 @@ var BRUSH_FACET_SCHEMAS = {
|
|
|
1899
1966
|
ghost: GHOST,
|
|
1900
1967
|
mutation: MUTATION,
|
|
1901
1968
|
motion: MOTION,
|
|
1969
|
+
livePatterns: LIVE_PATTERNS,
|
|
1902
1970
|
colour: COLOUR,
|
|
1903
1971
|
paint: PAINT
|
|
1904
1972
|
};
|
|
@@ -2047,17 +2115,19 @@ function read(value, schema, path, problems) {
|
|
|
2047
2115
|
problems.push(`${path} must be ${JSON.stringify(schema.const)}; dropped.`);
|
|
2048
2116
|
return void 0;
|
|
2049
2117
|
}
|
|
2050
|
-
|
|
2118
|
+
if (value === null && Array.isArray(schema.type) && schema.type.includes("null")) return null;
|
|
2119
|
+
const schemaType = Array.isArray(schema.type) ? schema.type[0] : schema.type;
|
|
2120
|
+
switch (schemaType) {
|
|
2051
2121
|
case "number":
|
|
2052
2122
|
case "integer": {
|
|
2053
2123
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2054
2124
|
problems.push(`${path} must be a number; dropped.`);
|
|
2055
2125
|
return void 0;
|
|
2056
2126
|
}
|
|
2057
|
-
let n =
|
|
2127
|
+
let n = schemaType === "integer" ? Math.round(value) : value;
|
|
2058
2128
|
if (schema.minimum !== void 0 && n < schema.minimum) n = schema.minimum;
|
|
2059
2129
|
if (schema.maximum !== void 0 && n > schema.maximum) n = schema.maximum;
|
|
2060
|
-
if (n !== value) problems.push(`${path} ${value} is out of range (${schema.minimum}..${schema.maximum}${
|
|
2130
|
+
if (n !== value) problems.push(`${path} ${value} is out of range (${schema.minimum}..${schema.maximum}${schemaType === "integer" ? ", whole" : ""}); set to ${n}.`);
|
|
2061
2131
|
return n;
|
|
2062
2132
|
}
|
|
2063
2133
|
case "boolean":
|
|
@@ -2070,7 +2140,8 @@ function read(value, schema, path, problems) {
|
|
|
2070
2140
|
problems.push(`${path} ${JSON.stringify(value)} is not valid${schema.enum ? `; use one of ${schema.enum.join(", ")}` : ""}; dropped.`);
|
|
2071
2141
|
return void 0;
|
|
2072
2142
|
}
|
|
2073
|
-
|
|
2143
|
+
const s = schema.pattern === "^#[0-9a-fA-F]{6}$" ? value.toLowerCase() : value;
|
|
2144
|
+
return schema.maxLength !== void 0 ? s.slice(0, schema.maxLength) : s;
|
|
2074
2145
|
}
|
|
2075
2146
|
case "array": {
|
|
2076
2147
|
if (!Array.isArray(value)) {
|
|
@@ -2145,8 +2216,8 @@ function normalizeBrushSpec(raw, problems = []) {
|
|
|
2145
2216
|
if (out.thermochromic?.hotColor) out.thermochromic.hotColor = out.thermochromic.hotColor.toLowerCase();
|
|
2146
2217
|
const brush = { id: raw.id, name, ...out, kind, ...tool ? { tool } : {}, tip: out.tip ?? { shape: "round" } };
|
|
2147
2218
|
const ordered = () => {
|
|
2148
|
-
const { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, fluorescence, thermochromic, iridescence, ghost, mutation, motion, colour } = brush;
|
|
2149
|
-
const all = { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, fluorescence, thermochromic, iridescence, ghost, mutation, motion, colour };
|
|
2219
|
+
const { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, fluorescence, thermochromic, iridescence, ghost, mutation, motion, livePatterns, colour } = brush;
|
|
2220
|
+
const all = { id, name: n, description, tags, kind: k, medium, variety, tool: t, tip, marks, dynamics, behaviour, light, fluorescence, thermochromic, iridescence, ghost, mutation, motion, livePatterns, colour };
|
|
2150
2221
|
return Object.fromEntries(Object.entries(all).filter(([, v]) => v !== void 0));
|
|
2151
2222
|
};
|
|
2152
2223
|
if (!out.tip) problems.push("tip is missing; a round tip is used.");
|
|
@@ -2279,6 +2350,10 @@ function normalizeBrushSpec(raw, problems = []) {
|
|
|
2279
2350
|
delete b.exchange;
|
|
2280
2351
|
}
|
|
2281
2352
|
}
|
|
2353
|
+
if (brush.livePatterns && (kind !== "mark" || brush.behaviour?.surface !== "wet" || brush.marks?.kind === "particles" || brush.marks?.kind === "objects" || brush.tip.shape === "bristle")) {
|
|
2354
|
+
drop("livePatterns", "only wet paint brushes grow live patterns (set behaviour.surface to wet)");
|
|
2355
|
+
delete brush.livePatterns;
|
|
2356
|
+
}
|
|
2282
2357
|
if (brush.ghost) {
|
|
2283
2358
|
if (kind === "tool" || brush.behaviour?.surface !== "wet") {
|
|
2284
2359
|
drop("ghost", "it needs a mark brush with behaviour.surface wet");
|
|
@@ -2318,6 +2393,7 @@ var PAINT_PROFILE = {
|
|
|
2318
2393
|
tilt: "full",
|
|
2319
2394
|
tipGrain: "full",
|
|
2320
2395
|
dabCount: "full",
|
|
2396
|
+
livePatterns: "full",
|
|
2321
2397
|
iridescence: "full"
|
|
2322
2398
|
};
|
|
2323
2399
|
var IMAGE_PROFILE = {
|
|
@@ -2395,6 +2471,7 @@ function checkBrush(brush, profile) {
|
|
|
2395
2471
|
feature(profile.exchange, !ex?.reservoir && (nonZero(ex?.pickup) || !!ex?.dirty), "behaviour.exchange", "picking paint up", "Remove behaviour.exchange.");
|
|
2396
2472
|
feature(profile.grain, nonZero(brush.behaviour?.grain), "behaviour.grain", "paper grain", "Set behaviour.grain to 0.");
|
|
2397
2473
|
feature(profile.light, nonZero(brush.light?.amount), "light", "light paint (glow and spill)", "Remove light (or set light.amount to 0).");
|
|
2474
|
+
feature(profile.livePatterns ?? "none", Boolean(brush.livePatterns), "livePatterns", "live reaction-diffusion patterns", "Remove livePatterns.");
|
|
2398
2475
|
const smartInks = profile.id === "paint" ? "full" : "none";
|
|
2399
2476
|
feature(smartInks, nonZero(brush.fluorescence?.amount), "fluorescence", "UV-fluorescent ink", "Remove fluorescence (or set fluorescence.amount to 0).");
|
|
2400
2477
|
feature(smartInks, Boolean(brush.thermochromic?.hotColor), "thermochromic", "thermochromic ink", "Remove thermochromic.");
|
|
@@ -2458,8 +2535,12 @@ function degrade(brush, profile, options = {}) {
|
|
|
2458
2535
|
delete b.behaviour.surface;
|
|
2459
2536
|
delete b.behaviour.wet;
|
|
2460
2537
|
delete b.behaviour.thick;
|
|
2538
|
+
delete b.livePatterns;
|
|
2461
2539
|
delete b.ghost;
|
|
2462
2540
|
break;
|
|
2541
|
+
case "livePatterns":
|
|
2542
|
+
delete b.livePatterns;
|
|
2543
|
+
break;
|
|
2463
2544
|
case "ghost":
|
|
2464
2545
|
delete b.ghost;
|
|
2465
2546
|
break;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkOY24XRYFcjs = require('./chunk-OY24XRYF.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
|
|
@@ -1361,12 +1361,12 @@ var unit = (x, y) => {
|
|
|
1361
1361
|
return l > 1e-12 && Number.isFinite(l) ? [x / l, y / l] : null;
|
|
1362
1362
|
};
|
|
1363
1363
|
function cubicOf(sp, i) {
|
|
1364
|
-
const s =
|
|
1364
|
+
const s = _chunkOY24XRYFcjs.subpathSegment.call(void 0, sp, i);
|
|
1365
1365
|
if (s.length === 4) return s;
|
|
1366
1366
|
const [a, b] = s;
|
|
1367
1367
|
return [a, [a[0] + (b[0] - a[0]) / 3, a[1] + (b[1] - a[1]) / 3], [a[0] + 2 * (b[0] - a[0]) / 3, a[1] + 2 * (b[1] - a[1]) / 3], b];
|
|
1368
1368
|
}
|
|
1369
|
-
var isLine = (sp, i) =>
|
|
1369
|
+
var isLine = (sp, i) => _chunkOY24XRYFcjs.subpathSegment.call(void 0, sp, i).length === 2;
|
|
1370
1370
|
function startTangent(c) {
|
|
1371
1371
|
for (let k = 1; k < 4; k++) {
|
|
1372
1372
|
const u = unit(c[k][0] - c[0][0], c[k][1] - c[0][1]);
|
|
@@ -1386,10 +1386,10 @@ function sample(c, n, out, withStart) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
var onAnchor = (a, h) => !h || Math.abs(h.x - a.x) < EPS && Math.abs(h.y - a.y) < EPS;
|
|
1388
1388
|
function tidy(a, keepType = true) {
|
|
1389
|
-
const next =
|
|
1389
|
+
const next = _chunkOY24XRYFcjs.cloneAnchor.call(void 0, a);
|
|
1390
1390
|
if (onAnchor(next, next.in)) delete next.in;
|
|
1391
1391
|
if (onAnchor(next, next.out)) delete next.out;
|
|
1392
|
-
const shown =
|
|
1392
|
+
const shown = _chunkOY24XRYFcjs.inferAnchorType.call(void 0, next);
|
|
1393
1393
|
const type = keepType && a.type ? a.type === "symmetric" && shown !== "symmetric" ? shown === "corner" ? "corner" : "smooth" : a.type === "smooth" && shown === "corner" ? "corner" : a.type : shown;
|
|
1394
1394
|
if (type === "corner") delete next.type;
|
|
1395
1395
|
else next.type = type;
|
|
@@ -1433,7 +1433,7 @@ function fitAcross(pts, N, t0, t1) {
|
|
|
1433
1433
|
return goldenMin(fit, 0, 1);
|
|
1434
1434
|
}
|
|
1435
1435
|
function removeAnchorKeepingShape(sp, index) {
|
|
1436
|
-
const anchors = sp.anchors.map(
|
|
1436
|
+
const anchors = sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor);
|
|
1437
1437
|
const n = anchors.length;
|
|
1438
1438
|
if (index < 0 || index >= n) return { anchors, closed: sp.closed };
|
|
1439
1439
|
if ((sp.closed || index > 0 && index < n - 1) && n >= 3) {
|
|
@@ -1467,12 +1467,12 @@ function removeAnchorKeepingShape(sp, index) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
function removeAnchorsKeepingShape(sp, indices) {
|
|
1469
1469
|
const order = [...new Set(indices)].filter((i) => i >= 0 && i < sp.anchors.length).sort((a, b) => b - a);
|
|
1470
|
-
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(
|
|
1470
|
+
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed });
|
|
1471
1471
|
}
|
|
1472
1472
|
function bendSegment(sp, segment, t, p) {
|
|
1473
|
-
const anchors = sp.anchors.map(
|
|
1473
|
+
const anchors = sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor);
|
|
1474
1474
|
const n = anchors.length;
|
|
1475
|
-
if (segment < 0 || segment >=
|
|
1475
|
+
if (segment < 0 || segment >= _chunkOY24XRYFcjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
|
|
1476
1476
|
const tc = Math.min(0.95, Math.max(0.05, t));
|
|
1477
1477
|
const ia = segment;
|
|
1478
1478
|
const ib = (segment + 1) % n;
|
|
@@ -1483,16 +1483,16 @@ function bendSegment(sp, segment, t, p) {
|
|
|
1483
1483
|
const oy = (p.y - (a.y + (b.y - a.y) * tc)) / k;
|
|
1484
1484
|
const c1 = { x: a.x + (b.x - a.x) / 3 + ox, y: a.y + (b.y - a.y) / 3 + oy };
|
|
1485
1485
|
const c2 = { x: b.x + (a.x - b.x) / 3 + ox, y: b.y + (a.y - b.y) / 3 + oy };
|
|
1486
|
-
anchors[ia] =
|
|
1487
|
-
anchors[ib] =
|
|
1486
|
+
anchors[ia] = _chunkOY24XRYFcjs.moveAnchorHandle.call(void 0, a, "out", c1);
|
|
1487
|
+
anchors[ib] = _chunkOY24XRYFcjs.moveAnchorHandle.call(void 0, b, "in", c2);
|
|
1488
1488
|
return { anchors, closed: sp.closed };
|
|
1489
1489
|
}
|
|
1490
1490
|
function subpathPointAt(sp, segment, t) {
|
|
1491
|
-
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0,
|
|
1491
|
+
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkOY24XRYFcjs.subpathSegment.call(void 0, sp, segment), t);
|
|
1492
1492
|
return { x, y };
|
|
1493
1493
|
}
|
|
1494
1494
|
function curvatureMoveAnchor(sp, index, q) {
|
|
1495
|
-
const anchors = sp.anchors.map(
|
|
1495
|
+
const anchors = sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor);
|
|
1496
1496
|
const a = sp.anchors[index];
|
|
1497
1497
|
if (!a) return { anchors, closed: sp.closed };
|
|
1498
1498
|
const own = [
|
|
@@ -1538,7 +1538,7 @@ function curvatureMoveAnchor(sp, index, q) {
|
|
|
1538
1538
|
function cutSubpathAt(sp, at) {
|
|
1539
1539
|
const n = sp.anchors.length;
|
|
1540
1540
|
const cuts = [...new Set(at)].filter((i) => Number.isInteger(i) && i >= 0 && i < n && (sp.closed || i > 0 && i < n - 1)).sort((a, b) => a - b);
|
|
1541
|
-
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(
|
|
1541
|
+
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed }];
|
|
1542
1542
|
const first = cuts[0];
|
|
1543
1543
|
const run = sp.closed ? Array.from({ length: n + 1 }, (_, i) => sp.anchors[(first + i) % n]) : sp.anchors;
|
|
1544
1544
|
const cutSet = new Set(sp.closed ? [...cuts.map((c) => (c - first + n) % n), n] : cuts);
|
|
@@ -1546,7 +1546,7 @@ function cutSubpathAt(sp, at) {
|
|
|
1546
1546
|
let cur = [];
|
|
1547
1547
|
run.forEach((a, i) => {
|
|
1548
1548
|
if (!cutSet.has(i)) {
|
|
1549
|
-
cur.push(
|
|
1549
|
+
cur.push(_chunkOY24XRYFcjs.cloneAnchor.call(void 0, a));
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (cur.length) {
|
|
@@ -1561,10 +1561,10 @@ function cutSubpathAt(sp, at) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function splitSubpathAt(sp, segment, t, endTolerance = 1e-6) {
|
|
1563
1563
|
const n = sp.anchors.length;
|
|
1564
|
-
if (segment < 0 || segment >=
|
|
1564
|
+
if (segment < 0 || segment >= _chunkOY24XRYFcjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed }];
|
|
1565
1565
|
if (t <= endTolerance) return cutSubpathAt(sp, [segment]);
|
|
1566
1566
|
if (t >= 1 - endTolerance) return cutSubpathAt(sp, [(segment + 1) % n]);
|
|
1567
|
-
const { subpath, index } =
|
|
1567
|
+
const { subpath, index } = _chunkOY24XRYFcjs.insertAnchor.call(void 0, sp, segment, t);
|
|
1568
1568
|
return cutSubpathAt(subpath, [index]);
|
|
1569
1569
|
}
|
|
1570
1570
|
var endOf = (sp, last) => sp.anchors[last ? sp.anchors.length - 1 : 0];
|
|
@@ -1587,7 +1587,7 @@ function joinSubpaths(subpaths, tolerance) {
|
|
|
1587
1587
|
const closed = [];
|
|
1588
1588
|
let open = [];
|
|
1589
1589
|
for (const sp of subpaths) {
|
|
1590
|
-
const copy = { anchors: sp.anchors.map(
|
|
1590
|
+
const copy = { anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed };
|
|
1591
1591
|
if (sp.closed || sp.anchors.length < 2) {
|
|
1592
1592
|
if (sp.anchors.length) closed.push(copy);
|
|
1593
1593
|
} else open.push(copy);
|
|
@@ -1642,7 +1642,7 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1642
1642
|
const t = Math.min(1, Math.max(0, amount));
|
|
1643
1643
|
const orig = sp.anchors;
|
|
1644
1644
|
const n = orig.length;
|
|
1645
|
-
const anchors = orig.map(
|
|
1645
|
+
const anchors = orig.map(_chunkOY24XRYFcjs.cloneAnchor);
|
|
1646
1646
|
if (n < 3 || t === 0) return { anchors, closed: sp.closed };
|
|
1647
1647
|
for (let i = 0; i < n; i++) {
|
|
1648
1648
|
if (!sp.closed && (i === 0 || i === n - 1)) continue;
|
|
@@ -1671,8 +1671,8 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
function segsOf(sp) {
|
|
1673
1673
|
const out = [];
|
|
1674
|
-
for (let i = 0; i <
|
|
1675
|
-
const s =
|
|
1674
|
+
for (let i = 0; i < _chunkOY24XRYFcjs.subpathSegmentCount.call(void 0, sp); i++) {
|
|
1675
|
+
const s = _chunkOY24XRYFcjs.subpathSegment.call(void 0, sp, i);
|
|
1676
1676
|
out.push(s.length === 2 ? { c: s, line: true } : { c: s, line: false });
|
|
1677
1677
|
}
|
|
1678
1678
|
return out;
|
|
@@ -1729,7 +1729,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1729
1729
|
const tol = Math.max(tolerance, 1e-9);
|
|
1730
1730
|
const types = new Map(sp.anchors.filter((a) => a.type).map((a) => [`${a.x},${a.y}`, a.type]));
|
|
1731
1731
|
const segs = segsOf(sp).filter((s) => !isZeroSeg(s));
|
|
1732
|
-
if (!segs.length) return { anchors: sp.anchors.map(
|
|
1732
|
+
if (!segs.length) return { anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed };
|
|
1733
1733
|
const minSegs = sp.closed ? 2 : 1;
|
|
1734
1734
|
let changed = true;
|
|
1735
1735
|
while (changed && segs.length > minSegs) {
|
|
@@ -1747,7 +1747,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1747
1747
|
break;
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
|
-
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(
|
|
1750
|
+
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkOY24XRYFcjs.cloneAnchor), closed: sp.closed }));
|
|
1751
1751
|
}
|
|
1752
1752
|
|
|
1753
1753
|
|