Skip to content

Unlock custom brushes, natural fill effects and intuitive hatching in p5.js

Updates to fill function + new scale() + bug fixes

Alejandrobb50e71afe7a
diff --git a/README.md b/README.md
index c825dd9..1b47f0c 100644
--- a/README.md
+++ b/README.md
@@ -77,15 +77,15 @@ p5.brush.js provides a comprehensive API for creating complex drawings and effec
| [Utility](#utility-functions) | brush.push() | | [Hatch Operations](#hatch-operations) | brush.hatch() |
| | brush.pop() | | | brush.noHatch() |
| | brush.rotate() | | | brush.setHatch() |
-| | brush.reDraw() | | [Geometry](#geometry) | brush.point() |
-| | brush.reBlend() | | | brush.line() |
-| [Vector-Fields](#vector-fields) | brush.field() | | | brush.flowLine() |
-| | brush.noField() | | | brush.beginStroke() |
-| | brush.refreshField()| | | brush.segment() |
-| | brush.listFields() | | | brush.endStroke() |
-| | brush.addField() | | | brush.spline() |
-| [Brush Management](#brush-management) | brush.scale() | | | brush.plot() |
-| | brush.box() | | | brush.rect() |
+| | brush.scale() | | [Geometry](#geometry) | brush.point() |
+| | brush.reDraw() | | | brush.line() |
+| | brush.reBlend() | | | brush.flowLine() |
+| [Vector-Fields](#vector-fields) | brush.field() | | | brush.beginStroke() |
+| | brush.noField() | | | brush.segment() |
+| | brush.refreshField()| | | brush.endStroke() |
+| | brush.listFields() | | | brush.spline() |
+| | brush.addField() | | | brush.plot() |
+| [Brush Management](#brush-management) | brush.box() | | | brush.rect() |
| | brush.add() | | | brush.circle() |
| | brush.clip() | | | brush.beginShape() |
| | brush.noClip() | | | brush.vertex() |
@@ -95,8 +95,9 @@ p5.brush.js provides a comprehensive API for creating complex drawings and effec
| | brush.noStroke() | | | brush.load() |
| | brush.strokeWeight()| | | brush.preload() |
| [Fill Operations](#fill-operations) | brush.fill() | | | brush.colorCache() |
-| | brush.noFill() | | [Classes](#exposed-classes) | brush.Polygon() |
-| | brush.bleed() | | | brush.Plot() |
+| | brush.noFill() | | | brush.scaleBrushes()|
+| | brush.bleed() | | [Classes](#exposed-classes) | brush.Polygon() |
+| | brush.fillTexture() | | | brush.Plot() |
| | | | | brush.Position() |
---
@@ -119,6 +120,11 @@ p5.brush.js provides a comprehensive API for creating complex drawings and effec
---
+- `brush.scale(scale)`
+ - **Description**: Increases or decreases the size of shapes and strokes by expanding or contracting vertices. Objects always scale from their relative origin to the coordinate system. Scale values are specified as decimal percentages. For example, the function call scale(2.0) increases the dimension of a shape by 200%. Transformations apply to everything that happens after and subsequent calls to the function multiply the effect. For example, calling scale(2.0) and then scale(1.5) is the same as scale(3.0).
+
+---
+
- `brush.reDraw()`
- **Description**: p5.brush uses several buffers and caches to make the drawing operations more performant. Use the reDraw() function if you want to force noBlend brushes to be drawn into the canvas. This function is designed to help maintain the correct draw order for the different strokes and shapes.
@@ -248,20 +254,6 @@ Functions for managing brush behaviors and properties.
---
-- `brush.scale(scale)`
- - **Description**: Adjusts the global scale of all standard brush parameters, including weight, vibration, and spacing, based on the given scaling factor. This function is specifically designed to affect dafault brushes, allowing for uniform scaling across various brush types.
- - **Parameters**:
- - `scale` (Number): The scaling factor to be applied to the brush parameters.
- - **Note**: This function only impacts the default brushes. Custom brushes may not be affected by this scaling, since they are defined per case basis.
- - **Usage**:
- ```javascript
- // Scale all standard brushes by a factor of 1.5
- brush.scale(1.5);
- ```
- Using `brush.scale()`, you can easily adjust the size and spacing characteristics of standard brushes in your project, providing a convenient way to adapt to different canvas sizes or artistic styles.
-
----
-
- `brush.box()`
- **Description**: Retrieves an array containing the unique names of all available brushes. This function is useful for accessing the variety of brushes included in the library, which range from different pencil types to markers and specialized brushes like the hatch brush. Of course, the function will also return the custom brushes you've created.
- **Returns**: `Array<string>` - An array listing the names of all brushes.
@@ -490,16 +482,29 @@ The Fill Management section focuses on managing fill properties for shapes, enab
---
-- `brush.bleed(_i, _texture, _borderIntensity)`
+- `brush.bleed(strength, direction)`
- **Description**: Adjusts the bleed and texture levels for the fill operation, mimicking the behavior of watercolor paints. This function adds a natural and organic feel to digital artwork.
- **Parameters**:
- - `_i` (Number): The intensity of the bleed effect, capped at 0.5.
- - `_texture` (Number): The texture level of the watercolor effect, ranging from 0 to 1.
+ - `strength` (Number): The intensity of the bleed effect, capped at 0.5.
+ - `direction` (String): Optional. "out" or "in". Defines the direction of the bleed effect
- `_borderIntensity` (Number): The intensity of the border watercolor effect, ranging from 0 to 1.
- **Usage**:
```javascript
- // Set the bleed intensity and texture for a watercolor effect
- brush.bleed(0.3, 0.7, 0.5);
+ // Set the bleed intensity and direction for a watercolor effect
+ brush.bleed(0.3, "out");
+ ```
+
+---
+
+- `brush.fillTexture(textureStrength, borderIntensity)`
+ - **Description**: Adjusts the texture levels for the fill operation, mimicking the behavior of watercolor paints. This function adds a natural and organic feel to digital artwork.
+ - **Parameters**:
+ - `textureStrength` (Number): The texture of the fill effect, ranging from 0 to 1.
+ - `borderIntensity` (Number): The intensity of the border watercolor effect, ranging from 0 to 1.
+ - **Usage**:
+ ```javascript
+ // Set the fill texture and border intensity
+ brush.fillTexture(0.6, 0.4);
```
---
@@ -864,6 +869,20 @@ This section covers functions for initializing the drawing system, preloading re
---
+- `brush.scale(scale)`
+ - **Description**: Adjusts the global scale of all standard brush parameters, including weight, vibration, and spacing, based on the given scaling factor. This function is specifically designed to affect default brushes only, allowing for uniform scaling across various brush types.
+ - **Parameters**:
+ - `scale` (Number): The scaling factor to be applied to the brush parameters.
+ - **Note**: This function only impacts the default brushes. Custom brushes may not be affected by this scaling, since they are defined per case basis.
+ - **Usage**:
+ ```javascript
+ // Scale all standard brushes by a factor of 1.5
+ brush.scale(1.5);
+ ```
+ Using `brush.scale()`, you can easily adjust the size and spacing characteristics of standard brushes in your project, providing a convenient way to adapt to different canvas sizes or artistic styles.
+
+---
+
<sub>[back to table](#table-of-functions)</sub>
### Exposed Classes
diff --git a/index.html b/index.html
index 68675de..aaf60b9 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
<title>p5.brush.js Example</title>
<script src="./dependencies/p5.min.js"></script>
<script src="./dependencies/spectral.min.js"></script>
- <script src="./p5.brush.js"></script>
+ <script src="./p5.brush.min.js"></script>
<link rel="stylesheet" href="./style.css">
</head>
<body>
diff --git a/p5.brush.js b/p5.brush.js
index 8d84190..174f373 100644
--- a/p5.brush.js
+++ b/p5.brush.js
@@ -1,6 +1,6 @@
/**
* @fileoverview p5.brush - A comprehensive toolset for brush management in p5.js.
- * @version 1.0.3
+ * @version 1.0.4
* @license MIT
* @author Alejandro Campos Uribe
*
@@ -268,6 +268,11 @@
this.isPrecalculationDone = true;
},
+ /**
+ * Checks if value is numeric
+ */
+ isNumber: (a) => !isNaN(a),
+
/**
* Changes angles to degrees and between 0-360
*/
@@ -276,34 +281,6 @@
// Perform the precalculation of trigonometric values for the R object
R.preCalculation();
- /**
- * Object to perform matrix translation and rotation operations
- */
- const Matrix = {
- translation: [0, 0],
- rotation: 0,
- /**
- * Captures the desired rotation.
- */
- rotate (a) {
- Matrix.rotation = R.toDegrees(a)
- },
- /**
- * Captures the current translation values from the renderer's transformation matrix.
- *
- * Assumes that the renderer's transformation matrix (`uMVMatrix`) is a 4x4 matrix
- * where the translation components are in the 13th (index 12) and 14th (index 13) positions.
- *
- * @returns {number[]} An array containing the x (horizontal) and y (vertical) translation values.
- */
- trans () {
- // Access the renderer's current model-view matrix and extract the translation components
- this.translation = [_r._renderer.uMVMatrix.mat4[12],_r._renderer.uMVMatrix.mat4[13]];
- // Return the translation components as a two-element array
- return this.translation
- }
- }
-
/**
* Calculates the intersection point between two line segments if it exists.
*
@@ -386,7 +363,6 @@
_saveState.stroke.brush = B.name;
_saveState.stroke.color = B.c;
_saveState.stroke.weight = B.w;
- _saveState.stroke.globalScale = _gScale;
_saveState.stroke.clip = B.cr;
// Hatch
@@ -419,7 +395,6 @@
B.name = _saveState.stroke.brush;
B.c = _saveState.stroke.color;
B.w = _saveState.stroke.weight;
- _gScale = _saveState.stroke.globalScale;
B.cr = _saveState.stroke.clip;
// Hatch
@@ -438,6 +413,46 @@
// Rotate
Matrix.rotation = _saveState.others.rotate;
}
+
+ /**
+ * Object to perform matrix translation and rotation operations
+ */
+ const Matrix = {
+ translation: [0, 0],
+ rotation: 0,
+ /**
+ * Captures the desired rotation.
+ */
+ rotate (a = 0) {
+ if (!R.isNumber(a)) {
+ console.log("ERROR rotate(): Value must be numeric");
+ return null;
+ }
+ Matrix.rotation = R.toDegrees(a)
+ },
+ /**
+ * Captures the current translation values from the renderer's transformation matrix.
+ *
+ * Assumes that the renderer's transformation matrix (`uMVMatrix`) is a 4x4 matrix
+ * where the translation components are in the 13th (index 12) and 14th (index 13) positions.
+ *
+ * @returns {number[]} An array containing the x (horizontal) and y (vertical) translation values.
+ */
+ trans () {
+ // Access the renderer's current model-view matrix and extract the translation components
+ this.translation = [_r._renderer.uMVMatrix.mat4[12],_r._renderer.uMVMatrix.mat4[13]];
+ // Return the translation components as a two-element array
+ return this.translation
+ }
+ }
+
+ /**
+ * Object to perform scale operations
+ */
+ const Scale = {
+ current: 1,
+ update: (a) => Scale.current *= a
+ }
// =============================================================================
@@ -763,6 +778,11 @@
*/
function selectField (a) {
_ensureReady();
+ // Check if field exists
+ if (!FF.list.has(a)) {
+ console.log("ERROR field(): No VectorField with that name");
+ return null;
+ }
FF.isActive = true; // Mark the field framework as active
FF.current = a; // Update the current field
}
@@ -794,6 +814,10 @@
* EXPORTED
*/
function refreshField(t) {
+ if (!R.isNumber(t)) {
+ console.log("ERROR refreshField(): Value for refreshField must be numeric");
+ return null
+ }
FF.refresh(t)
}
@@ -984,11 +1008,11 @@
}
/**
- * Checks if the position is within the canvas bounds.
- * @returns {boolean} - True if the position is within the canvas, false otherwise.
+ * Checks if the position is within reasonable bounds (+ half canvas on each side).
+ * @returns {boolean} - True if the position is within bounds, false otherwise.
*/
isInCanvas() {
- let w = 0.55 * _r.width, h = 0.55 * _r.height;
+ let w = _r.width, h = _r.height;
return (this.x >= -w - Matrix.trans()[0] && this.x <= w - Matrix.trans()[0]) && (this.y >= -h - Matrix.trans()[1] && this.y <= h - Matrix.trans()[1])
}
@@ -1135,6 +1159,7 @@
*/
add: (a, b) => {
const isBlendableType = b.type === "marker" || b.type === "custom" || b.type === "image";
+ if (!isBlendableType && b.type !== "spray") b.type = "default";
if (b.type === "image") {
T.add(b.image.src);
b.tip = () => B.mask.image(T.tips.get(B.p.image.src), -B.p.weight / 2, -B.p.weight / 2, B.p.weight, B.p.weight);
@@ -1151,7 +1176,7 @@
* EXPORTED
*/
set(brushName, color, weight = 1) {
- B.name = brushName;
+ B.setBrush(brushName);
B.c = color;
B.w = weight;
B.isActive = true;
@@ -1163,6 +1188,10 @@
* EXPORTED
*/
setBrush(brushName) {
+ if (!B.list.has(brushName)) {
+ console.log("ERROR set() / setBrush() / setHatch():\n No brush with that name");
+ return null;
+ }
B.name = brushName;
},
@@ -1255,7 +1284,8 @@
*/
spacing() {
this.p = this.list.get(this.name).param
- return this.p.spacing * this.w;
+ if (this.p.type === "default" || this.p.type === "spray") return this.p.spacing / this.w;
+ return this.p.spacing;
},
/**
@@ -1329,6 +1359,7 @@
this.mask.noStroke();
(this.p.type === "image") ? this.mask.translate(Matrix.translation[0],Matrix.translation[1]) : this.mask.translate(Matrix.translation[0] + _r.width/2,Matrix.translation[1] + _r.height/2);
this.mask.rotate(-Matrix.rotation)
+ this.mask.scale(Scale.current)
if (this.p.blend) {
if (this.p.type !== "image") Mix.blend(this.c);
else Mix.blend(this.c,false,true)
@@ -1411,7 +1442,10 @@
* @returns {number} The calculated alpha value.
*/
calculateAlpha(pressure) {
- return Math.floor(this.p.opacity * Math.pow(pressure, this.p.type === "marker" ? 0.7 : 1.5));
+ let opacity = (this.p.type !== "default" && this.p.type !== "spray") ?
+ this.p.opacity / this.w :
+ this.p.opacity;
+ return Math.floor(opacity * Math.pow(pressure, this.p.type === "marker" ? 0.7 : 1.5));
},
/**
@@ -1433,7 +1467,10 @@
*/
isInsideClippingArea() {
if (B.cr) return this.position.x >= B.cr[0] && this.position.x <= B.cr[2] && this.position.y >= B.cr[1] && this.position.y <= B.cr[3];
- else return true;
+ else {
+ let w = 0.55 * _r.width, h = 0.55 * _r.height;
+ return (this.position.x >= -w - Matrix.trans()[0] && this.position.x <= w - Matrix.trans()[0]) && (this.position.y >= -h - Matrix.trans()[1] && this.position.y <= h - Matrix.trans()[1])
+ }
},
/**
@@ -1490,7 +1527,7 @@
drawDefault(pressure) {
let vibration = this.w * this.p.vibration * (this.p.definition + (1-this.p.definition) * randomGaussian() * this.gauss(0.5,0.9,5,0.2,1.2) / pressure);
if (R.random(0, this.p.quality) > 0.4) {
- this.mask.circle(this.position.x + 0.7 * vibration * R.random(-1,1),this.position.y + vibration * R.random(-1,1), pressure * this.p.weight * this.w * R.random(0.85,1.15));
+ this.mask.circle(this.position.x + 0.7 * vibration * R.random(-1,1),this.position.y + vibration * R.random(-1,1), pressure * this.p.weight * R.random(0.85,1.15));
}
},
@@ -1726,16 +1763,16 @@
// Draw the hatching lines using the calculated intersections
// If the 'rand' option is enabled, add randomness to the start and end points of the lines
// If the 'continuous' option is set, connect the end of one line to the start of the next
- let r = options.rand || 0;
+ let r = options.rand ? options.rand : 0;
for (let j = 0; j < gdots.length; j++) {
let dd = gdots[j]
let shouldDrawContinuousLine = j > 0 && options.continuous;
for (let i = 0; i < dd.length-1; i += 2) {
if (r !== 0) {
- dd[i].x += r * dist * R.random(-1, 1);
- dd[i].y += r * dist * R.random(-1, 1);
- dd[i + 1].x += r * dist * R.random(-1, 1);
- dd[i + 1].y += r * dist * R.random(-1, 1);
+ dd[i].x += r * dist * R.random(-10, 10);
+ dd[i].y += r * dist * R.random(-10, 10);
+ dd[i + 1].x += r * dist * R.random(-10, 10);
+ dd[i + 1].y += r * dist * R.random(-10, 10);
}
B.line(dd[i].x, dd[i].y, dd[i + 1].x, dd[i + 1].y);
if (shouldDrawContinuousLine) {
@@ -1772,9 +1809,10 @@
*
* @param {Array} pointsArray - An array of points, where each point is an array of two numbers [x, y].
*/
- constructor (array) {
+ constructor (array , bool = false) {
this.a = array;
this.vertices = array.map(a => ({ x: a[0], y: a[1] }));
+ if (bool) this.vertices = array;
this.sides = this.vertices.map((v, i, arr) => [v, arr[(i + 1) % arr.length]]);
}
/**
@@ -1815,11 +1853,12 @@
/**
* Fills the polygon using the current fill state.
*/
- fill (_color = false, _opacity, _bleed, _texture, _border) {
+ fill (_color = false, _opacity, _bleed, _texture, _border, _direction) {
let curState = F.isActive;
if (_color) {
setFill(_color, _opacity)
- setBleed(_bleed, _texture, _border)
+ setBleed(_bleed, _direction)
+ setTexture(_texture, _border)
}
if (F.isActive) {
_ensureReady();
@@ -2042,6 +2081,7 @@
let vertices = []
let bleed = R.constrain(F.bleed_strength,0.05,1)
let side = (max + min) * (isHatch ? 0.03 : ((F.isAnimated) ? 0.25 : bleed));
+ this.calcIndex(0);
let linepoint = new Position(_x,_y);
let numsteps = Math.round(this.length/_step);
for (let steps = 0; steps < numsteps; steps++) {
@@ -2319,8 +2359,12 @@
* @param {number} _texture - The texture of the watercolor effect, from 0 to 1.
* EXPORTED
*/
- function setBleed(_i, _texture = 0.4, _border = 0.4) {
+ function setBleed(_i, _direction = "out") {
F.bleed_strength = R.constrain(_i,0,0.6);
+ F.direction = _direction
+ }
+
+ function setTexture(_texture = 0.4, _border = 0.4) {
F.texture_strength = R.constrain(_texture, 0, 1);
F.border_strength = R.constrain(_border, 0, 1);
}
@@ -2369,6 +2413,8 @@
* @param {Object} polygon - The polygon to fill.
*/
fill (polygon) {
+ // Store polygon
+ this.polygon = polygon;
// Map polygon vertices to p5.Vector objects
this.v = polygon.a.map(vert => createVector(vert[0], vert[1]));
// Calculate fluidity once, outside the loop
@@ -2382,7 +2428,7 @@
let shift = R.randInt(0, this.v.length);
this.v = [...this.v.slice(shift), ...this.v.slice(0, shift)];
// Create and fill the polygon with the calculated bleed effect
- let pol = new FillPolygon (this.v, this.m, this.calcCenter())
+ let pol = new FillPolygon (this.v, this.m, this.calcCenter(),[],true)
pol.fill(this.color, int(map(this.opacity,0,155,0,20,true)), this.texture_strength)
},
@@ -2415,12 +2461,37 @@
* @param {p5.Vector[]} _v - An array of p5.Vector objects representing the vertices of the polygon.
* @param {number[]} _m - An array of numbers representing the multipliers for the bleed effect at each vertex.
* @param {p5.Vector} _center - A p5.Vector representing the calculated center point of the polygon.
+ * @param {boolean[]} dir - An array of booleans representing the bleed direction.
+ * @param {boolean} isFirst - Boolean = true for initial fill polygon
*/
- constructor (_v,_m,_center) {
+ constructor (_v,_m,_center,dir,isFirst = false) {
+ this.pol = new Polygon(_v, true)
this.v = _v;
+ this.dir = dir;
this.m = _m;
this.midP = _center;
this.size = p5.Vector.sub(this.midP,this.v[0]).mag();
+ // This calculates the bleed direction for the initial shape, for each of the vertices.
+ if (isFirst) {
+ const rotationFactor = (angleMode() === "radians") ? Math.PI / 180 : 1;
+ for (let i = 0; i < this.v.length; i++) {
+ const currentVertex = this.v[i]
+ const nextVertex = this.v[(i + 1) % this.v.length];
+ let side = p5.Vector.sub(nextVertex, currentVertex)
+ let direction1 = side.copy();
+ direction1.rotate(90 * rotationFactor);
+ let linea = {
+ point1 : {x: currentVertex.x + side.x / 2, y: currentVertex.y + side.y / 2},
+ point2 : {x: currentVertex.x + side.x / 2 + direction1.x, y: currentVertex.y + side.y / 2 + direction1.y},
+ }
+ const isLeft = (a, b, c) => {
+ return (b.x - a.x)*(c.y - a.y) - (b.y - a.y)*(c.x - a.x) > 0.01;
+ }
+ let d1 = 0;
+ for (let int of F.polygon.intersect(linea)) {if (isLeft(currentVertex,nextVertex,int)) d1++;}
+ this.dir[i] = (d1 % 2 === 0) ? true : false;
+ }
+ }
}
/**
@@ -2433,6 +2504,7 @@
grow (growthFactor, degrow = false) {
const newVerts = [];
const newMods = [];
+ const newDirs = [];
// Determine the length of vertices to process based on growth factor
let verticesToProcess = (growthFactor >= 0.2 && this.v.length >= 10) ? Math.floor(growthFactor * this.v.length) : this.v.length;
// Function to change the modifier based on a Gaussian distribution
@@ -2456,15 +2528,20 @@
let newVertex = p5.Vector.lerp(currentVertex, nextVertex, constrain(randomGaussian(0.5,0.2),0.1,0.9));
let side = p5.Vector.sub(nextVertex, currentVertex)
let direction = side.copy().normalize();
- let rotationDegrees = -90 + (randomGaussian(0,0.4)) * 45;
+ // Make sure that we always bleed in the selected direction
+ let dir = this.dir[i];
+ let bleed = (F.direction == "out") ? 90 : -90;
+ let rotationDegrees = ((dir) ? bleed : -bleed) + (randomGaussian(0,0.4)) * 45;
+
direction.rotate(rotationDegrees * rotationFactor);
direction.mult(randomGaussian(0.5, 0.2) * random(0.6, 1.4) * side.mag() * mod);
newVertex.add(direction);
// Add the new vertex and its modifier
newVerts.push(newVertex);
newMods.push(changeModifier(mod));
+ newDirs.push(dir,dir)
}
- return new FillPolygon (newVerts, newMods, this.midP);
+ return new FillPolygon (newVerts, newMods, this.midP, newDirs);
}
/**
@@ -2490,6 +2567,7 @@
Mix.mask.noStroke();
Mix.mask.translate(Matrix.translation[0] + _r.width/2, Matrix.translation[1] + _r.height/2);
Mix.mask.rotate(Matrix.rotation)
+ Mix.mask.scale(Scale.current)
let pol = this.grow()
let pol2 = pol.grow().grow(0.9);
@@ -2635,16 +2713,20 @@
* and geometrical shapes drawing.
*/
- // General Functions
+ // Config Functions
exports.config = configureSystem; // Configures and seeds the RNG (Random Number Generator).
exports.load = loadSystem; // Loads the library into the selected buffer.
exports.preload = preloadBrushAssets; // Preloads custom tips for the library.
exports.colorCache = enableCacheBlending; // Enables/disables cache color blending for improved performance
- exports.reDraw = Mix.reDraw;
- exports.reBlend = Mix.reBlend;
+ exports.scaleBrushes = globalScale; // Rescales all standard brushes.
+
+ // Utility Functions
exports.push = _push;
exports.pop = _pop;
+ exports.reDraw = Mix.reDraw;
+ exports.reBlend = Mix.reBlend;
exports.rotate = Matrix.rotate;
+ exports.scale = Scale.update;
// FLOWFIELD Management
exports.addField = addField; // Adds a new vector field.
@@ -2654,7 +2736,6 @@
exports.listFields = listFields; // Lists all the available fields.
// BRUSH Management
- exports.scale = globalScale; // Rescales all standard brushes.
exports.add = B.add; // Adds a new brush definition.
exports.box = listOfBrushes; // Retrieves an array with existing brushes.
exports.set = B.set; // Sets values for all properties of a brush.
@@ -2671,7 +2752,8 @@
// FILL Operations (affects rect, circle, and beginShape)
exports.fill = setFill; // Sets the fill color.
exports.bleed = setBleed; // Sets the bleed property for fills.
- exports.noFill = disableFill; // Disables the fill.
+ exports.fillTexture = setTexture; // Sets the fill texture.
+ exports.noFill = disableFill; // Disables the fill.
exports.fillAnimatedMode = fillAnimatedMode;
// GEOMETRY Drawing Functions
@@ -2701,5 +2783,4 @@
exports.Polygon = Polygon; // The Polygon class, used for creating and manipulating polygons.
exports.Plot = Plot; // The Plot class, for plotting curves.
exports.Position = Position; // The Position class, for managing positions on the canvas.
-
})));
\ No newline at end of file
diff --git a/p5.brush.min.js b/p5.brush.min.js
index c2d4303..ba51a4a 100644
--- a/p5.brush.min.js
+++ b/p5.brush.min.js
@@ -1,2 +1,2 @@
-/*! p5.brush.js v1.0.3 2023 - by Alejandro Campos - MIT License */
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).brush={})}(this,(function(t){"use strict";let e,i=!1;function s(t=!1){i=!0,e=t||window.self,m.load(),f.create(),g(e.width/250)}function r(){i||s()}p5.prototype.registerMethod("afterSetup",(()=>r()));const o={source:()=>random(),random(t=0,e=1){return 1===arguments.length?this.map(this.source(),0,1,0,t):this.map(this.source(),0,1,t,e)},randInt(t,e){return Math.floor(this.random(t,e))},weightedRand(t){let e,i,s=[];for(e in t)for(i=0;i<10*t[e];i++)s.push(e);return s[Math.floor(this.source()*s.length)]},map(t,e,i,s,r,o=!1){let n=s+(t-e)/(i-e)*(r-s);return o?s<r?this.constrain(n,s,r):this.constrain(n,r,s):n},constrain:(t,e,i)=>Math.max(Math.min(t,i),e),cos(t){return this.c[Math.floor((t%360+360)%360*4)]},sin(t){return this.s[Math.floor((t%360+360)%360*4)]},isPrecalculationDone:!1,preCalculation(){if(this.isPrecalculationDone)return;const t=1440,e=2*Math.PI/t;this.c=new Float64Array(t),this.s=new Float64Array(t);for(let i=0;i<t;i++){const t=i*e;o.c[i]=Math.cos(t),o.s[i]=Math.sin(t)}this.isPrecalculationDone=!0},toDegrees:t=>(("radians"===angleMode()?180*t/Math.PI:t)%360+360)%360};o.preCalculation();const n={translation:[0,0],rotation:0,rotate(t){n.rotation=o.toDegrees(t)},trans(){return this.translation=[e._renderer.uMVMatrix.mat4[12],e._renderer.uMVMatrix.mat4[13]],this.translation}};function a(t,e,i,s,r=!1){let o=t.x,n=t.y,a=e.x,h=e.y,l=i.x,c=i.y,d=s.x,m=s.y;if(o===a&&n===h||l===d&&c===m)return!1;let p=a-o,f=h-n,u=d-l,g=m-c,v=g*p-u*f;if(0===v)return!1;let x=(u*(n-c)-g*(o-l))/v,w=(p*(n-c)-f*(o-l))/v;return!(!r&&(w<0||w>1))&&{x:o+x*p,y:n+x*f}}function h(t,e,i,s){return(Math.atan2(-(s-e),i-t)*(180/Math.PI)%360+360)%360}const l={field:{},stroke:{},hatch:{},fill:{},others:{}};function c(){l.field.isActive=f.isActive,l.field.current=f.current,l.stroke.isActive=x.isActive,l.stroke.brush=x.name,l.stroke.color=x.c,l.stroke.weight=x.w,l.stroke.globalScale=v,l.stroke.clip=x.cr,l.hatch.isActive=_.isActive,l.hatch.hatchingParams=_.hatchingParams,l.hatch.hatchingBrush=_.hatchingBrush,l.fill.isActive=D.isActive,l.fill.color=D.color,l.fill.opacity=D.opacity,l.fill.bleed_strength=D.bleed_strength,l.fill.texture_strength=D.texture_strength,l.fill.border_strength=D.border_strength,l.others.rotate=n.rotation}function d(){f.isActive=l.field.isActive,f.current=l.field.current,x.isActive=l.stroke.isActive,x.name=l.stroke.brush,x.c=l.stroke.color,x.w=l.stroke.weight,v=l.stroke.globalScale,x.cr=l.stroke.clip,_.isActive=l.hatch.isActive,_.hatchingParams=l.hatch.hatchingParams,_.hatchingBrush=l.hatch.hatchingBrush,D.isActive=l.fill.isActive,D.color=l.fill.color,D.opacity=l.fill.opacity,D.bleed_strength=l.fill.bleed_strength,D.texture_strength=l.fill.texture_strength,D.border_strength=l.fill.border_strength,n.rotation=l.others.rotate}const m={loaded:!1,isBlending:!1,isCaching:!0,currentColor:new Float32Array(3),load(){this.mask=createGraphics(e.width,e.height),this.mask.pixelDensity(e.pixelDensity()),this.mask.clear(),this.mask.noSmooth(),this.mask.angleMode(DEGREES),t.mask=this.mask,m.loaded||(this.frag=this.frag.replace('#include "spectral.glsl"',this.glsl())),this.shader=e.createShader(this.vert,this.frag),m.loaded=!0,this.noBlend=createGraphics(e.width,e.height),this.noBlend.pixelDensity(e.pixelDensity()),this.noBlend.noSmooth(),this.noBlend.clear(),this.noBlend.angleMode(DEGREES),this.mask2=createGraphics(e.width,e.height,WEBGL),this.mask2.pixelDensity(e.pixelDensity()),this.mask2.clear(),this.mask2.angleMode(DEGREES)},getPigment(t){let e=t.levels,i=new Float32Array(3);return i[0]=e[0]/255,i[1]=e[1]/255,i[2]=e[2]/255,i},reDraw(){e.push(),e.translate(-n.trans()[0],-n.trans()[1]),e.image(m.noBlend,-e.width/2,-e.height/2),m.noBlend.clear(),e.pop()},reBlend(){c(),x.set("marker","white",1),x.line(-10,-10,-5,-5),d()},color1:new Float32Array(3),color2:new Float32Array(3),blending1:!1,blending2:!1,blend(t=!1,i=!1,s=!1,r=!1){if(this.isBlending=s?this.blending1:this.blending2,this.currentColor=s?this.color1:this.color2,!this.isBlending){if(!t)return e.push(),e.translate(-n.trans()[0],-n.trans()[1]),e.image(this.noBlend,-e.width/2,-e.height/2),this.noBlend.clear(),void e.pop();this.currentColor=this.getPigment(t),s?(this.blending1=!0,this.color1=this.currentColor):(this.blending2=!0,this.color2=this.currentColor)}if((t?this.getPigment(t):this.currentColor).toString()!==this.currentColor.toString()||i||!this.isCaching){e.push(),e.translate(-n.trans()[0],-n.trans()[1]),e.image(this.noBlend,-e.width/2,-e.height/2),this.noBlend.clear(),e.shader(this.shader),this.shader.setUniform("addColor",this.currentColor),this.shader.setUniform("source",e._renderer),this.shader.setUniform("active",r),this.shader.setUniform("random",[o.random(),o.random(),o.random()]);let a=s?this.mask2:this.mask;this.shader.setUniform("mask",a),e.fill(0,0,0,0),e.noStroke(),e.rect(-e.width/2,-e.height/2,e.width,e.height),e.pop(),a.clear(),i||(this.currentColor=this.getPigment(t),s?this.color1=this.currentColor:this.color2=this.currentColor)}i&&(this.isBlending=!1,s?this.blending1=this.isBlending:this.blending2=this.isBlending)},vert:"precision highp float;attribute vec3 aPosition;attribute vec2 aTexCoord;uniform mat4 uModelViewMatrix,uProjectionMatrix;varying vec2 vVertTexCoord;void main(){gl_Position=uProjectionMatrix*uModelViewMatrix*vec4(aPosition,1);vVertTexCoord=aTexCoord;}",frag:'precision highp float;varying vec2 vVertTexCoord;uniform sampler2D source,mask;uniform vec4 addColor;uniform vec3 random;uniform bool active;\n #include "spectral.glsl"\n float v(vec2 v,vec2 x,float y,out vec2 i){vec2 a=vec2(v.x+v.y*.5,v.y),m=floor(a),d=fract(a);float z=step(d.y,d.x);vec2 r=vec2(z,1.-z),f=m+r,e=m+1.,s=vec2(m.x-m.y*.5,m.y),k=vec2(s.x+r.x-r.y*.5,s.y+r.y),l=vec2(s.x+.5,s.y+1.),g=v-s,o=v-k,t=v-l;vec3 u,c,C,D;if(any(greaterThan(x,vec2(0)))){C=vec3(s.x,k.x,l);D=vec3(s.y,k.y,l.y);if(x.x>0.)C=mod(vec3(s.x,k.x,l),x.x);if(x.y>0.)D=mod(vec3(s.y,k.y,l.y),x.y);u=floor(C+.5*D+.5);c=floor(D+.5);}else u=vec3(m.x,f.x,e),c=vec3(m.y,f.y,e.y);vec3 b=mod(u,289.);b=mod((b*51.+2.)*b+c,289.);b=mod((b*34.+10.)*b,289.);vec3 h=b*.07482+y,E=cos(h),w=sin(h);vec2 A=vec2(E.x,w),B=vec2(E.y,w.y),F=vec2(E.z,w.z);vec3 G=.8-vec3(dot(g,g),dot(o,o),dot(t,t));G=max(G,0.);vec3 H=G*G,I=H*H,J=vec3(dot(A,g),dot(B,o),dot(F,t)),K=H*G,L=-8.*K*J;i=10.9*(I.x*A+L.x*g+(I.y*B+L.y*o)+(I.z*F+L.z*t));return 10.9*dot(I,J);}vec4 v(vec3 v,float f){return vec4(mix(v,vec3(dot(vec3(.299,.587,.114),v)),f),1);}float f(vec2 v,float x,float y,float f){return fract(sin(dot(v,vec2(x,y)))*f);}void main(){vec4 s=texture2D(mask,vVertTexCoord);if(s.x>0.){vec2 m=vec2(12.9898,78.233),k=vec2(7.9898,58.233),d=vec2(17.9898,3.233);float x=f(vVertTexCoord,m.x,m.y,43358.5453)*2.-1.,y=f(vVertTexCoord,k.x,k.y,43213.5453)*2.-1.,l=f(vVertTexCoord,d.x,d.y,33358.5453)*2.-1.;const vec2 z=vec2(0);vec2 o;vec4 b;if(active){float a=v(vVertTexCoord*10.,z,10.*random.x,o),c=v(vVertTexCoord*10.,z,10.*random.y,o),t=v(vVertTexCoord*10.,z,10.*random.z,o),w=.25+.25*v(vVertTexCoord*8.,z,3.*random.x,o);b=vec4(v(addColor.xyz,w).xyz+vec3(a,c,t)*.03,1);}else b=vec4(addColor.xyz,1);if(s.w>.7){float r=.5*(s.w-.7);b=b*(1.-r)-vec4(.5)*r;}vec3 a=spectral_mix(texture2D(source,vVertTexCoord).xyz,b.xyz,.9*s.w);gl_FragColor=vec4(a+.01*vec3(x,y,l),1);}}',glsl:()=>"float spectral_uncompand(float s){return s<.04045?s/12.92:pow((s+.055)/1.055,2.4);}float spectral_compand(float s){return s<.0031308?s*12.92:1.055*pow(s,1./2.4)-.055;}vec3 spectral_srgb_to_linear(vec3 s){return vec3(spectral_uncompand(s[0]),spectral_uncompand(s[1]),spectral_uncompand(s[2]));}vec3 spectral_linear_to_srgb(vec3 s){return clamp(vec3(spectral_compand(s[0]),spectral_compand(s[1]),spectral_compand(s[2])),0.,1.);}void spectral_upsampling(vec3 e,out float m,out float s,out float f,out float r,out float x,out float v,out float z){m=min(e.x,min(e.y,e.z));e-=m;s=min(e.y,e.z);f=min(e.x,e.z);r=min(e.x,e.y);x=min(max(0.,e.x-e.z),max(0.,e.x-e.y));v=min(max(0.,e.y-e.z),max(0.,e.y-e.x));z=min(max(0.,e.z-e.y),max(0.,e.z-e.x));}void spectral_linear_to_reflectance(vec3 s,inout float f[38]){float e,o,m,x,v,w,z;spectral_upsampling(s,e,o,m,x,v,w,z);f[0]=max(1e-4,e+o*.96853629+m*.51567122+x*.02055257+v*.03147571+w*.49108579+z*.97901834);f[1]=max(1e-4,e+o*.96855103+m*.5401552+x*.02059936+v*.03146636+w*.46944057+z*.97901649);f[2]=max(1e-4,e+o*.96859338+m*.62645502+x*.02062723+v*.03140624+w*.4016578+z*.97901118);f[3]=max(1e-4,e+o*.96877345+m*.75595012+x*.02073387+v*.03119611+w*.2449042+z*.97892146);f[4]=max(1e-4,e+o*.96942204+m*.92826996+x*.02114202+v*.03053888+w*.0682688+z*.97858555);f[5]=max(1e-4,e+o*.97143709+m*.97223624+x*.02233154+v*.02856855+w*.02732883+z*.97743705);f[6]=max(1e-4,e+o*.97541862+m*.98616174+x*.02556857+v*.02459485+w*.013606+z*.97428075);f[7]=max(1e-4,e+o*.98074186+m*.98955255+x*.03330189+v*.0192952+w*.01000187+z*.96663223);f[8]=max(1e-4,e+o*.98580992+m*.98676237+x*.05185294+v*.01423112+w*.01284127+z*.94822893);f[9]=max(1e-4,e+o*.98971194+m*.97312575+x*.10087639+v*.01033111+w*.02636635+z*.89937713);f[10]=max(1e-4,e+o*.99238027+m*.91944277+x*.24000413+v*.00765876+w*.07058713+z*.76070164);f[11]=max(1e-4,e+o*.99409844+m*.32564851+x*.53589066+v*.00593693+w*.70421692+z*.4642044);f[12]=max(1e-4,e+o*.995172+m*.13820628+x*.79874659+v*.00485616+w*.85473994+z*.20123039);f[13]=max(1e-4,e+o*.99576545+m*.05015143+x*.91186529+v*.00426186+w*.95081565+z*.08808402);f[14]=max(1e-4,e+o*.99593552+m*.02912336+x*.95399623+v*.00409039+w*.9717037+z*.04592894);f[15]=max(1e-4,e+o*.99564041+m*.02421691+x*.97137099+v*.00438375+w*.97651888+z*.02860373);f[16]=max(1e-4,e+o*.99464769+m*.02660696+x*.97939505+v*.00537525+w*.97429245+z*.02060067);f[17]=max(1e-4,e+o*.99229579+m*.03407586+x*.98345207+v*.00772962+w*.97012917+z*.01656701);f[18]=max(1e-4,e+o*.98638762+m*.04835936+x*.98553736+v*.0136612+w*.9425863+z*.01451549);f[19]=max(1e-4,e+o*.96829712+m*.0001172+x*.98648905+v*.03181352+w*.99989207+z*.01357964);f[20]=max(1e-4,e+o*.89228016+m*8.554e-5+x*.98674535+v*.10791525+w*.99989891+z*.01331243);f[21]=max(1e-4,e+o*.53740239+m*.85267882+x*.98657555+v*.46249516+w*.13823139+z*.01347661);f[22]=max(1e-4,e+o*.15360445+m*.93188793+x*.98611877+v*.84604333+w*.06968113+z*.01387181);f[23]=max(1e-4,e+o*.05705719+m*.94810268+x*.98559942+v*.94275572+w*.05628787+z*.01435472);f[24]=max(1e-4,e+o*.03126539+m*.94200977+x*.98507063+v*.96860996+w*.06111561+z*.01479836);f[25]=max(1e-4,e+o*.02205445+m*.91478045+x*.98460039+v*.97783966+w*.08987709+z*.0151525);f[26]=max(1e-4,e+o*.01802271+m*.87065445+x*.98425301+v*.98187757+w*.13656016+z*.01540513);f[27]=max(1e-4,e+o*.0161346+m*.78827548+x*.98403909+v*.98377315+w*.22169624+z*.01557233);f[28]=max(1e-4,e+o*.01520947+m*.65738359+x*.98388535+v*.98470202+w*.32176956+z*.0156571);f[29]=max(1e-4,e+o*.01475977+m*.59909403+x*.98376116+v*.98515481+w*.36157329+z*.01571025);f[30]=max(1e-4,e+o*.01454263+m*.56817268+x*.98368246+v*.98537114+w*.4836192+z*.01571916);f[31]=max(1e-4,e+o*.01444459+m*.54031997+x*.98365023+v*.98546685+w*.46488579+z*.01572133);f[32]=max(1e-4,e+o*.01439897+m*.52110241+x*.98361309+v*.98550011+w*.47440306+z*.01572502);f[33]=max(1e-4,e+o*.0143762+m*.51041094+x*.98357259+v*.98551031+w*.4857699+z*.01571717);f[34]=max(1e-4,e+o*.01436343+m*.50526577+x*.98353856+v*.98550741+w*.49267971+z*.01571905);f[35]=max(1e-4,e+o*.01435687+m*.5025508+x*.98351247+v*.98551323+w*.49625685+z*.01571059);f[36]=max(1e-4,e+o*.0143537+m*.50126452+x*.98350101+v*.98551563+w*.49807754+z*.01569728);f[37]=max(1e-4,e+o*.01435408+m*.50083021+x*.98350852+v*.98551547+w*.49889859+z*.0157002);}vec3 spectral_xyz_to_srgb(vec3 e){mat3 f;f[0]=vec3(3.24306333,-1.53837619,-.49893282);f[1]=vec3(-.96896309,1.87542451,.04154303);f[2]=vec3(.05568392,-.20417438,1.05799454);float s=dot(f[0],e),m=dot(f[1],e),z=dot(f[2],e);return spectral_linear_to_srgb(vec3(s,m,z));}vec3 spectral_reflectance_to_xyz(float f[38]){vec3 e=vec3(0);e+=f[0]*vec3(6.469e-5,1.84e-6,.00030502);e+=f[1]*vec3(.00021941,6.21e-6,.00103681);e+=f[2]*vec3(.00112057,3.101e-5,.00531314);e+=f[3]*vec3(.00376661,.00010475,.01795439);e+=f[4]*vec3(.01188055,.00035364,.05707758);e+=f[5]*vec3(.02328644,.00095147,.11365162);e+=f[6]*vec3(.03455942,.00228226,.17335873);e+=f[7]*vec3(.03722379,.00420733,.19620658);e+=f[8]*vec3(.03241838,.0066888,.18608237);e+=f[9]*vec3(.02123321,.0098884,.13995048);e+=f[10]*vec3(.01049099,.01524945,.08917453);e+=f[11]*vec3(.00329584,.02141831,.04789621);e+=f[12]*vec3(.00050704,.03342293,.02814563);e+=f[13]*vec3(.00094867,.05131001,.01613766);e+=f[14]*vec3(.00627372,.07040208,.0077591);e+=f[15]*vec3(.01686462,.08783871,.00429615);e+=f[16]*vec3(.02868965,.09424905,.00200551);e+=f[17]*vec3(.04267481,.09795667,.00086147);e+=f[18]*vec3(.05625475,.09415219,.00036904);e+=f[19]*vec3(.0694704,.08678102,.00019143);e+=f[20]*vec3(.08305315,.07885653,.00014956);e+=f[21]*vec3(.0861261,.0635267,9.231e-5);e+=f[22]*vec3(.09046614,.05374142,6.813e-5);e+=f[23]*vec3(.08500387,.04264606,2.883e-5);e+=f[24]*vec3(.07090667,.03161735,1.577e-5);e+=f[25]*vec3(.05062889,.02088521,3.94e-6);e+=f[26]*vec3(.03547396,.01386011,1.58e-6);e+=f[27]*vec3(.02146821,.00810264,0);e+=f[28]*vec3(.01251646,.0046301,0);e+=f[29]*vec3(.00680458,.00249138,0);e+=f[30]*vec3(.00346457,.0012593,0);e+=f[31]*vec3(.00149761,.00054165,0);e+=f[32]*vec3(.0007697,.00027795,0);e+=f[33]*vec3(.00040737,.00014711,0);e+=f[34]*vec3(.00016901,6.103e-5,0);e+=f[35]*vec3(9.522e-5,3.439e-5,0);e+=f[36]*vec3(4.903e-5,1.771e-5,0);e+=f[37]*vec3(2e-5,7.22e-6,0);return e;}float spectral_linear_to_concentration(float v,float m,float s){float z=m*pow(s,2.);return z/(v*pow(1.-s,2.)+z);}vec3 spectral_mix(vec3 s,vec3 f,float e){vec3 v=spectral_srgb_to_linear(s),m=spectral_srgb_to_linear(f);float z[38],o[38];spectral_linear_to_reflectance(v,z);spectral_linear_to_reflectance(m,o);float x=spectral_reflectance_to_xyz(z)[1],w=spectral_reflectance_to_xyz(o)[1];e=spectral_linear_to_concentration(x,w,e);float r[38];for(int c=0;c<38;c++){float y=(1.-e)*(pow(1.-z[c],2.)/(2.*z[c]))+e*(pow(1.-o[c],2.)/(2.*o[c]));r[c]=1.+y-sqrt(pow(y,2.)+2.*y);}return spectral_xyz_to_srgb(spectral_reflectance_to_xyz(r));}vec4 spectral_mix(vec4 s,vec4 e,float z){return vec4(spectral_mix(s.xyz,e.xyz,z),mix(s.w,e.w,z));}"};function p(t,e){r(),f.list.set(t,{gen:e}),f.current=t,f.refresh()}p5.prototype.registerMethod("afterSetup",(()=>m.blend(!1,!0))),p5.prototype.registerMethod("afterSetup",(()=>m.blend(!1,!0,!0))),p5.prototype.registerMethod("post",(()=>m.blend(!1,!0))),p5.prototype.registerMethod("post",(()=>m.blend(!1,!0,!0)));const f={isActive:!1,list:new Map,current:"",step_length:()=>Math.min(e.width,e.height)/1e3,create(){this.R=.01*e.width,this.left_x=-1*e.width,this.top_y=-1*e.height,this.num_columns=Math.round(2*e.width/this.R),this.num_rows=Math.round(2*e.height/this.R),this.addStandard()},flow_field(){return this.list.get(this.current).field},refresh(t=0){this.list.get(this.current).field=this.list.get(this.current).gen(t,this.genField())},genField(){let t=new Array(this.num_columns);for(let e=0;e<this.num_columns;e++)t[e]=new Float64Array(this.num_rows);return t},addStandard(){p("curved",(function(t,e){let i=o.randInt(-25,-15);o.randInt(0,100)%2==0&&(i*=-1);for(let s=0;s<f.num_columns;s++)for(let r=0;r<f.num_rows;r++){let n=noise(.02*s+.03*t,.02*r+.03*t),a=o.map(n,0,1,-i,i);e[s][r]=3*a}return e})),p("truncated",(function(t,e){let i=o.randInt(-25,-15)+5*o.sin(t);o.randInt(0,100)%2==0&&(i*=-1);let s=o.randInt(5,10);for(let t=0;t<f.num_columns;t++)for(let r=0;r<f.num_rows;r++){let n=noise(.02*t,.02*r),a=Math.round(o.map(n,0,1,-i,i)/s)*s;e[t][r]=4*a}return e})),p("zigzag",(function(t,e){let i=o.randInt(-30,-15)+Math.abs(44*o.sin(t));o.randInt(0,100)%2==0&&(i*=-1);let s=i,r=0;for(let t=0;t<f.num_columns;t++){for(let i=0;i<f.num_rows;i++)e[t][i]=r,r+=s,s*=-1;r+=s,s*=-1}return e})),p("waves",(function(t,e){let i=o.randInt(10,15)+5*o.sin(t),s=o.randInt(3,6)+3*o.cos(t),r=o.randInt(20,35);for(let t=0;t<f.num_columns;t++)for(let n=0;n<f.num_rows;n++){let a=o.sin(i*t)*(r*o.cos(n*s))+o.randInt(-3,3);e[t][n]=a}return e})),p("seabed",(function(t,e){let i=o.random(.4,.8),s=o.randInt(18,26);for(let r=0;r<f.num_columns;r++)for(let n=0;n<f.num_rows;n++){let a=o.randInt(15,20),h=s*o.sin(i*n*r+a);e[r][n]=1.1*h*o.cos(t)}return e}))}};class u{constructor(t,e){this.update(t,e),this.plotted=0}update(t,e){this.x=t,this.y=e,f.isActive&&(this.x_offset=this.x-f.left_x+n.trans()[0],this.y_offset=this.y-f.top_y+n.trans()[1],this.column_index=Math.round(this.x_offset/f.R),this.row_index=Math.round(this.y_offset/f.R))}reset(){this.plotted=0}isIn(){return f.isActive?this.column_index>=0&&this.row_index>=0&&this.column_index<f.num_columns&&this.row_index<f.num_rows:this.isInCanvas()}isInCanvas(){let t=.55*e.width,i=.55*e.height;return this.x>=-t-n.trans()[0]&&this.x<=t-n.trans()[0]&&this.y>=-i-n.trans()[1]&&this.y<=i-n.trans()[1]}angle(){return this.isIn()&&f.isActive?f.flow_field()[this.column_index][this.row_index]:0}moveTo(t,e,i=f.step_length(),s=!0){if(this.isIn()){let r,n;s||(r=o.cos(-e),n=o.sin(-e));for(let a=0;a<t/i;a++){if(s){let t=this.angle();r=o.cos(t-e),n=o.sin(t-e)}let t=i*r,a=i*n;this.plotted+=i,this.update(this.x+t,this.y+a)}}else this.plotted+=i}plotTo(t,e,i,s){if(this.isIn()){const r=1/s;for(let s=0;s<e/i;s++){let e=this.angle(),s=t.angle(this.plotted),n=i*o.cos(e-s),a=i*o.sin(e-s);this.plotted+=i*r,this.update(this.x+n,this.y+a)}}else this.plotted+=i/scale}}function g(t){for(let e of E){let i=x.list.get(e[0]).param;i.weight*=t,i.vibration*=t,i.spacing*=t}v=t}let v=1;const x={isActive:!0,list:new Map,c:"#000000",w:1,cr:null,name:"HB",add:(t,e)=>{const i="marker"===e.type||"custom"===e.type||"image"===e.type;"image"===e.type&&(w.add(e.image.src),e.tip=()=>x.mask.image(w.tips.get(x.p.image.src),-x.p.weight/2,-x.p.weight/2,x.p.weight,x.p.weight)),e.blend=!!(i&&!1!==e.blend||e.blend),x.list.set(t,{param:e,colors:[],buffers:[]})},set(t,e,i=1){x.name=t,x.c=e,x.w=i,x.isActive=!0},setBrush(t){x.name=t},setColor(t,e,i){arguments.length>0&&(x.c=arguments.length<2?t:[t,e,i]),x.isActive=!0},setWeight(t){x.w=t},clip(t){x.cr=t},noClip(){x.cr=null},line(t,e,i,s){r();let o=dist(t,e,i,s);if(0==o)return;x.initializeDrawingState(t,e,o,!1,!1);let n=h(t,e,i,s);x.draw(n,!1)},flowLine(t,e,i,s){r(),x.initializeDrawingState(t,e,i,!0,!1),x.draw(o.toDegrees(s),!1)},flowShape(t,e,i,s){r(),x.initializeDrawingState(e,i,t.length,!0,t),x.draw(s,!0)},spacing(){return this.p=this.list.get(this.name).param,this.p.spacing*this.w},initializeDrawingState(t,e,i,s,r){this.position=new u(t,e),this.length=i,this.flow=s,this.plot=r,r&&r.calcIndex(0)},draw(t,e){e||(this.dir=t),this.pushState();const i=this.spacing(),s=e?Math.round(this.length*t/i):Math.round(this.length/i);for(let r=0;r<s;r++)this.tip(),e?this.position.plotTo(this.plot,i,i,t):this.position.moveTo(i,t,i,this.flow);this.popState()},drawTip(t){this.pushState(!0),this.tip(t),this.popState(!0)},pushState(t=!1){if(this.p=this.list.get(this.name).param,!t){this.a="custom"!==this.p.pressure.type?o.random(-1,1):0,this.b="custom"!==this.p.pressure.type?o.random(1,1.5):0,this.cp="custom"!==this.p.pressure.type?o.random(3,3.5):o.random(-.2,.2);const[t,e]=this.p.pressure.min_max;this.min=t,this.max=e}this.c=e.color(this.c),this.mask=this.p.blend?"image"===this.p.type?m.mask2:m.mask:m.noBlend,n.trans(),this.mask.push(),this.mask.noStroke(),"image"===this.p.type?this.mask.translate(n.translation[0],n.translation[1]):this.mask.translate(n.translation[0]+e.width/2,n.translation[1]+e.height/2),this.mask.rotate(-n.rotation),this.p.blend&&("image"!==this.p.type?m.blend(this.c):m.blend(this.c,!1,!0),t||this.markerTip())},popState(t=!1){this.p.blend&&!t&&this.markerTip(),this.mask.pop()},tip(t=!1){let e=t||this.calculatePressure(),i=this.calculateAlpha(e);if(this.applyColor(i),this.isInsideClippingArea())switch(this.p.type){case"spray":this.drawSpray(e);break;case"marker":this.drawMarker(e);break;case"custom":case"image":this.drawCustomOrImage(e,i);break;default:this.drawDefault(e)}},calculatePressure(){return this.plot?this.simPressure()*this.plot.pressure(this.position.plotted):this.simPressure()},simPressure(){return"custom"===this.p.pressure.type?o.map(this.p.pressure.curve(this.position.plotted/this.length)+this.cp,0,1,this.min,this.max,!0):this.gauss()},gauss(t=.5+x.p.pressure.curve[0]*x.a,e=1-x.p.pressure.curve[1]*x.b,i=x.cp,s=x.min,r=x.max){return o.map(1/(1+Math.pow(Math.abs((this.position.plotted-t*this.length)/(e*this.length/2)),2*i)),0,1,s,r)},calculateAlpha(t){return Math.floor(this.p.opacity*Math.pow(t,"marker"===this.p.type?.7:1.5))},applyColor(t){this.p.blend?this.mask.fill(255,0,0,t/2):(this.c.setAlpha(t),this.mask.fill(this.c))},isInsideClippingArea(){return!x.cr||this.position.x>=x.cr[0]&&this.position.x<=x.cr[2]&&this.position.y>=x.cr[1]&&this.position.y<=x.cr[3]},drawSpray(t){let e=this.w*this.p.vibration*t+this.w*randomGaussian()*this.p.vibration/3,i=this.p.weight*o.random(.9,1.1);const s=this.p.quality/t;for(let t=0;t<s;t++){let t=o.random(.9,1.1),s=t*e*o.random(-1,1),r=o.random(-1,1),n=Math.pow(t*e,2),a=Math.sqrt(n-Math.pow(s,2));this.mask.circle(this.position.x+s,this.position.y+r*a,i)}},drawMarker(t,e=!0){let i=e?this.w*this.p.vibration:0,s=e?i*o.random(-1,1):0,r=e?i*o.random(-1,1):0;this.mask.circle(this.position.x+s,this.position.y+r,this.w*this.p.weight*t)},drawCustomOrImage(t,e,i=!0){this.mask.push();let s=i?this.w*this.p.vibration:0,r=i?s*o.random(-1,1):0,n=i?s*o.random(-1,1):0;this.mask.translate(this.position.x+r,this.position.y+n),this.adjustSizeAndRotation(this.w*t,e),this.p.tip(),this.mask.pop()},drawDefault(t){let e=this.w*this.p.vibration*(this.p.definition+(1-this.p.definition)*randomGaussian()*this.gauss(.5,.9,5,.2,1.2)/t);o.random(0,this.p.quality)>.4&&this.mask.circle(this.position.x+.7*e*o.random(-1,1),this.position.y+e*o.random(-1,1),t*this.p.weight*this.w*o.random(.85,1.15))},adjustSizeAndRotation(t,e){if(this.mask.scale(t),"image"===this.p.type&&(this.p.blend?this.mask.tint(255,0,0,e/2):this.mask.tint(this.mask.red(this.c),this.mask.green(this.c),this.mask.blue(this.c),e)),"random"===this.p.rotate)this.mask.rotate(o.randInt(0,360));else if("natural"===this.p.rotate){let t=(this.plot?-this.plot.angle(this.position.plotted):-this.dir)+(this.flow?this.position.angle():0);t=this.plot?-this.plot.angle(this.position.plotted):-this.dir,this.mask.rotate(t)}},markerTip(){if(this.isInsideClippingArea()){let t=this.calculatePressure(),e=this.calculateAlpha(t);if(this.mask.fill(255,0,0,e/1.5),"marker"===x.p.type)for(let e=1;e<5;e++)this.drawMarker(t*e/5,!1);else if("custom"===x.p.type||"image"===x.p.type)for(let i=1;i<5;i++)this.drawCustomOrImage(t*i/5,e,!1)}}};const w={tips:new Map,add(t){this.tips.set(t,!1)},imageToWhite(t){t.loadPixels();for(let e=0;e<4*t.width*t.height;e+=4){let i=(t.pixels[e]+t.pixels[e+1]+t.pixels[e+2])/3;t.pixels[e]=t.pixels[e+1]=t.pixels[e+2]=255,t.pixels[e+3]=255-i}t.updatePixels()},load(){if(0===this.tips.size)return console.log("There are no custom tips to load !");for(let t of this.tips.keys()){let e=loadImage(t,(()=>w.imageToWhite(e)));this.tips.set(t,e)}}};function y(t=5,e=45,i={rand:!1,continuous:!1,gradient:!1}){_.isActive=!0,_.hatchingParams=[t,e,i]}const _={isActive:!1,hatchingParams:[5,45,{}],hatchingBrush:!1,hatch(t){let e=_.hatchingParams[0],i=_.hatchingParams[1],s=_.hatchingParams[2],r=x.c,n=x.name,a=x.w,h=x.isActive;_.hatchingBrush&&x.set(_.hatchingBrush[0],_.hatchingBrush[1],_.hatchingBrush[2]),i=o.toDegrees(i)%180;let l=1/0,c=-1/0,d=1/0,m=-1/0,p=t=>{for(let e of t.a)l=e[0]<l?e[0]:l,c=e[0]>c?e[0]:c,d=e[1]<d?e[1]:d,m=e[1]>m?e[1]:m};Array.isArray(t)||(t=[t]);for(let e of t)p(e);let f=new k([[l,d],[c,d],[c,m],[l,m]]),u=i<=90&&i>=0?d:m,g=s.gradient?map(s.gradient,0,1,1,1.1,!0):1,v=[],w=0,y=e,b=t=>({point1:{x:l+y*t*o.cos(90-i),y:u+y*t*o.sin(90-i)},point2:{x:l+y*t*o.cos(90-i)+o.cos(-i),y:u+y*t*o.sin(90-i)+o.sin(-i)}});for(;f.intersect(b(w)).length>0;){let e=[];for(let i of t)e.push(i.intersect(b(w)));v[w]=e.flat().sort(((t,e)=>t.x===e.x?t.y-e.y:t.x-e.x)),y*=g,w++}let z=[];for(let t of v)void 0!==t[0]&&z.push(t);let A=s.rand||0;for(let t=0;t<z.length;t++){let i=z[t],r=t>0&&s.continuous;for(let s=0;s<i.length-1;s+=2)0!==A&&(i[s].x+=A*e*o.random(-1,1),i[s].y+=A*e*o.random(-1,1),i[s+1].x+=A*e*o.random(-1,1),i[s+1].y+=A*e*o.random(-1,1)),x.line(i[s].x,i[s].y,i[s+1].x,i[s+1].y),r&&x.line(z[t-1][1].x,z[t-1][1].y,i[s].x,i[s].y)}x.set(n,r,a),x.isActive=h}};class k{constructor(t){this.a=t,this.vertices=t.map((t=>({x:t[0],y:t[1]}))),this.sides=this.vertices.map(((t,e,i)=>[t,i[(e+1)%i.length]]))}intersect(t){let e=`${t.point1.x},${t.point1.y}-${t.point2.x},${t.point2.y}`;if(this._intersectionCache&&this._intersectionCache[e])return this._intersectionCache[e];let i=[];for(let e of this.sides){let s=a(t.point1,t.point2,e[0],e[1]);!1!==s&&i.push(s)}return this._intersectionCache||(this._intersectionCache={}),this._intersectionCache[e]=i,i}draw(t=!1,e,i){let s=x.isActive;if(t&&x.set(t,e,i),x.isActive){r();for(let t of this.sides)x.line(t[0].x,t[0].y,t[1].x,t[1].y)}x.isActive=s}fill(t=!1,e,i,s,o){let n=D.isActive;t&&(I(t,e),B(i,s,o)),D.isActive&&(r(),D.fill(this)),D.isActive=n}hatch(t=!1,e,i){let s=_.isActive;t&&y(t,e,i),_.isActive&&(r(),_.hatch(this)),_.isActive=s}}class b{constructor(t){this.segments=[],this.angles=[],this.pres=[],this.type=t,this.dir=0,this.calcIndex(0),this.pol=!1}addSegment(t=0,e=0,i=1,s=!1){this.angles.length>0&&this.angles.splice(-1),t=o.toDegrees(t),this.angles.push(t),this.pres.push(i),this.segments.push(e),this.length=this.segments.reduce(((t,e)=>t+e),0),this.angles.push(t)}endPlot(t=0,e=1,i=!1){this.angles.splice(-1),this.angles.push(o.toDegrees(t)),this.pres.push(e)}rotate(t){this.dir=o.toDegrees(t)}pressure(t){return t>this.length?this.pres[this.pres.length-1]:this.curving(this.pres,t)}angle(t){return t>this.length?this.angles[this.angles.length-1]:(this.calcIndex(t),"curve"===this.type?this.curving(this.angles,t)+this.dir:this.angles[this.index]+this.dir)}curving(t,e){let i=t[this.index],s=t[this.index+1];return void 0===s&&(s=i),Math.abs(s-i)>180&&(s>i?s=-(360-s):i=-(360-i)),o.map(e-this.suma,0,this.segments[this.index],i,s,!0)}calcIndex(t){this.index=-1,this.suma=0;let e=0;for(;e<=t;)this.suma=e,e+=this.segments[this.index+1],this.index++}genPol(t,e,i=1,s=!1){r();let n=0,a=9999;for(let t of this.segments)t*=i,0!==t&&(n=Math.max(n,t),a=Math.min(a,t));let h=x.spacing(),l=[],c=o.constrain(D.bleed_strength,.05,1),d=(n+a)*(s?.03:D.isAnimated?.25:c),m=new u(t,e),p=Math.round(this.length/h);for(let t=0;t<p;t++)m.x&&(l[Math.floor(m.plotted/d)]=[m.x,m.y]),m.plotTo(this,h,h,1);return this.calcIndex(0),new k(l)}draw(t,e,i){x.isActive&&(r(),this.origin&&(t=this.origin[0],e=this.origin[1],i=1),x.flowShape(this,t,e,i))}fill(t,e,i){D.isActive&&(r(),this.origin&&(t=this.origin[0],e=this.origin[1],i=1),this.pol||(this.pol=this.genPol(t,e,i)),this.pol.fill())}hatch(t,e,i){_.isActive&&(r(),this.origin&&(t=this.origin[0],e=this.origin[1],i=1),this.pol||(this.pol=this.genPol(t,e,i,!0)),this.pol.hatch())}}let z,A=!1;function M(t){z=t,A=[]}function C(t,e,i){A.push([t,e,i])}function S(t){t===CLOSE&&A.push(A[0]);let e=P(A,z);(D.isActive||_.isActive)&&(e.fill(),e.hatch()),x.isActive&&e.draw(),A=!1}function P(t,e=.5){let i=new b(0===e?"segments":"curve");if(t&&t.length>0){i.origin=t[0];let s=0;for(let r=0;r<t.length-1;r++)if(e>0&&r<t.length-2){let n=t[r],l=t[r+1],c=t[r+2],d=dist(n[0],n[1],l[0],l[1]),m=dist(l[0],l[1],c[0],c[1]),p=h(n[0],n[1],l[0],l[1]),f=h(l[0],l[1],c[0],c[1]),u=e*Math.min(Math.min(d,m),.5*Math.min(d,m)),g=Math.max(d,m),v=d-u,x=m-u;if(Math.floor(p)===Math.floor(f))i.addSegment(p,v,n[2],!0),i.addSegment(f,m,l[2],!0);else{let e={x:l[0]-u*o.cos(-p),y:l[1]-u*o.sin(-p)},h={x:e.x+g*o.cos(90-p),y:e.y+g*o.sin(90-p)},c={x:l[0]+u*o.cos(-f),y:l[1]+u*o.sin(-f)},d=a(e,h,c,{x:c.x+g*o.cos(90-f),y:c.y+g*o.sin(90-f)},!0),m=dist(e.x,e.y,d.x,d.y),w=dist(e.x,e.y,c.x,c.y)/2,y=2*asin(w/m),_=2*Math.PI*m*y/360;i.addSegment(p,v-s,n[2],!0),i.addSegment(p,_,n[2],!0),i.addSegment(f,r===t.length-3?x:0,l[2],!0),s=u}r==t.length-3&&i.endPlot(f,l[2],!0)}else if(0===e){let e=t[r],s=t[r+1],o=dist(e[0],e[1],s[0],s[1]),n=h(e[0],e[1],s[0],s[1]);i.addSegment(n,o,1,!0),r==t.length-2&&i.endPlot(n,1,!0)}}return i}function I(t,e,i,s){D.opacity=arguments.length<4?arguments.length<3?e:1:s,D.color=arguments.length<3?color(t):color(t,e,i),D.isActive=!0}function B(t,e=.4,i=.4){D.bleed_strength=o.constrain(t,0,.6),D.texture_strength=o.constrain(e,0,1),D.border_strength=o.constrain(i,0,1)}const D={isActive:!1,isAnimated:!1,color:"#002185",opacity:80,bleed_strength:.07,texture_strength:.4,border_strength:.4,fill(t){this.v=t.a.map((t=>createVector(t[0],t[1])));const e=this.v.length*o.random(.4);D.m=this.v.map(((t,i)=>{let s=o.random(.8,1.2)*this.bleed_strength;return i<e?constrain(2*s,0,.9):s}));let i=o.randInt(0,this.v.length);this.v=[...this.v.slice(i),...this.v.slice(0,i)],new T(this.v,this.m,this.calcCenter()).fill(this.color,int(map(this.opacity,0,155,0,20,!0)),this.texture_strength)},calcCenter(){let t=0,e=0;for(let i=0;i<this.v.length;++i)t+=this.v[i].x,e+=this.v[i].y;return t/=this.v.length,e/=this.v.length,createVector(t,e)}};class T{constructor(t,e,i){this.v=t,this.m=e,this.midP=i,this.size=p5.Vector.sub(this.midP,this.v[0]).mag()}grow(t,e=!1){const i=[],s=[];let r=t>=.2&&this.v.length>=10?Math.floor(t*this.v.length):this.v.length;const o=t=>t+.1*(randomGaussian(.5,.1)-.5),n="radians"===angleMode()?Math.PI/180:1;for(let a=0;a<r;a++){const h=this.v[a],l=this.v[(a+1)%r];let c=.1===t?D.bleed_strength<=.1?.25:.75:this.m[a];e&&(c*=-.5),i.push(h),s.push(o(c));let d=p5.Vector.lerp(h,l,constrain(randomGaussian(.5,.2),.1,.9)),m=p5.Vector.sub(l,h),p=m.copy().normalize(),f=45*randomGaussian(0,.4)-90;p.rotate(f*n),p.mult(randomGaussian(.5,.2)*random(.6,1.4)*m.mag()*c),d.add(p),i.push(d),s.push(o(c))}return new T(i,s,this.midP)}fill(t,i,s){const r=i/5+s*i/6,o=i/4+s*i/3,a=i/7+s*i/3,h=i/5,l=3*s;n.trans(),m.blend(t,!1,!1,!0),m.mask.push(),m.mask.noStroke(),m.mask.translate(n.translation[0]+e.width/2,n.translation[1]+e.height/2),m.mask.rotate(n.rotation);let c=this.grow(),d=c.grow().grow(.9),p=d.grow(.75),f=this.grow(.85);for(let t=0;t<24;t++)t!==Math.floor(6)&&t!==Math.floor(12)&&t!==Math.floor(18)||(c=c.grow(),d=d.grow(.75),p=p.grow(.75),f=f.grow(.1,!0)),c.grow().layer(t,h),f.grow(.1,!0).grow(.1).layer(t,a,!1),d.grow(.1).grow(.1).layer(t,o,!1),p.grow(.8).grow(.1).layer(t,r,!1),0!==l&&c.erase(l);m.mask.pop()}layer(t,e,i=!0){m.mask.fill(255,0,0,e),i?(m.mask.stroke(255,0,0,.5+1.5*D.border_strength),m.mask.strokeWeight(o.map(t,0,24,6,.5))):m.mask.noStroke(),m.mask.beginShape();for(let t of this.v)m.mask.vertex(t.x,t.y);m.mask.endShape(CLOSE)}erase(t){const e=o.random(80,110),i=this.size/2,s=.025*this.size,r=.19*this.size;m.mask.erase(3.5*t,0);for(let t=0;t<e;t++){const t=this.midP.x+randomGaussian(0,i),e=this.midP.y+randomGaussian(0,i),n=o.random(s,r);m.mask.circle(t,e,n)}m.mask.noErase()}}p5.RendererGL.prototype.erase=function(t,e){this._isErasing||(this._cachedBlendMode=this.curBlendMode,this._isErasing=!0,this.blendMode("destination-out"),this._cachedFillStyle=this.curFillColor.slice(),this.curFillColor=[1,1,1,t/255],this._cachedStrokeStyle=this.curStrokeColor.slice(),this.curStrokeColor=[1,1,1,e/255])},p5.RendererGL.prototype.noErase=function(){if(this._isErasing){this.curFillColor=this._cachedFillStyle.slice(),this.curStrokeColor=this._cachedStrokeStyle.slice();let t=this.curBlendMode;this.blendMode(this._cachedBlendMode),this._cachedBlendMode=t,this._isErasing=!1,this._applyBlendMode()}};const E=[["pen",{weight:.35,vibration:.12,definition:.5,quality:8,opacity:200,spacing:.3,pressure:{curve:[.15,.2],min_max:[1.3,1]}}],["rotring",{weight:.2,vibration:.05,definition:1,quality:3,opacity:250,spacing:.15,pressure:{curve:[.05,.2],min_max:[1.2,.95]}}],["2B",{weight:.35,vibration:.5,definition:.1,quality:8,opacity:180,spacing:.2,pressure:{curve:[.15,.2],min_max:[1.3,1]}}],["HB",{weight:.3,vibration:.5,definition:.4,quality:4,opacity:180,spacing:.25,pressure:{curve:[.15,.2],min_max:[1.2,.9]}}],["2H",{weight:.2,vibration:.4,definition:.3,quality:2,opacity:150,spacing:.2,pressure:{curve:[.15,.2],min_max:[1.2,.9]}}],["cpencil",{weight:.4,vibration:.6,definition:.8,quality:7,opacity:120,spacing:.15,pressure:{curve:[.15,.2],min_max:[.95,1.15]}}],["charcoal",{weight:.5,vibration:2,definition:.8,quality:300,opacity:110,spacing:.06,pressure:{curve:[.15,.2],min_max:[1.15,.85]}}],["hatch_brush",{weight:.2,vibration:.4,definition:.3,quality:2,opacity:150,spacing:.15,pressure:{curve:[.5,.7],min_max:[1,1.5]}}],["spray",{type:"spray",weight:.3,vibration:12,definition:15,quality:40,opacity:120,spacing:.65,pressure:{curve:[0,.1],min_max:[.15,1.2]}}],["marker",{type:"marker",weight:2.5,vibration:.12,opacity:30,spacing:.4,pressure:{curve:[.35,.25],min_max:[1.35,1]}}],["marker2",{type:"custom",weight:2.5,vibration:.12,opacity:25,spacing:.35,pressure:{curve:[.35,.25],min_max:[1.15,.95]},tip:function(){let t=v;x.mask.rect(-1.5*t,-1.5*t,3*t,3*t),x.mask.rect(1*t,1*t,1*t,1*t)},rotate:"natural"}]];for(let t of E)x.add(t[0],t[1]);t.config=function(t={}){t.R&&(o.source=t.R)},t.load=s,t.preload=function(){w.load()},t.colorCache=function(t=!0){m.isCaching=t},t.reDraw=m.reDraw,t.reBlend=m.reBlend,t.push=c,t.pop=d,t.rotate=n.rotate,t.addField=p,t.field=function(t){r(),f.isActive=!0,f.current=t},t.noField=function(){f.isActive=!1},t.refreshField=function(t){f.refresh(t)},t.listFields=function(){return Array.from(f.list.keys())},t.scale=g,t.add=x.add,t.box=function(){return Array.from(x.list.keys())},t.set=x.set,t.pick=x.setBrush,t.clip=x.clip,t.noClip=x.noClip,t.point=function(t,e,i){r(),x.position=new u(t,e),x.drawTip(i)},t.stroke=x.setColor,t.strokeWeight=x.setWeight,t.noStroke=function(){x.isActive=!1},t.fill=I,t.bleed=B,t.noFill=function(){D.isActive=!1},t.fillAnimatedMode=function(t){D.isAnimated=t},t.line=x.line,t.flowLine=x.flowLine,t.plot=x.flowShape,t.rect=function(t,e,i,s,r=CORNER){if(r==CENTER&&(t-=i/2,e-=s/2),f.isActive)M(0),C(t,e),C(t+i,e),C(t+i,e+s),C(t,e+s),S(CLOSE);else{let r=new k([[t,e],[t+i,e],[t+i,e+s],[t,e+s]]);r.fill(),r.hatch(),r.draw()}},t.circle=function(t,e,i,s=!1){let r=new b("curve"),n=Math.PI*i/2,a=random(0,360),h=()=>s?o.random(-1,1):0;r.addSegment(0+a+h(),n+h(),1,!0),r.addSegment(-90+a+h(),n+h(),1,!0),r.addSegment(-180+a+h(),n+h(),1,!0),r.addSegment(-270+a+h(),n+h(),1,!0);let l=s?o.randInt(-5,5):0;s&&r.addSegment(0+a,l*(Math.PI/180)*i,!0),r.endPlot(l+a,1,!0),r.fill(t-i*o.sin(a),e-i*o.cos(-a),1),r.hatch(t-i*o.sin(a),e-i*o.cos(-a),1),r.draw(t-i*o.sin(a),e-i*o.cos(-a),1)},t.polygon=function(t){if(!Array.isArray(t)||t.length<3)return void console.error("Invalid input for polygon: An array with at least 3 points is required.");let e=new k(t);e.fill(),e.hatch(),e.draw()},t.spline=function(t,e=.5){P(t,e).draw()},t.beginShape=M,t.vertex=C,t.endShape=S,t.beginStroke=function(t,e,i){z=[e,i],A=new b(t)},t.segment=function(t,e,i){A.addSegment(t,e,i)},t.endStroke=function(t,e){A.endPlot(t,e),A.draw(z[0],z[1],1),A=!1},t.hatchArray=_.hatch,t.hatch=y,t.setHatch=function(t,e="black",i=1){_.hatchingBrush=[t,e,i]},t.noHatch=function(){_.isActive=!1,_.hatchingBrush=!1},t.Polygon=k,t.Plot=b,t.Position=u}));
\ No newline at end of file
+/*! p5.brush.js v1.0.4 2023 - by Alejandro Campos - MIT License */
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(1h(m,K){"6H"===3n 4h&&"4i"!==3n 6I?K(4h):"1h"===3n 4j&&4j.6J?4j(["4h"],K):(m=m||5r,K(m.4k={}))})(j,1h(m){1h K(a=!1){X=!0;l=a?a:6K.5r;u.3o();r.5s();Y(l.1C/5t)}1h B(){X||K()}1h Z(a,b,c,d,e=!1){1a h=a.x;a=a.y;1s k=b.x,n=b.y;b=c.x;c=c.y;1s p=d.x,q=d.y;1n(h===k&&a===n||b===p&&c===q)1c!1;d=k-h;k=n-a;n=p-b;q-=c;p=q*d-n*k;1n(0===p)1c!1;n=(n*(a-c)-q*(h-b))/p;b=(d*(a-c)-k*(h-b))/p;1c!e&&(0>b||1<b)?!1:{x:h+n*d,y:a+n*k}}1h Q(a,b,c,d){1c(2o/1k.2w*1k.6L(-(d-b),c-a)%1E+1E)%1E}1h aa(){v.2x.1g=r.1g;v.2x.2p=r.2p;v.1R.1g=g.1g;v.1R.4k=g.2J;v.1R.1T=g.c;v.1R.1w=g.w;v.1R.3p=g.cr;v.1D.1g=z.1g;v.1D.2r=z.2r;v.1D.2f=z.2f;v.1o.1g=w.1g;v.1o.1T=w.1T;v.1o.1y=w.1y;v.1o.2s=w.2s;v.1o.2K=w.2K;v.1o.2L=w.2L;v.4l.1N=x.3a}1h ba(){r.1g=v.2x.1g;r.2p=v.2x.2p;g.1g=v.1R.1g;g.2J=v.1R.4k;g.c=v.1R.1T;g.w=v.1R.1w;g.cr=v.1R.3p;z.1g=v.1D.1g;z.2r=v.1D.2r;z.2f=v.1D.2f;w.1g=v.1o.1g;w.1T=v.1o.1T;w.1y=v.1o.1y;w.2s=v.1o.2s;w.2K=v.1o.2K;w.2L=v.1o.2L;x.3a=v.4l.1N}1h L(a,b){B();r.1U.2g(a,{5u:b});r.2p=a;r.4m()}1h Y(a){1j(1a b 1V ca){1a c=g.1U.2M(b[0]).3E;c.1w*=a;c.1F*=a;c.1G*=a}da=a}1h ea(a=5,b=45,c={4n:!1,5v:!1,4o:!1}){z.1g=!0;z.2r=[a,b,c]}1h 4p(a){N=a;E=[]}1h O(a,b,c){E.1t([a,b,c])}1h 4q(a){a===4r&&E.1t(E[0]);a=4s(E,N);1n(w.1g||z.1g)a.1o(),a.1D();g.1g&&a.1W();E=!1}1h 4s(a,b=.5){1a c=1u R(0===b?"2N":"1H");1n(a&&0<a.1l){c.2q=a[0];1a C=0;1j(1a y=0;y<a.1l-1;y++)1n(0<b&&y<a.1l-2){1s d=a[y],e=a[y+1],h=a[y+2],k=3b(d[0],d[1],e[0],e[1]),n=3b(e[0],e[1],h[0],h[1]),p=Q(d[0],d[1],e[0],e[1]);h=Q(e[0],e[1],h[0],h[1]);1a t=b*1k.1I(1k.1I(k,n),.5*1k.1I(k,n));1s q=1k.1f(k,n);k-=t;1a F=n-t;1n(1k.1X(p)===1k.1X(h))c.1S(p,k,d[2],!0),c.1S(h,n,e[2],!0);2y{n={x:e[0]-t*f.1z(-p),y:e[1]-t*f.1v(-p)};1a H={x:n.x+q*f.1z(-p+90),y:n.y+q*f.1v(-p+90)},A={x:e[0]+t*f.1z(-h),y:e[1]+t*f.1v(-h)};q={x:A.x+q*f.1z(-h+90),y:A.y+q*f.1v(-h+90)};q=Z(n,H,A,q,!0);q=3b(n.x,n.y,q.x,q.y);n=3b(n.x,n.y,A.x,A.y)/2;n=2*6M(n/q);n=2*1k.2w*q*n/1E;c.1S(p,k-C,d[2],!0);c.1S(p,n,d[2],!0);c.1S(h,y===a.1l-3?F:0,e[2],!0);C=t}y==a.1l-3&&c.3q(h,e[2],!0)}2y 0===b&&(e=a[y],p=a[y+1],d=3b(e[0],e[1],p[0],p[1]),e=Q(e[0],e[1],p[0],p[1]),c.1S(e,d,1,!0),y==a.1l-2&&c.3q(e,1,!0))}1c c}1h 4t(a,b,c,d){w.1y=4>3c.1l?3>3c.1l?b:1:d;w.1T=3>3c.1l?1T(a):1T(a,b,c);w.1g=!0}1h 4u(a,b="2h"){w.2s=f.2t(a,0,.6);w.5w=b}1h 4v(a=.4,b=.4){w.2K=f.2t(a,0,1);w.2L=f.2t(b,0,1)}1a l,X=!1;2i.2O.3r("4w",()=>B());1A f={2z:()=>1i(),1i(a=0,b=1){1c 1===3c.1l?j.1O(j.2z(),0,1,0,a):j.1O(j.2z(),0,1,a,b)},1J(a,b){1c 1k.1X(j.1i(a,b))},6N(a){1a b,c,d=[];1j(b 6O a)1j(c=0;c<10*a[b];c++)d.1t(b);1c d[1k.1X(j.2z()*d.1l)]},1O(a,b,c,d,e,h=!1){a=d+(a-b)/(c-b)*(e-d);1c h?d<e?j.2t(a,d,e):j.2t(a,e,d):a},2t(a,b,c){1c 1k.1f(1k.1I(a,c),b)},1z(a){1c j.c[1k.1X((a%1E+1E)%1E*4)]},1v(a){1c j.s[1k.1X((a%1E+1E)%1E*4)]},4x:!1,5x(){1n(!j.4x){1s a=2*1k.2w/3F;j.c=1u 4y(3F);j.s=1u 4y(3F);1j(1a b=0;3F>b;b++){1A c=b*a;f.c[b]=1k.1z(c);f.s[b]=1k.1v(c)}j.4x=!0}},6P:a=>!6Q(a),2P:a=>(("4z"===3d()?2o*a/1k.2w:a)%1E+1E)%1E};f.5x();1A v={2x:{},1R:{},1D:{},1o:{},4l:{}},x={2A:[0,0],3a:0,1N(a=0){x.3a=f.2P(a)},1B(){1c j.2A=[l.4A.5y.4B[12],l.4A.5y.4B[13]]}};1s V=1;1s 5z=a=>V*=a;1A u={4C:!1,3e:!1,4D:!0,2j:1u 3G(3),3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){1c 1Q(3S(s.2V,e.2V,z),5P(s.w,e.w,z));}"}};2i.2O.3r("4w",()=>u.1M(!1,!0));2i.2O.3r("4w",()=>u.1M(!1,!0,!0));2i.2O.3r("5X",()=>u.1M(!1,!0));2i.2O.3r("5X",()=>u.1M(!1,!0,!0));1A r={1g:!1,1U:1u 4Q,2p:"",5Y(){1c 1k.1I(l.1C,l.1L)/cV},5s(){j.R=.4N*l.1C;j.5Z=-1*l.1C;j.60=-1*l.1L;j.2u=1k.2D(2*l.1C/j.R);j.2E=1k.2D(2*l.1L/j.R);j.61()},62(){1c j.1U.2M(j.2p).2x},4m(a=0){j.1U.2M(j.2p).2x=j.1U.2M(j.2p).5u(a,j.63())},63(){1a a=3w(j.2u);1j(1a b=0;b<j.2u;b++)a[b]=1u 4y(j.2E);1c a},61(){L("cW",1h(a,b){1a c=f.1J(-25,-15);0==f.1J(0,4R)%2&&(c*=-1);1j(1a e=0;e<r.2u;e++)1j(1a h=0;h<r.2E;h++){1s d=64(.3X*e+.3R*a,.3X*h+.3R*a);d=f.1O(d,0,1,-c,c);b[e][h]=3*d}1c b});L("cX",1h(a,b){a=f.1J(-25,-15)+5*f.1v(a);0==f.1J(0,4R)%2&&(a*=-1);1a c=f.1J(5,10);1j(1a e=0;e<r.2u;e++)1j(1a h=0;h<r.2E;h++){1s d=64(.3X*e,.3X*h);d=1k.2D(f.1O(d,0,1,-a,a)/c)*c;b[e][h]=4*d}1c b});L("cY",1h(a,b){a=f.1J(-30,-15)+1k.4S(44*f.1v(a));0==f.1J(0,4R)%2&&(a*=-1);1a c=0;1j(1a d=0;d<r.2u;d++){1j(1a e=0;e<r.2E;e++)b[d][e]=c,c+=a,a*=-1;c+=a;a*=-1}1c b});L("cZ",1h(a,b){1a c=f.1J(10,15)+5*f.1v(a);a=f.1J(3,6)+3*f.1z(a);1a d=f.1J(20,35);1j(1a e=0;e<r.2u;e++)1j(1a h=0;h<r.2E;h++){1a k=f.1v(c*e)*d*f.1z(h*a)+f.1J(-3,3);b[e][h]=k}1c b});L("d0",1h(a,b){1a c=f.1i(.4,.8),d=f.1J(18,26);1j(1a h=0;h<r.2u;h++)1j(1a k=0;k<r.2E;k++){1s e=f.1J(15,20);e=d*f.1v(c*k*h+e);b[h][k]=1.1*e*f.1z(a)}1c b})}};3Y S{3Z(a,b){j.41(a,b);j.2c=0}41(a,b){j.x=a;j.y=b;r.1g&&(j.66=j.x-r.5Z+x.1B()[0],j.67=j.y-r.60+x.1B()[1],j.42=1k.2D(j.66/r.R),j.43=1k.2D(j.67/r.R))}d1(){j.2c=0}46(){1c r.1g?0<=j.42&&0<=j.43&&j.42<r.2u&&j.43<r.2E:j.68()}68(){1a a=l.1C,b=l.1L;1c j.x>=-a-x.1B()[0]&&j.x<=a-x.1B()[0]&&j.y>=-b-x.1B()[1]&&j.y<=b-x.1B()[1]}2W(){1c j.46()&&r.1g?r.62()[j.42][j.43]:0}69(a,b,c=r.5Y(),d=!0){1n(j.46()){1a h;1n(!d){h=f.1z(-b);1s e=f.1v(-b)}1j(1a k=0;k<a/c;k++){d&&(e=j.2W(),h=f.1z(e-b),e=f.1v(e-b));1a n=c*h,p=c*e;j.2c+=c;j.41(j.x+n,j.y+p)}}2y j.2c+=c}4T(a,b,c,d){1n(j.46()){d=1/d;1j(1a h=0;h<b/c;h++){1s e=j.2W();1a k=a.2W(j.2c),n=c*f.1z(e-k);e=c*f.1v(e-k);j.2c+=c*d;j.41(j.x+n,j.y+e)}}2y j.2c+=c/3x}}1a da=1;1A g={1g:!0,1U:1u 4Q,c:"#d2",w:1,cr:6a,2J:"6b",2X:(a,b)=>{1A c="2T"===b.1p||"2F"===b.1p||"1P"===b.1p;c||"3h"===b.1p||(b.1p="47");"1P"===b.1p&&(T.2X(b.1P.6c),b.3i=()=>g.1d.1P(T.3y.2M(g.p.1P.6c),-g.p.1w/2,-g.p.1w/2,g.p.1w,g.p.1w));b.1M=c&&!1!==b.1M||b.1M?!0:!1;g.1U.2g(a,{3E:b,d3:[],d4:[]})},2g(a,b,c=1){g.4U(a);g.c=b;g.w=c;g.1g=!0},4U(a){g.2J=a},6d(a,b,c){0<3c.1l&&(g.c=2>3c.1l?a:[a,b,c]);g.1g=!0},6e(a){g.w=a},3p(a){g.cr=a},4V(){g.cr=6a},2U(a,b,c,d){B();1a e=3b(a,b,c,d);0!=e&&(g.48(a,b,e,!1,!1),a=Q(a,b,c,d),g.1W(a,!1))},4W(a,b,c,d){B();g.48(a,b,c,!0,!1);g.1W(f.2P(d),!1)},4X(a,b,c,d){B();g.48(b,c,a.1l,!0,a);g.1W(d,!0)},1G(){j.p=j.1U.2M(j.2J).3E;1c"47"===j.p.1p||"3h"===j.p.1p?j.p.1G/j.w:j.p.1G},48(a,b,c,d,e){j.1r=1u S(a,b);j.1l=c;j.4Y=d;(j.2Y=e)&&e.3j(0)},1W(a,b){b||(j.2v=a);j.4Z();1A c=j.1G(),d=b?1k.2D(j.1l*a/c):1k.2D(j.1l/c);1j(1a e=0;e<d;e++)j.3i(),b?j.1r.4T(j.2Y,c,c,a):j.1r.69(c,a,c,j.4Y);j.50()},6f(a){j.4Z(!0);j.3i(a);j.50(!0)},4Z(a=!1){j.p=j.1U.2M(j.2J).3E;1n(!a){j.a="2F"!==j.p.1x.1p?f.1i(-1,1):0;j.b="2F"!==j.p.1x.1p?f.1i(1,1.5):0;j.cp="2F"!==j.p.1x.1p?f.1i(3,3.5):f.1i(-.2,.2);1A[b,c]=j.p.1x.2d;j.1I=b;j.1f=c}j.c=l.1T(j.c);j.1d=j.p.1M?"1P"===j.p.1p?u.3g:u.1d:u.1Y;x.1B();j.1d.1t();j.1d.3t();"1P"===j.p.1p?j.1d.2R(x.2A[0],x.2A[1]):j.1d.2R(x.2A[0]+l.1C/2,x.2A[1]+l.1L/2);j.1d.1N(-x.3a);j.1d.3x(V);j.p.1M&&("1P"!==j.p.1p?u.1M(j.c):u.1M(j.c,!1,!0),a||j.52())},50(a=!1){j.p.1M&&!a&&j.52();j.1d.2S()},3i(a=!1){a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>q?D[0]:q,C=D[1]<C?D[1]:C,y=D[1]>y?D[1]:y};3w.6n(a)||(a=[a]);1j(1s F 1V a)t(F);F=1u M([[p,C],[q,C],[q,y],[p,y]]);1a H=90>=c&&0<=c?C:y;1s A=d.4o?1O(d.4o,0,1,1,1.1,!0):1;t=[];1a U=0,P=b,5e=G=>({3A:{x:p+P*G*f.1z(-c+90),y:H+P*G*f.1v(-c+90)},3B:{x:p+P*G*f.1z(-c+90)+f.1z(-c),y:H+P*G*f.1v(-c+90)+f.1v(-c)}});1j(;0<F.4b(5e(U)).1l;){1a G=[];1j(1s I 1V a)G.1t(I.4b(5e(U)));t[U]=G.de().df((D,W)=>D.x===W.x?D.y-W.y:D.x-W.x);P*=A;U++}a=[];1j(1s J 1V t)"4i"!==3n J[0]&&a.1t(J);J=d.4n?d.4n:0;1j(I=0;I<a.1l;I++)1j(t=a[I],F=0<I&&d.5v,A=0;A<t.1l-1;A+=2)0!==J&&(t[A].x+=J*b*f.1i(-10,10),t[A].y+=J*b*f.1i(-10,10),t[A+1].x+=J*b*f.1i(-10,10),t[A+1].y+=J*b*f.1i(-10,10)),g.2U(t[A].x,t[A].y,t[A+1].x,t[A+1].y),F&&g.2U(a[I-1][1].x,a[I-1][1].y,t[A].x,t[A].y);g.2g(h,e,k);g.1g=n}};3Y M{3Z(a,b=!1){j.a=a;j.5f=a.1O(c=>({x:c[0],y:c[1]}));b&&(j.5f=a);j.5g=j.5f.1O((c,d,e)=>[c,e[(d+1)%e.1l]])}4b(a){1a b=`${a.3A.x},${a.3A.y}-${a.3B.x},${a.3B.y}`;1n(j.3k&&j.3k[b])1c j.3k[b];1a c=[];1j(1a d 1V j.5g){1a e=Z(a.3A,a.3B,d[0],d[1]);!1!==e&&c.1t(e)}j.3k||(j.3k={});1c j.3k[b]=c}1W(a=!1,b,c){1a d=g.1g;a&&g.2g(a,b,c);1n(g.1g){B();1j(1a e 1V j.5g)g.2U(e[0].x,e[0].y,e[1].x,e[1].y)}g.1g=d}1o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1],c=1),j.2I||(j.2I=j.5j(a,b,c)),j.2I.1o())}1D(a,b,c){z.1g&&(B(),j.2q&&(a=j.2q[0],b=j.2q[1],c=1),j.2I||(j.2I=j.5j(a,b,c,!0)),j.2I.1D())}}1a E=!1,N;1A w={1g:!1,5l:!1,1T:"#di",1y:80,2s:.dj,2K:.4,2L:.4,1o(a){j.4c=a;j.v=a.a.1O(c=>6p(c[0],c[1]));1A b=j.v.1l*f.1i(.4);w.m=j.v.1O((c,d)=>{c=f.1i(.8,1.2)*j.2s;1c d<b?2t(2*c,0,.9):c});a=f.1J(0,j.v.1l);j.v=[...j.v.3m(a),...j.v.3m(0,a)];(1u 5m(j.v,j.m,j.6q(),[],!0)).1o(j.1T,5V(1O(j.1y,0,dk,0,20,!0)),j.2K)},6q(){1a a=0,b=0;1j(1a c=0;c<j.v.1l;++c)a+=j.v[c].x,b+=j.v[c].y;a/=j.v.1l;b/=j.v.1l;1c 6p(a,b)}};3Y 5m{3Z(a,b,c,d,e=!1){j.2I=1u M(a,!0);j.v=a;j.2v=d;j.m=b;j.3C=c;j.4d=2i.4e.5n(j.3C,j.v[0]).6r();1n(e)1j(a="4z"===3d()?1k.2w/2o:1,b=0;b<j.v.1l;b++){c=j.v[b];d=j.v[(b+1)%j.v.1l];e=2i.4e.5n(d,c);1s h=e.6s();h.1N(90*a);e={3A:{x:c.x+e.x/2,y:c.y+e.y/2},3B:{x:c.x+e.x/2+h.x,y:c.y+e.y/2+h.y}};h=0;1j(1a k 1V w.4c.4b(e)).4N<(d.x-c.x)*(k.y-c.y)-(d.y-c.y)*(k.x-c.x)&&h++;j.2v[b]=0===h%2?!0:!1}}1K(a,b=!1){1A c=[],d=[],e=[];1a h=.2<=a&&10<=j.v.1l?1k.1X(a*j.v.1l):j.v.1l;1A k=y=>{1A t=2G(.5,.1);1c y+.1*(t-.5)},n="4z"===3d()?1k.2w/2o:1;1j(1a y=0;y<h;y++){1s p=j.v[y],q=j.v[(y+1)%h];1a t=.1===a?.1>=w.2s?.25:.75:j.m[y];b&&(t*=-.5);c.1t(p);d.1t(k(t));1a F=2i.4e.dl(p,q,2t(2G(.5,.2),.1,.9));p=2i.4e.5n(q,p);q=p.6s().dm();1a H=j.2v[y];1s C="2h"==w.5w?90:-90;C=(H?C:-C)+45*2G(0,.4);q.1N(C*n);q.dn(2G(.5,.2)*1i(.6,1.4)*p.6r()*t);F.2X(q);c.1t(F);d.1t(k(t));e.1t(H,H)}1c 1u 5m(c,d,j.3C,e)}1o(a,b,c){1A d=b/5+c*b/6,e=b/4+c*b/3,h=b/7+c*b/3;b/=5;c*=3;x.1B();u.1M(a,!1,!1,!0);u.1d.1t();u.1d.3t();u.1d.2R(x.2A[0]+l.1C/2,x.2A[1]+l.1L/2);u.1d.1N(x.3a);u.1d.3x(V);a=j.1K();1a k=a.1K().1K(.9),n=k.1K(.75),p=j.1K(.85);1j(1a q=0;24>q;q++){1n(6===q||12===q||18===q)a=a.1K(),k=k.1K(.75),n=n.1K(.75),p=p.1K(.1,!0);a.1K().3D(q,b);p.1K(.1,!0).1K(.1).3D(q,h,!1);k.1K(.1).1K(.1).3D(q,e,!1);n.1K(.8).1K(.1).3D(q,d,!1);0!==c&&a.4f(c)}u.1d.2S()}3D(a,b,c=!0){u.1d.1o(1Z,0,0,b);c?(u.1d.1R(1Z,0,0,.5+1.5*w.2L),u.1d.6t(f.1O(a,0,24,6,.5))):u.1d.3t();u.1d.6u();1j(1a d 1V j.v)u.1d.6v(d.x,d.y);u.1d.6w(4r)}4f(a){1A b=f.1i(80,6x),c=j.4d/2,d=.do*j.4d,e=.19*j.4d;u.1d.4f(3.5*a,0);1j(a=0;a<b;a++){1A h=j.3C.x+2G(0,c),k=j.3C.y+2G(0,c),n=f.1i(d,e);u.1d.3z(h,k,n)}u.1d.6y()}}2i.6z.2O.4f=1h(a,b){j.4g||(j.5o=j.6A,j.4g=!0,j.6B("dp-2h"),j.6C=j.5p.3m(),j.5p=[1,1,1,a/1Z],j.6D=j.5q.3m(),j.5q=[1,1,1,b/1Z])};2i.6z.2O.6y=1h(){1n(j.4g){j.5p=j.6C.3m();j.5q=j.6D.3m();1a a=j.6A;j.6B(j.5o);j.5o=a;j.4g=!1;j.dq()}};1A ca=[["dr",{1w:.35,1F:.12,2m:.5,2l:8,1y:ds,1G:.3,1x:{1H:[.15,.2],2d:[1.3,1]}}],["dt",{1w:.2,1F:.5k,2m:1,2l:3,1y:5t,1G:.15,1x:{1H:[.5k,.2],2d:[1.2,.95]}}],["2B",{1w:.35,1F:.5,2m:.1,2l:8,1y:2o,1G:.2,1x:{1H:[.15,.2],2d:[1.3,1]}}],["6b",{1w:.3,1F:.5,2m:.4,2l:4,1y:2o,1G:.25,1x:{1H:[.15,.2],2d:[1.2,.9]}}],["2H",{1w:.2,1F:.4,2m:.3,2l:2,1y:6E,1G:.2,1x:{1H:[.15,.2],2d:[1.2,.9]}}],["du",{1w:.4,1F:.6,2m:.8,2l:7,1y:6F,1G:.15,1x:{1H:[.15,.2],2d:[.95,1.15]}}],["dv",{1w:.5,1F:2,2m:.8,2l:dw,1y:6x,1G:.dx,1x:{1H:[.15,.2],2d:[1.15,.85]}}],["dy",{1w:.2,1F:.4,2m:.3,2l:2,1y:6E,1G:.15,1x:{1H:[.5,.7],2d:[1,1.5]}}],["3h",{1p:"3h",1w:.3,1F:12,2m:15,2l:40,1y:6F,1G:.65,1x:{1H:[0,.1],2d:[.15,1.2]}}],["2T",{1p:"2T",1w:2.5,1F:.12,1y:30,1G:.4,1x:{1H:[.35,.25],2d:[1.35,1]}}],["dz",{1p:"2F",1w:2.5,1F:.12,1y:25,1G:.35,1x:{1H:[.35,.25],2d:[1.15,.95]},3i:1h(a){1a b=da;a.3P(-1.5*b,-1.5*b,3*b,3*b);a.3P(1*b,1*b,1*b,1*b)},1N:"6l"}]];1j(1a a 1V ca)g.2X(a[0],a[1]);m.dA=1h(a={}){a.R&&(f.2z=a.R)};m.3o=K;m.dB=1h(){T.3o()};m.dC=1h(a=!0){u.4D=a};m.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D(),a.1W())};m.e3=1h(a,b=.5){4s(a,b).1W()};m.6u=4p;m.6v=O;m.6w=4q;m.e4=1h(a,b,c){N=[b,c];E=1u R(a)};m.e5=1h(a,b,c){E.1S(a,b,c)};m.e6=1h(a,b){E.3q(a,b);E.1W(N[0],N[1],1);E=!1};m.e7=z.1D;m.1D=ea;m.e8=1h(a,b="e9",c=1){z.2f=[a,b,c]};m.eb=1h(){z.1g=!1;z.2f=!1};m.ec=M;m.ed=R;m.ee=S});',62,883,'|||||||||||||||||||this|||||||||||||||||||||||||||||||||||||||||||||||||||||let|vec3|return|mask||max|isActive|function|random|for|Math|length|float|if|fill|type|vec2|position|var|push|new|sin|weight|pressure|opacity|cos|const|trans|width|hatch|360|vibration|spacing|curve|min|randInt|grow|height|blend|rotate|map|image|vec4|stroke|addSegment|color|list|of|draw|floor|noBlend|255|||||||||||vVertTexCoord|dot|plotted|min_max||hatchingBrush|set|out|p5|currentColor|pow|quality|definition|angles|180|current|origin|hatchingParams|bleed_strength|constrain|num_columns|dir|PI|field|else|source|translation||shader|round|num_rows|custom|randomGaussian||pol|name|texture_strength|border_strength|get|segments|prototype|toDegrees|clear|translate|pop|marker|line|xyz|angle|add|plot|pixels||||||||||index|rotation|dist|arguments|angleMode|isBlending|pixelDensity|mask2|spray|tip|calcIndex|_intersectionCache|pres|slice|typeof|load|clip|endPlot|registerMethod|setUniform|noStroke|uniform|mod|Array|scale|tips|circle|point1|point2|midP|layer|param|1440|Float32Array|frag|glsl|getPigment|color1|color2|blending1|blending2|addColor|rect|void|03|spectral_mix|spectral_uncompand|055|spectral_compand|spectral_reflectance_to_xyz|02|class|constructor||update|column_index|row_index|||isIn|default|initializeDrawingState|case|Infinity|intersect|polygon|size|Vector|erase|_isErasing|exports|undefined|define|brush|others|refresh|rand|gradient|fa|ha|CLOSE|ia|ja|ka|la|afterSetup|isP|Float64Array|radians|_renderer|mat4|loaded|isCaching|createGraphics|DEGREES|reDraw|reBlend|active|289|9898|233|5453|01|spectral_srgb_to_linear|spectral_linear_to_reflectance|Map|100|abs|plotTo|setBrush|noClip|flowLine|flowShape|flow|pushState|popState||markerTip|calculatePressure|calculateAlpha||isInsideClippingArea|break||drawMarker|drawCustomOrImage|simPressure|gauss|keys|ma|vertices|sides|curving|suma|genPol|05|isAnimated|na|sub|_cachedBlendMode|curFillColor|curStrokeColor|self|create|250|gen|continuous|direction|preC|uMVMatrix|oa|noSmooth|include|spectral|vert|toString|precision|highp|attribute|aPosition|aTexCoord|uModelViewMatrix|uProjectionMatrix|varying|main|fract|mix|texture2D|spectral_linear_to_srgb|spectral_upsampling|spectral_xyz_to_srgb|spectral_linear_to_concentration|int|sqrt|post|step_length|left_x|top_y|addStandard|flow_field|genField|noise||x_offset|y_offset|isInCanvas|moveTo|null|HB|src|setColor|setWeight|drawTip|applyColor|drawSpray|drawDefault|adjustSizeAndRotation|tint|natural|imageToWhite|isArray|splice|createVector|calcCenter|mag|copy|strokeWeight|beginShape|vertex|endShape|110|noErase|RendererGL|curBlendMode|blendMode|_cachedFillStyle|_cachedStrokeStyle|150|120|from|object|module|amd|window|atan2|asin|weightedRand|in|isNumber|isNaN|replace|createShader|WEBGL|levels|white|gl_Position|sampler2D|bool|step|any|greaterThan|07482|299|587||114|43358||43213|33358|gl_FragColor|04045|0031308|clamp|inout|96853629|51567122|02055257|03147571|49108579|97901834|96855103|5401552|02059936|03146636|46944057|97901649|96859338|62645502|02062723|03140624|4016578|97901118|96877345|75595012|02073387|03119611|2449042|97892146|96942204|92826996|02114202|03053888|0682688|97858555|97143709|97223624|02233154|02856855|02732883|97743705|97541862|98616174|02556857|02459485|013606|97428075|98074186|98955255|03330189|0192952||01000187|96663223|98580992|98676237||05185294|01423112|01284127|94822893|98971194|97312575|10087639|01033111|02636635|89937713|99238027|91944277|24000413|00765876|07058713|76070164|99409844|32564851|53589066|00593693|70421692|4642044|995172|13820628|79874659|00485616|85473994|20123039|99576545|05015143|91186529|00426186|95081565|08808402|99593552|02912336|95399623|00409039|9717037|04592894|99564041|02421691|97137099|00438375|97651888|02860373|99464769|02660696|97939505|00537525|97429245|02060067|99229579|03407586|98345207|00772962||97012917||01656701|98638762||04835936|98553736|0136612|9425863|01451549|96829712|0001172|98648905|03181352|99989207|01357964|89228016|554e|98674535|10791525|99989891|01331243|53740239|85267882|98657555|46249516|13823139|01347661|15360445|93188793|98611877|84604333|06968113|01387181|05705719|94810268|98559942|94275572|05628787|01435472|03126539|94200977|98507063|96860996|06111561|01479836|02205445|91478045|98460039|97783966|08987709|0151525|01802271|87065445|98425301|98187757|13656016|01540513|0161346|78827548|98403909|98377315|22169624|01557233|01520947|65738359|98388535|98470202|32176956|0156571|01475977||59909403|98376116|98515481|36157329|01571025|01454263|56817268|98368246|98537114|4836192|01571916|01444459|54031997|98365023|98546685|46488579|01572133|01439897||52110241|98361309|98550011|47440306|01572502|0143762|51041094|98357259|98551031|4857699|01571717|01436343|50526577|98353856|98550741|49267971|01571905|01435687|5025508|98351247|98551323|49625685|01571059|0143537|50126452|98350101|98551563|49807754|01569728|01435408|50083021|98350852|98551547|49889859|0157002|mat3|24306333|53837619|49893282|96896309|87542451|04154303||05568392|20417438|05799454|469e|84e|00030502|00021941|21e|00103681|00112057|101e|00531314|00376661|00010475|01795439|01188055|00035364|05707758|02328644|00095147|11365162|03455942|00228226|17335873|03722379|00420733|19620658|03241838|0066888|18608237|02123321|0098884|13995048|01049099|01524945|08917453|00329584|02141831|04789621|00050704|03342293|02814563|00094867|05131001|01613766|00627372|07040208|0077591|01686462|08783871|00429615|02868965|09424905|00200551|04267481|09795667|00086147|05625475|09415219|00036904|0694704||08678102|00019143|08305315|07885653|00014956|0861261|0635267|231e|09046614|05374142|813e|08500387|04264606|883e||07090667||03161735|577e|05062889|02088521|94e|03547396|01386011|58e|02146821|00810264|01251646|0046301|00680458|00249138|00346457|0012593|00149761|00054165|0007697|00027795|00040737|00014711|00016901|103e|522e|439e|903e|771e|22e|1E3|curved|truncated|zigzag|waves|seabed|reset|000000|colors|buffers|switch|setAlpha|red|green|blue||loadPixels|updatePixels|loadImage|flat|sort|reduce|9999|002185|07|155|lerp|normalize|mult|025|destination|_applyBlendMode|pen|200|rotring|cpencil|charcoal|300|06|hatch_brush|marker2|config|preload|colorCache|scaleBrushes|addField|noField|refreshField|listFields|box|pick|point|bleed|fillTexture|noFill|fillAnimatedMode|CORNER|CENTER|270|console|error|Invalid|input|An|array|with|least|points|is|required|spline|beginStroke|segment|endStroke|hatchArray|setHatch|black||noHatch|Polygon|Plot|Position'.split('|'),0,{}))
\ No newline at end of file
diff --git a/sketch.js b/sketch.js
index 5c0fbd6..673f49f 100644
--- a/sketch.js
+++ b/sketch.js
@@ -75,13 +75,28 @@ function setup () {
translate(-width/2,-height/2)
+ brush.fill("#ff2702", 40)
+ brush.bleed(0.2,"out")
+ brush.fillTexture(0.6)
+ brush.beginShape(0)
+
+ for (let i = 0; i < 5; i++) {
+ brush.vertex(random(width),random(height))
+ }
+ brush.endShape(CLOSE)
+
+ brush.reBlend()
+
+ brush.field("seabed")
+
// STANDARD PALETTE TEST
let i = 0
for (let b of brush.box()) {
brush.set(b,random(palette),1)
- brush.flowLine(30,30+i*10,200,0)
+ brush.flowLine(30,60+i*10,195,0)
i++
}
+
}
function draw() {