Unlock custom brushes, natural fill effects and intuitive hatching in p5.js
CHANGELOG - Fixed Instance Mode - New function remove() - Fixed a bug on the fillTexture strength - Improved brushes performance
Alejandroae187116783c
diff --git a/README.md b/README.mdindex 45d1c6f..10ee6a2 100644--- a/README.md+++ b/README.md@@ -77,7 +77,7 @@ 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.scale() | | [Geometry](#geometry) | brush.point() |+| | brush.scale() | | [Geometry](#geometry) | ~~brush.point()~~ || | brush.reDraw() | | | brush.line() || | brush.reBlend() | | | brush.flowLine() || [Vector-Fields](#vector-fields) | brush.field() | | | brush.beginStroke() |@@ -610,14 +610,6 @@ The following functions are only affected by stroke() operations, completely ign----- `brush.point(x,y)`- - **Description**: Tips the brush into the canvas, with current stroke() state. This might be useful for creating textures or particle systems, but at that point you rather create your own set of functions, since you won't be using 99% of the library- - **Parameters**:- - `x` (Number): The x-coordinate of the point.- - `y` (Number): The y-coordinate of the point.------- `brush.line(x1, y1, x2, y2)`- **Description**: Draws a line from one point to another using the current brush settings. This function is affected only by stroke operations and will not produce any drawing if `noStroke()` has been called.- **Parameters**:diff --git a/p5.brush.js b/p5.brush.jsindex 4257170..81dab64 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.4c+ * @version 1.0.5* @license MIT* @author Alejandro Campos Uribe*@@ -101,18 +101,33 @@* If false, it uses the current window as the rendering context.* EXPORTED*/- function loadSystem (canvasID = false) {- _isReady = true;+ function loadSystem (canvasID = false, instanced = false) {+ if (_isReady) _remove(false)// Set the renderer to the specified canvas or to the window if no ID is given_r = (!canvasID) ? window.self : canvasID;- // Load realistic color blending- Mix.load();// Load flowfield system- FF.create();+ if (!_isReady) {+ _isReady = true;+ FF.create();+ }+ // Load realistic color blending+ Mix.load(instanced);// Adjust standard brushes to match canvas sizeglobalScale(_r.width / 250) // Adjust standard brushes to match canvas}+ /**+ * Removes brush buffers+ */+ function _remove (a = true) {+ if (_isReady) {+ Mix.mask.remove()+ Mix.mask2.remove()+ Mix.noBlend.remove()+ if (a) brush.load()+ }+ }+/*** Preloads necessary assets or configurations.* This function should be called before setup to ensure all assets are loaded.@@ -166,7 +181,7 @@* The basic source of randomness, can be replaced with a deterministic alternative for testing.* @returns {number} A random number between 0 and 1.*/- source: () => random(),+ source: () => _r.random(),/*** Generates a random number within a specified range.@@ -276,7 +291,7 @@/*** Changes angles to degrees and between 0-360*/- toDegrees: (a) => (((angleMode() === "radians") ? a * 180 / Math.PI : a) % 360 + 360) % 360,+ toDegrees: (a) => (((_r.angleMode() === "radians") ? a * 180 / Math.PI : a) % 360 + 360) % 360,}// Perform the precalculation of trigonometric values for the R objectR.preCalculation();@@ -495,13 +510,14 @@/*** Loads necessary resources and prepares the mask buffer and shader for colour blending.*/- load() {+ load(instanced) {// Create a buffer to be used as a mask. We use a 2D buffer for faster geometry drawing- this.mask = createGraphics(_r.width,_r.height)++ this.mask = instanced ? _r.createGraphics(_r.width,_r.height) : createGraphics(_r.width,_r.height)this.mask.pixelDensity(_r.pixelDensity());this.mask.clear();this.mask.noSmooth();- this.mask.angleMode(DEGREES);+ this.mask.angleMode(_r.DEGREES);exports.mask = this.mask;// Load the spectral.js shader code only once@@ -513,17 +529,17 @@Mix.loaded = true;// Create a buffer for noBlend brushes- this.noBlend = createGraphics(_r.width,_r.height);+ this.noBlend = instanced ? _r.createGraphics(_r.width,_r.height) : createGraphics(_r.width,_r.height)this.noBlend.pixelDensity(_r.pixelDensity());this.noBlend.noSmooth();this.noBlend.clear();- this.noBlend.angleMode(DEGREES);+ this.noBlend.angleMode(_r.DEGREES);// WEBGL buffer for img brushes (image() is much quicker like this)- this.mask2 = createGraphics(_r.width,_r.height, WEBGL)+ this.mask2 = instanced ? _r.createGraphics(_r.width,_r.height, _r.WEBGL) : createGraphics(_r.width,_r.height, _r.WEBGL)this.mask2.pixelDensity(_r.pixelDensity());this.mask2.clear();- this.mask2.angleMode(DEGREES);+ this.mask2.angleMode(_r.DEGREES);},/**@@ -721,7 +737,7 @@void main() {vec4 maskColor = texture2D(mask, vVertTexCoord);- if (maskColor.r > 0.0) {+ if (maskColor.r > 0.0 && maskColor.a > 0.0) {vec2 r=vec2(12.9898,78.233), a=vec2(7.9898,58.233), l=vec2(17.9898,3.233);float d=rand(vVertTexCoord,r.x,r.y,43358.5453)*2.-1., x=rand(vVertTexCoord,a.x,a.y,43213.5453)*2.-1., s=rand(vVertTexCoord,l.x,l.y,33358.5453)*2.-1.;@@ -745,9 +761,11 @@float blacken = 0.5 * (maskColor.a - darken_above);pigment = pigment * (1. - blacken) - vec4(0.5) * blacken;}-+vec3 mixedColor = spectral_mix(texture2D(source,vVertTexCoord).xyz, pigment.xyz, 0.9 * maskColor.a);gl_FragColor = vec4(mixedColor + 0.01*vec3(d,x,s),1.);+ } else {+ gl_FragColor = vec4(0);}}`@@ -895,7 +913,7 @@if (R.randInt(0,100)%2 == 0) {angleRange = angleRange * -1}for (let column=0;column<FF.num_columns;column++){for (let row=0;row<FF.num_rows;row++) {- let noise_val = noise(column * 0.02 + t * 0.03, row * 0.02 + t * 0.03)+ let noise_val = _r.noise(column * 0.02 + t * 0.03, row * 0.02 + t * 0.03)let angle = R.map(noise_val, 0.0, 1.0, -angleRange, angleRange)field[column][row] = 3 * angle;}@@ -908,7 +926,7 @@let truncate = R.randInt(5,10);for (let column=0;column<FF.num_columns;column++){for (let row=0;row<FF.num_rows;row++) {- let noise_val = noise(column * 0.02, row * 0.02)+ let noise_val = _r.noise(column * 0.02, row * 0.02)let angle = Math.round(R.map(noise_val, 0.0, 1.0, -angleRange, angleRange)/truncate)*truncate;field[column][row] = 4 * angle;}@@ -1242,7 +1260,7 @@*/line(x1,y1,x2,y2) {_ensureReady();- let d = dist(x1,y1,x2,y2)+ let d = _r.dist(x1,y1,x2,y2)if (d == 0) return;B.initializeDrawingState(x1, y1, d, false, false);let angle = _calculateAngle(x1,y1,x2,y2);@@ -1364,6 +1382,8 @@else Mix.blend(this.c,false,true)if (!isTip) this.markerTip()}+ this.alpha = this.calculateAlpha(); // Calcula Alpha+ this.applyColor(this.alpha); // Apply Color},/**@@ -1380,8 +1400,6 @@*/tip(custom_pressure = false) {let pressure = custom_pressure ? custom_pressure : this.calculatePressure(); // Calculate Pressure- let alpha = this.calculateAlpha(pressure); // Calcula Alpha- this.applyColor(alpha); // Apply Colorif (this.isInsideClippingArea()) { // Check if it's inside clipping areaswitch (this.p.type) { // Draw different tip typescase "spray":@@ -1392,7 +1410,7 @@break;case "custom":case "image":- this.drawCustomOrImage(pressure, alpha);+ this.drawCustomOrImage(pressure, this.alpha);break;default:this.drawDefault(pressure);@@ -1441,10 +1459,9 @@* @returns {number} The calculated alpha value.*/calculateAlpha(pressure) {- 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));+ let opacity = (this.p.type !== "default" && this.p.type !== "spray") ? this.p.opacity / this.w : this.p.opacity;+ //let pow = R.constrain(Math.pow(pressure, this.p.type === "marker" ? 0.7 : 1.5),0.75,1.3)+ return opacity;},/**@@ -1524,8 +1541,8 @@* @param {number} pressure - The current pressure value.*/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) {+ let vibration = this.w * this.p.vibration * (this.p.definition + (1-this.p.definition) * _r.randomGaussian() * this.gauss(0.5,0.9,5,0.2,1.2) / pressure);+ if (R.random(0, this.p.quality * pressure) > 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 * R.random(0.85,1.15));}},@@ -1566,20 +1583,6 @@},}- /**- * Draws the tip of the selected brush- * @param {number} x - x coordinate for the tip.- * @param {number} y - y coordinate for the tip.- * @param {number} pressure - The desired pressure value.- * EXPORTED- */- function drawTip(x, y, pressure) {- _ensureReady();- B.position = new Position(x, y)- B.drawTip(pressure)- }--// =============================================================================// Section: Loading Custom Image Tips// =============================================================================@@ -1731,7 +1734,7 @@// Set initial values for line generationlet startY = (angle <= 90 && angle >= 0) ? minY : maxY;- let gradient = options.gradient ? map(options.gradient,0,1,1,1.1,true) : 1+ let gradient = options.gradient ? R.map(options.gradient,0,1,1,1.1,true) : 1let dots = [];let i = 0;let dist1 = dist;@@ -1909,8 +1912,8 @@* @param {number} h - The height of the rectangle.* @param {boolean} [mode=CORNER] - If CENTER, the rectangle is drawn centered at (x, y).*/- function drawRectangle(x,y,w,h,mode = CORNER) {- if (mode == CENTER) x = x - w / 2, y = y - h / 2;+ function drawRectangle(x,y,w,h,mode = _r.CORNER) {+ if (mode == _r.CENTER) x = x - w / 2, y = y - h / 2;if (FF.isActive) {_beginShape(0);_vertex(x,y);@@ -2078,14 +2081,19 @@}let _step = B.spacing() // get last spacinglet vertices = []- let bleed = R.constrain(F.bleed_strength,0.05,1)+ let bleed = R.constrain(F.bleed_strength,0.075,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);+ let numsteps = Math.round(this.length/_step);+ let pside = 0, i = 0;+ let side1 = side * R.random(0.7,1.3)for (let steps = 0; steps < numsteps; steps++) {- if (linepoint.x) vertices[Math.floor(linepoint.plotted / side)] = [linepoint.x,linepoint.y]linepoint.plotTo(this,_step,_step,1)+ pside += _step;+ if (pside >= side1 && linepoint.x) {+ vertices[i] = [linepoint.x,linepoint.y]+ side1 = side * R.random(0.7,1.3), i++, pside = 0+ }}this.calcIndex(0);return new Polygon(vertices);@@ -2114,7 +2122,7 @@if (F.isActive) {_ensureReady(); // Ensure that the drawing environment is preparedif (this.origin) x = this.origin[0], y = this.origin[1], scale = 1;- if (!this.pol) this.pol = this.genPol(x, y, scale)+ this.pol = this.genPol(x, y, scale)this.pol.fill()}}@@ -2128,7 +2136,7 @@if (H.isActive) {_ensureReady(); // Ensure that the drawing environment is preparedif (this.origin) x = this.origin[0], y = this.origin[1], scale = 1;- if (!this.pol) this.pol = this.genPol(x, y, scale, true)+ this.pol = this.genPol(x, y, scale, true)this.pol.hatch()}}@@ -2149,7 +2157,7 @@// Calculate the length of the arc for each quarter of the circlelet l = Math.PI * radius / 2;// Initialize the angle for the drawing segments- let angle = random(0,360)+ let angle = R.random(0,360)// Define a function to optionally add randomness to the segment lengthlet rr = () => (r ? R.random(-1,1) : 0)// Add segments for each quarter of the circle with optional randomness@@ -2289,8 +2297,8 @@let point3 = {x: p2[0] + dd * R.cos(-a2), y: p2[1] + dd * R.sin(-a2)}let point4 = {x: point3.x + dmax * R.cos(-a2+90), y: point3.y + dmax * R.sin(-a2+90)}let int = _intersectLines(point1,point2,point3,point4,true)- let radius = dist(point1.x,point1.y,int.x,int.y)- let disti = dist(point1.x,point1.y,point3.x,point3.y)/2+ let radius = _r.dist(point1.x,point1.y,int.x,int.y)+ let disti = _r.dist(point1.x,point1.y,point3.x,point3.y)/2let a3 = 2 * Math.asin( disti/radius ) * (180 / Math.PI);let s3 = 2 * Math.PI * radius * a3 / 360;let temp = _close ? (i === 0 ? 0 : s1-done) : s1-done;@@ -2308,7 +2316,7 @@// If curvature is 0, simply create segmentsif (i === 0 && _close) array_points.pop()let p1 = array_points[i], p2 = array_points[i+1]- let d = dist(p1[0],p1[1],p2[0],p2[1]);+ let d = _r.dist(p1[0],p1[1],p2[0],p2[1]);let a = _calculateAngle(p1[0],p1[1],p2[0],p2[1]);p.addSegment(a,d,1,true)if (i == array_points.length - 2) {@@ -2358,7 +2366,7 @@*/function setFill(a,b,c,d) {F.opacity = (arguments.length < 4) ? ((arguments.length < 3) ? b : 1) : d;- F.color = (arguments.length < 3) ? color(a) : color(a,b,c);+ F.color = (arguments.length < 3) ? _r.color(a) : _r.color(a,b,c);F.isActive = true;}@@ -2425,20 +2433,20 @@// Store polygonthis.polygon = polygon;// Map polygon vertices to p5.Vector objects- this.v = polygon.a.map(vert => createVector(vert[0], vert[1]));+ this.v = polygon.a.map(vert => _r.createVector(vert[0], vert[1]));// Calculate fluidity once, outside the loopconst fluid = this.v.length * R.random(0.4);// Map vertices to bleed multipliers with more intense effect on 'fluid' verticesF.m = this.v.map((_, i) => {let multiplier = R.random(0.8, 1.2) * this.bleed_strength;- return i < fluid ? constrain(multiplier * 2, 0, 0.9) : multiplier;+ return i < fluid ? R.constrain(multiplier * 2, 0, 0.9) : multiplier;});// Shift vertices randomly to create a more natural watercolor edgelet 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 effectlet 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)+ pol.fill(this.color, Math.floor(R.map(this.opacity,0,155,0,20,true)), this.texture_strength)},/**@@ -2452,7 +2460,7 @@midy += this.v[i].y;}midx /= this.v.length, midy /= this.v.length;- return createVector(midx,midy)+ return _r.createVector(midx,midy)}}@@ -2479,10 +2487,14 @@this.dir = dir;this.m = _m;this.midP = _center;- this.size = p5.Vector.sub(this.midP,this.v[0]).mag();+ this.size = -Infinity;+ for (let v of this.v) {+ let temp_size = _r.dist(this.midP.x,this.midP.y,v.x,v.y)+ if (temp_size > this.size) this.size = temp_size;+ }// This calculates the bleed direction for the initial shape, for each of the vertices.if (isFirst) {- const rotationFactor = (angleMode() === "radians") ? Math.PI / 180 : 1;+ const rotationFactor = (_r.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];@@ -2516,40 +2528,46 @@const newDirs = [];// Determine the length of vertices to process based on growth factorlet 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+ // Pre-compute values that do not change within the loop+ const angleM = _r.angleMode()+ _r.angleMode(_r.RADIANS)+ const modAdjustment = degrow ? -0.5 : 1;+ // Inline changeModifier to reduce function callsconst changeModifier = (modifier) => {- const gaussianVariation = randomGaussian(0.5, 0.1);+ const gaussianVariation = _r.randomGaussian(0.5, 0.1);return modifier + (gaussianVariation - 0.5) * 0.1;};- // Pre-calculate rotation factor if angleMode is constant- const rotationFactor = (angleMode() === "radians") ? Math.PI / 180 : 1;+ // Reusable vector objects+ let direction = new p5.Vector();// Loop through each vertex to calculate the new position based on growthfor (let i = 0; i < verticesToProcess; i++) {const currentVertex = this.v[i];const nextVertex = this.v[(i + 1) % verticesToProcess];// Determine the growth modifierlet mod = (growthFactor === 0.1) ? (F.bleed_strength <= 0.1 ? 0.25 : 0.75) : this.m[i];- if (degrow) mod *= -0.5;+ mod *= modAdjustment;// Add the current vertex and its modified valuenewVerts.push(currentVertex);newMods.push(changeModifier(mod));- // Calculate the new vertex position- 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();+ // Calculate vertex bleed+ let sidex = nextVertex.x - currentVertex.x, sidey = nextVertex.y - currentVertex.y;+ let sideMagnitude = Math.sqrt(sidex * sidex + sidey * sidey);+ direction.set(sidex,sidey).normalize();// Make sure that we always bleed in the selected directionlet 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);+ let rotationDegrees = ((dir) ? bleed : -bleed) + (_r.randomGaussian(0,0.4)) * 45;+ direction.rotate(rotationDegrees * Math.PI / 180);+ direction.mult(_r.randomGaussian(0.5, 0.2) * R.random(0.6, 1.4) * sideMagnitude * mod);+ // Calculate the new vertex position+ let newVertex = p5.Vector.lerp(currentVertex, nextVertex, R.constrain(_r.randomGaussian(0.5,0.2),0.1,0.9));newVertex.add(direction);// Add the new vertex and its modifiernewVerts.push(newVertex);newMods.push(changeModifier(mod));newDirs.push(dir,dir)}+ _r.angleMode(angleM)return new FillPolygon (newVerts, newMods, this.midP, newDirs);}@@ -2560,9 +2578,9 @@* @param {number} intensity - The opacity of the color layers.*/fill (color, intensity, tex) {-+ let bleed = R.map(F.bleed_strength,0,0.15,0.6,1,true)// Precalculate stuff- const numLayers = 24;+ const numLayers = 24 * bleed;const intensityThird = intensity / 5 + tex * intensity / 6;const intensityQuarter = intensity / 4 + tex * intensity / 3;const intensityFifth = intensity / 7 + tex * intensity / 3;@@ -2578,18 +2596,22 @@Mix.mask.rotate(Matrix.rotation)Mix.mask.scale(Scale.current)+ // Set the different polygons for texturelet pol = this.grow()let pol2 = pol.grow().grow(0.9);let pol3 = pol2.grow(0.75);- let pol4 = this.grow(0.85)+ let pol4 = this.grow(0.6)for (let i = 0; i < numLayers; i ++) {- if (i === Math.floor(numLayers / 4) || i === Math.floor(2 * numLayers / 4) || i === Math.floor(3 * numLayers / 4)) {- // Grow the polygon objects once per third of the process+ if (i === Math.floor(numLayers / 4) || i === Math.floor(numLayers / 2) || i === Math.floor(3 * numLayers / 4)) {+ // Grow the polygon objects once per fourth of the processpol = pol.grow();- pol2 = pol2.grow(0.75);- pol3 = pol3.grow(0.75);- pol4 = pol4.grow(0.1,true);+ // Grow the texture polygons if conditions are met+ if (bleed === 1 || i === Math.floor(numLayers / 2)) {+ pol2 = pol2.grow(0.75);+ pol3 = pol3.grow(0.75);+ pol4 = pol4.grow(0.1,true);+ }}// Draw layerspol.grow().layer(i, intensityHalf);@@ -2597,7 +2619,7 @@pol2.grow(0.1).grow(0.1).layer(i, intensityQuarter, false);pol3.grow(0.8).grow(0.1).layer(i, intensityThird, false);// Erase after each set of layers is drawn- if (texture !== 0) pol.erase(texture);+ if (texture !== 0) pol.erase(texture, intensity);}Mix.mask.pop();}@@ -2622,22 +2644,22 @@for(let v of this.v) {Mix.mask.vertex(v.x, v.y);}- Mix.mask.endShape(CLOSE);+ Mix.mask.endShape(_r.CLOSE);}/*** Erases parts of the polygon to create a more natural, uneven watercolor texture.* Uses random placement and sizing of circles to simulate texture.*/- erase (texture) {- const numCircles = R.random(80, 110);+ erase (texture, intensity) {+ const numCircles = R.random(130, 200);const halfSize = this.size / 2;const minSizeFactor = 0.025 * this.size;const maxSizeFactor = 0.19 * this.size;- Mix.mask.erase(3.5 * texture,0);+ Mix.mask.erase(3.5 * texture - R.map(intensity, 80, 120, 0.3, 1, true),0);for (let i = 0; i < numCircles; i++) {- const x = this.midP.x + randomGaussian(0, halfSize);- const y = this.midP.y + randomGaussian(0, halfSize);+ const x = this.midP.x + _r.randomGaussian(0, halfSize);+ const y = this.midP.y + _r.randomGaussian(0, halfSize);const size = R.random(minSizeFactor, maxSizeFactor);Mix.mask.circle(x, y, size);}@@ -2689,17 +2711,17 @@// Define each brush with a name and a set of parameters// For example, the "pen" brush has a weight of 0.35, a vibration of 0.12, etc.// The "marker2" brush has a custom tip defined by a function that draws rectangles.- ["pen", [ 0.35, 0.12, 0.5, 8, 200, 0.3, {curve: [0.15,0.2], min_max: [1.3,1]} ] ],- ["rotring", [ 0.2, 0.05, 1, 3, 250, 0.15, {curve: [0.05,0.2], min_max: [1.2,0.95]} ]],+ ["pen", [ 0.35, 0.12, 0.5, 8, 200, 0.3, {curve: [0.15,0.2], min_max: [1.4,0.9]} ] ],+ ["rotring", [ 0.2, 0.05, 1, 3, 250, 0.15, {curve: [0.05,0.2], min_max: [1.7,0.8]} ]],["2B", [ 0.35, 0.5, 0.1, 8, 180, 0.2, {curve: [0.15,0.2], min_max: [1.3,1]} ]],["HB", [ 0.3, 0.5, 0.4, 4, 180, 0.25, {curve: [0.15,0.2], min_max: [1.2,0.9]} ]],["2H", [ 0.2, 0.4, 0.3, 2, 150, 0.2, {curve: [0.15,0.2], min_max: [1.2,0.9]} ]],- ["cpencil", [ 0.4, 0.6, 0.8, 7, 120, 0.15, {curve: [0.15,0.2], min_max: [0.95,1.15]} ]],- ["charcoal", [ 0.5, 2, 0.8, 300, 110, 0.06, {curve: [0.15,0.2], min_max: [1.15,0.85]} ]],+ ["cpencil", [ 0.4, 0.6, 0.8, 7, 120, 0.15, {curve: [0.15,0.2], min_max: [0.95,1.2]} ]],+ ["charcoal", [ 0.5, 2, 0.8, 300, 110, 0.06, {curve: [0.15,0.2], min_max: [1.3,0.8]} ]],["hatch_brush", [ 0.2, 0.4, 0.3, 2, 150, 0.15, {curve: [0.5,0.7], min_max: [1,1.5]} ]],- ["spray", [ 0.3, 12, 15, 40, 120, 0.65, {curve: [0,0.1], min_max: [0.15,1.2]}, "spray" ]],- ["marker", [ 2.5, 0.12, null, null, 30, 0.4, {curve: [0.35,0.25], min_max: [1.35,1]}, "marker" ]],- ["marker2", [ 2.5, 0.12, null, null, 25, 0.35, {curve: [0.35,0.25], min_max: [1.15,0.95]}, "custom",+ ["spray", [ 0.3, 12, 15, 40, 80, 0.65, {curve: [0,0.1], min_max: [0.15,1.2]}, "spray" ]],+ ["marker", [ 2.5, 0.12, null, null, 25, 0.4, {curve: [0.35,0.25], min_max: [1.5,1]}, "marker" ]],+ ["marker2", [ 2.5, 0.12, null, null, 25, 0.35, {curve: [0.35,0.25], min_max: [1.3,0.95]}, "custom",function (t) {let scale = _gScale;t.rect(-1.5 * scale,-1.5 * scale,3 * scale,3 * scale); t.rect(1 * scale,1 * scale,1 * scale,1 * scale)@@ -2731,6 +2753,7 @@exports.preload = preloadBrushAssets; // Preloads custom tips for the library.exports.colorCache = enableCacheBlending; // Enables/disables cache color blending for improved performanceexports.scaleBrushes = globalScale; // Rescales all standard brushes.+ exports.remove = _remove;// Utility Functionsexports.push = _push;@@ -2754,7 +2777,6 @@exports.pick = B.setBrush; // Selects a brush to use.exports.clip = B.clip; // Clips brushes with a rectangle.exports.noClip = B.noClip;- exports.point = drawTip; // Draw tip of the brush with a custom pressure// STROKE Propertiesexports.stroke = B.setColor; // Activates and sets the stroke color.diff --git a/p5.brush.min.js b/p5.brush.min.jsindex e694ca8..d048fa9 100644--- a/p5.brush.min.js+++ b/p5.brush.min.js@@ -1,56 +1,2 @@-/* p5.brush.js v1.0.4c - Alejandro Campos - MIT License */-(function(m,N){"object"===typeof exports&&"undefined"!==typeof module?N(exports):"function"===typeof define&&define.amd?define(["exports"],N):(m=m||self,N(m.brush={}))})(this,function(m){function N(a=!1){Y=!0;l=a?a:window.self;t.load();r.create();Z(l.width/250)}function E(){Y||N()}function aa(a,b,c,d,e=!1){let g=a.x;a=a.y;var k=b.x,p=b.y;b=c.x;c=c.y;var n=d.x,q=d.y;if(g===k&&a===p||b===n&&c===q)return!1;d=k-g;k=p-a;p=n-b;q-=c;n=q*d-p*k;if(0===n)return!1;p=(p*(a-c)-q*(g-b))/n;b=(d*(a-c)-k*(g-b))/n;-return!e&&(0>b||1<b)?!1:{x:g+p*d,y:a+p*k}}function S(a,b,c,d){return(180/Math.PI*Math.atan2(-(d-b),c-a)%360+360)%360}function ba(){u.field.isActive=r.isActive;u.field.current=r.current;u.stroke.isActive=h.isActive;u.stroke.brush=h.name;u.stroke.color=h.c;u.stroke.weight=h.w;u.stroke.clip=h.cr;u.hatch.isActive=y.isActive;u.hatch.hatchingParams=y.hatchingParams;u.hatch.hatchingBrush=y.hatchingBrush;u.fill.isActive=v.isActive;u.fill.color=v.color;u.fill.opacity=v.opacity;u.fill.bleed_strength=v.bleed_strength;-u.fill.texture_strength=v.texture_strength;u.fill.border_strength=v.border_strength;u.others.rotate=x.rotation}function ca(){r.isActive=u.field.isActive;r.current=u.field.current;h.isActive=u.stroke.isActive;h.name=u.stroke.brush;h.c=u.stroke.color;h.w=u.stroke.weight;h.cr=u.stroke.clip;y.isActive=u.hatch.isActive;y.hatchingParams=u.hatch.hatchingParams;y.hatchingBrush=u.hatch.hatchingBrush;v.isActive=u.fill.isActive;v.color=u.fill.color;v.opacity=u.fill.opacity;v.bleed_strength=u.fill.bleed_strength;-v.texture_strength=u.fill.texture_strength;v.border_strength=u.fill.border_strength;x.rotation=u.others.rotate}function O(a,b){E();r.list.set(a,{gen:b});r.current=a;r.refresh()}function Z(a){for(let b of da){let c=h.list.get(b[0]).param;c.weight*=a;c.vibration*=a;c.spacing*=a}ea=a}function fa(a=5,b=45,c={rand:!1,continuous:!1,gradient:!1}){y.isActive=!0;y.hatchingParams=[a,b,c]}function ha(a=0){Q=f.constrain(a,0,1);F=[]}function R(a,b,c){F.push([a,b,c])}function ia(a){a===CLOSE&&(F.push(F[0]),F.push(F[1]));-a=ja(F,Q,a===CLOSE?!0:!1);if(v.isActive||y.isActive)a.fill(),a.hatch();h.isActive&&a.draw();F=!1}function ja(a,b=.5,c=!1){let d=new T(0===b?"segments":"curve");if(a&&0<a.length){let D=0,I,B,L;for(let z=0;z<a.length-1;z++)if(0<b&&z<a.length-2){var e=a[z],g=a[z+1],k=a[z+2],p=dist(e[0],e[1],g[0],g[1]),n=dist(g[0],g[1],k[0],k[1]),q=S(e[0],e[1],g[0],g[1]);k=S(g[0],g[1],k[0],k[1]);let G=b*Math.min(Math.min(p,n),.5*Math.min(p,n));var A=Math.max(p,n),C=p-G,w=n-G;if(Math.floor(q)===Math.floor(k))C=c?0===z?-0:n-L:n,d.addSegment(q,c?0===z?0:p-D:p-D,e[2],!0),z===a.length-3&&d.addSegment(k,C,g[2],!0),D=0,0===z&&(I=p,L=G,B=a[1],D=0);else{p={x:g[0]-G*f.cos(-q),y:g[1]-G*f.sin(-q)};let J={x:p.x+A*f.cos(-q+90),y:p.y+A*f.sin(-q+90)};n={x:g[0]+G*f.cos(-k),y:g[1]+G*f.sin(-k)};A={x:n.x+A*f.cos(-k+90),y:n.y+A*f.sin(-k+90)};A=aa(p,J,n,A,!0);A=dist(p.x,p.y,A.x,A.y);n=dist(p.x,p.y,n.x,n.y)/2;n=180/Math.PI*Math.PI*A*2*Math.asin(n/A)*2/360;w=z===a.length-3?c?I-G:w:0;d.addSegment(q,c?0===z?0:C-D:C-D,e[2],!0);d.addSegment(q,-n,e[2],!0);d.addSegment(k,w,g[2],!0);D=G;0===z&&(I=C,L=G,B=[p.x,p.y])}z==a.length-3&&d.endPlot(k,g[2],!0)}else 0===b&&(0===z&&c&&a.pop(),g=a[z],q=a[z+1],e=dist(g[0],g[1],q[0],q[1]),g=S(g[0],g[1],q[0],q[1]),d.addSegment(g,e,1,!0),z==a.length-2&&d.endPlot(g,1,!0));d.origin=c&&0!==b?B:a[0]}return d}function ka(a,b,c,d){v.opacity=4>arguments.length?3>arguments.length?b:1:d;v.color=3>arguments.length?color(a):color(a,b,c);v.isActive=!0}function la(a,b="out"){v.bleed_strength=f.constrain(a,0,.6);v.direction=-b}function ma(a=.4,b=.4){v.texture_strength=f.constrain(a,0,1);v.border_strength=f.constrain(b,0,1)}let l,Y=!1;p5.prototype.registerMethod("afterSetup",()=>E());const f={source:()=>random(),random(a=0,b=1){return 1===arguments.length?this.map(this.source(),0,1,0,a):this.map(this.source(),0,1,a,b)},randInt(a,b){return Math.floor(this.random(a,b))},weightedRand(a){let b,c,d=[];for(b in a)for(c=0;c<10*a[b];c++)d.push(b);return d[Math.floor(this.source()*d.length)]},map(a,b,c,d,e,g=!1){a=d+(a-b)/(c-b)*-(e-d);return g?d<e?this.constrain(a,d,e):this.constrain(a,e,d):a},constrain(a,b,c){return Math.max(Math.min(a,c),b)},cos(a){return this.c[Math.floor((a%360+360)%360*4)]},sin(a){return this.s[Math.floor((a%360+360)%360*4)]},isPrecalculationDone:!1,preCalculation(){if(!this.isPrecalculationDone){var a=2*Math.PI/1440;this.c=new Float64Array(1440);this.s=new Float64Array(1440);for(let b=0;1440>b;b++){const c=b*a;f.c[b]=Math.cos(c);f.s[b]=Math.sin(c)}this.isPrecalculationDone=!0}},isNumber:a=>!isNaN(a),-toDegrees:a=>(("radians"===angleMode()?180*a/Math.PI:a)%360+360)%360};f.preCalculation();const u={field:{},stroke:{},hatch:{},fill:{},others:{}},x={translation:[0,0],rotation:0,rotate(a=0){x.rotation=f.toDegrees(a)},trans(){return this.translation=[l._renderer.uMVMatrix.mat4[12],l._renderer.uMVMatrix.mat4[13]]}};var W=1;var oa=a=>W*=a;const t={loaded:!1,isBlending:!1,isCaching:!0,currentColor:new Float32Array(3),load(){this.mask=createGraphics(l.width,l.height);this.mask.pixelDensity(l.pixelDensity());-this.mask.clear();this.mask.noSmooth();this.mask.angleMode(DEGREES);m.mask=this.mask;t.loaded||(this.frag=this.frag.replace('#include "spectral.glsl"',this.glsl()));this.shader=l.createShader(this.vert,this.frag);t.loaded=!0;this.noBlend=createGraphics(l.width,l.height);this.noBlend.pixelDensity(l.pixelDensity());this.noBlend.noSmooth();this.noBlend.clear();this.noBlend.angleMode(DEGREES);this.mask2=createGraphics(l.width,l.height,WEBGL);this.mask2.pixelDensity(l.pixelDensity());this.mask2.clear();-this.mask2.angleMode(DEGREES)},getPigment(a){a=a.levels;let b=new Float32Array(3);b[0]=a[0]/255;b[1]=a[1]/255;b[2]=a[2]/255;return b},reDraw(){l.push();l.translate(-x.trans()[0],-x.trans()[1]);l.image(t.noBlend,-l.width/2,-l.height/2);t.noBlend.clear();l.pop()},reBlend(){ba();h.set("marker","white",1);h.line(-10,-10,-5,-5);ca()},color1:new Float32Array(3),color2:new Float32Array(3),blending1:!1,blending2:!1,blend(a=!1,b=!1,c=!1,d=!1){this.isBlending=c?this.blending1:this.blending2;this.currentColor=-c?this.color1:this.color2;if(!this.isBlending)if(a)this.currentColor=this.getPigment(a),c?(this.blending1=!0,this.color1=this.currentColor):(this.blending2=!0,this.color2=this.currentColor);else{l.push();l.translate(-x.trans()[0],-x.trans()[1]);l.image(this.noBlend,-l.width/2,-l.height/2);this.noBlend.clear();l.pop();return}if((a?this.getPigment(a):this.currentColor).toString()!==this.currentColor.toString()||b||!this.isCaching)l.push(),l.translate(-x.trans()[0],-x.trans()[1]),l.image(this.noBlend,--l.width/2,-l.height/2),this.noBlend.clear(),l.shader(this.shader),this.shader.setUniform("addColor",this.currentColor),this.shader.setUniform("source",l._renderer),this.shader.setUniform("active",d),this.shader.setUniform("random",[f.random(),f.random(),f.random()]),d=c?this.mask2:this.mask,this.shader.setUniform("mask",d),l.fill(0,0,0,0),l.noStroke(),l.rect(-l.width/2,-l.height/2,l.width,l.height),l.pop(),d.clear(),b||(this.currentColor=this.getPigment(a),c?this.color1=this.currentColor:this.color2=-this.currentColor);b&&(this.isBlending=!1,c?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*5.,z,10.*random.x,o),c=v(vVertTexCoord*5.,z,10.*random.y,o),t=v(vVertTexCoord*5.,z,10.*random.z,o),w=.25+.25*v(vVertTexCoord*4.,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(){return"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));}"}};-p5.prototype.registerMethod("afterSetup",()=>t.blend(!1,!0));p5.prototype.registerMethod("afterSetup",()=>t.blend(!1,!0,!0));p5.prototype.registerMethod("post",()=>t.blend(!1,!0));p5.prototype.registerMethod("post",()=>t.blend(!1,!0,!0));const r={isActive:!1,list:new Map,current:"",step_length(){return Math.min(l.width,l.height)/1E3},create(){this.R=.01*l.width;this.left_x=-1*l.width;this.top_y=-1*l.height;this.num_columns=Math.round(2*l.width/this.R);this.num_rows=Math.round(2*l.height/this.R);this.addStandard()},-flow_field(){return this.list.get(this.current).field},refresh(a=0){this.list.get(this.current).field=this.list.get(this.current).gen(a,this.genField())},genField(){let a=Array(this.num_columns);for(let b=0;b<this.num_columns;b++)a[b]=new Float64Array(this.num_rows);return a},addStandard(){O("curved",function(a,b){let c=f.randInt(-25,-15);0==f.randInt(0,100)%2&&(c*=-1);for(let e=0;e<r.num_columns;e++)for(let g=0;g<r.num_rows;g++){var d=noise(.02*e+.03*a,.02*g+.03*a);d=f.map(d,0,1,-c,c);b[e][g]=3*-d}return b});O("truncated",function(a,b){a=f.randInt(-25,-15)+5*f.sin(a);0==f.randInt(0,100)%2&&(a*=-1);let c=f.randInt(5,10);for(let e=0;e<r.num_columns;e++)for(let g=0;g<r.num_rows;g++){var d=noise(.02*e,.02*g);d=Math.round(f.map(d,0,1,-a,a)/c)*c;b[e][g]=4*d}return b});O("zigzag",function(a,b){a=f.randInt(-30,-15)+Math.abs(44*f.sin(a));0==f.randInt(0,100)%2&&(a*=-1);let c=0;for(let d=0;d<r.num_columns;d++){for(let e=0;e<r.num_rows;e++)b[d][e]=c,c+=a,a*=-1;c+=a;a*=-1}return b});O("waves",function(a,-b){let c=f.randInt(10,15)+5*f.sin(a);a=f.randInt(3,6)+3*f.cos(a);let d=f.randInt(20,35);for(let e=0;e<r.num_columns;e++)for(let g=0;g<r.num_rows;g++){let k=f.sin(c*e)*d*f.cos(g*a)+f.randInt(-3,3);b[e][g]=k}return b});O("seabed",function(a,b){let c=f.random(.4,.8),d=f.randInt(18,26);for(let g=0;g<r.num_columns;g++)for(let k=0;k<r.num_rows;k++){var e=f.randInt(15,20);e=d*f.sin(c*k*g+e);b[g][k]=1.1*e*f.cos(a)}return b})}};class U{constructor(a,b){this.update(a,b);this.plotted=0}update(a,b){this.x=a;-this.y=b;r.isActive&&(this.x_offset=this.x-r.left_x+x.trans()[0],this.y_offset=this.y-r.top_y+x.trans()[1],this.column_index=Math.round(this.x_offset/r.R),this.row_index=Math.round(this.y_offset/r.R))}reset(){this.plotted=0}isIn(){return r.isActive?0<=this.column_index&&0<=this.row_index&&this.column_index<r.num_columns&&this.row_index<r.num_rows:this.isInCanvas()}isInCanvas(){let a=l.width,b=l.height;return this.x>=-a-x.trans()[0]&&this.x<=a-x.trans()[0]&&this.y>=-b-x.trans()[1]&&this.y<=b-x.trans()[1]}angle(){return this.isIn()&&-r.isActive?r.flow_field()[this.column_index][this.row_index]:0}moveTo(a,b,c=r.step_length(),d=!0){if(this.isIn()){let g;if(!d){g=f.cos(-b);var e=f.sin(-b)}for(let k=0;k<a/c;k++){d&&(e=this.angle(),g=f.cos(e-b),e=f.sin(e-b));let p=c*g,n=c*e;this.plotted+=c;this.update(this.x+p,this.y+n)}}else this.plotted+=c}plotTo(a,b,c,d){if(this.isIn()){d=1/d;for(let g=0;g<b/c;g++){var e=this.angle();let k=a.angle(this.plotted),p=c*f.cos(e-k);e=c*f.sin(e-k);this.plotted+=c*d;this.update(this.x+p,this.y+e)}}else this.plotted+=-c/scale}}let ea=1;const h={isActive:!0,list:new Map,c:"#000000",w:1,cr:null,name:"HB",add:(a,b)=>{const c="marker"===b.type||"custom"===b.type||"image"===b.type;c||"spray"===b.type||(b.type="default");"image"===b.type&&(V.add(b.image.src),b.tip=()=>h.mask.image(V.tips.get(h.p.image.src),-h.p.weight/2,-h.p.weight/2,h.p.weight,h.p.weight));b.blend=c&&!1!==b.blend||b.blend?!0:!1;h.list.set(a,{param:b,colors:[],buffers:[]})},set(a,b,c=1){h.setBrush(a);h.c=b;h.w=c;h.isActive=!0},setBrush(a){h.name=a},-setColor(a,b,c){0<arguments.length&&(h.c=2>arguments.length?a:[a,b,c]);h.isActive=!0},setWeight(a){h.w=a},clip(a){h.cr=a},noClip(){h.cr=null},line(a,b,c,d){E();let e=dist(a,b,c,d);0!=e&&(h.initializeDrawingState(a,b,e,!1,!1),a=S(a,b,c,d),h.draw(a,!1))},flowLine(a,b,c,d){E();h.initializeDrawingState(a,b,c,!0,!1);h.draw(f.toDegrees(d),!1)},flowShape(a,b,c,d){E();h.initializeDrawingState(b,c,a.length,!0,a);h.draw(d,!0)},spacing(){this.p=this.list.get(this.name).param;return"default"===this.p.type||"spray"===-this.p.type?this.p.spacing/this.w:this.p.spacing},initializeDrawingState(a,b,c,d,e){this.position=new U(a,b);this.length=c;this.flow=d;(this.plot=e)&&e.calcIndex(0)},draw(a,b){b||(this.dir=a);this.pushState();const c=this.spacing(),d=b?Math.round(this.length*a/c):Math.round(this.length/c);for(let e=0;e<d;e++)this.tip(),b?this.position.plotTo(this.plot,c,c,a):this.position.moveTo(c,a,c,this.flow);this.popState()},drawTip(a){this.pushState(!0);this.tip(a);this.popState(!0)},pushState(a=!1){this.p=this.list.get(this.name).param;-if(!a){this.a="custom"!==this.p.pressure.type?f.random(-1,1):0;this.b="custom"!==this.p.pressure.type?f.random(1,1.5):0;this.cp="custom"!==this.p.pressure.type?f.random(3,3.5):f.random(-.2,.2);const [b,c]=this.p.pressure.min_max;this.min=b;this.max=c}this.c=l.color(this.c);this.mask=this.p.blend?"image"===this.p.type?t.mask2:t.mask:t.noBlend;x.trans();this.mask.push();this.mask.noStroke();"image"===this.p.type?this.mask.translate(x.translation[0],x.translation[1]):this.mask.translate(x.translation[0]+-l.width/2,x.translation[1]+l.height/2);this.mask.rotate(-x.rotation);this.mask.scale(W);this.p.blend&&("image"!==this.p.type?t.blend(this.c):t.blend(this.c,!1,!0),a||this.markerTip())},popState(a=!1){this.p.blend&&!a&&this.markerTip();this.mask.pop()},tip(a=!1){a=a?a:this.calculatePressure();let b=this.calculateAlpha(a);this.applyColor(b);if(this.isInsideClippingArea())switch(this.p.type){case "spray":this.drawSpray(a);break;case "marker":this.drawMarker(a);break;case "custom":case "image":this.drawCustomOrImage(a,-b);break;default:this.drawDefault(a)}},calculatePressure(){return this.plot?this.simPressure()*this.plot.pressure(this.position.plotted):this.simPressure()},simPressure(){return"custom"===this.p.pressure.type?f.map(this.p.pressure.curve(this.position.plotted/this.length)+this.cp,0,1,this.min,this.max,!0):this.gauss()},gauss(a=.5+h.p.pressure.curve[0]*h.a,b=1-h.p.pressure.curve[1]*h.b,c=h.cp,d=h.min,e=h.max){return f.map(1/(1+Math.pow(Math.abs((this.position.plotted-a*this.length)/(b*this.length/2)),-2*c)),0,1,d,e)},calculateAlpha(a){return Math.floor(("default"!==this.p.type&&"spray"!==this.p.type?this.p.opacity/this.w:this.p.opacity)*Math.pow(a,"marker"===this.p.type?.7:1.5))},applyColor(a){this.p.blend?this.mask.fill(255,0,0,a/2):(this.c.setAlpha(a),this.mask.fill(this.c))},isInsideClippingArea(){if(h.cr)return this.position.x>=h.cr[0]&&this.position.x<=h.cr[2]&&this.position.y>=h.cr[1]&&this.position.y<=h.cr[3];let a=.55*l.width,b=.55*l.height;return this.position.x>=-a-x.trans()[0]&&this.position.x<=-a-x.trans()[0]&&this.position.y>=-b-x.trans()[1]&&this.position.y<=b-x.trans()[1]},drawSpray(a){let b=this.w*this.p.vibration*a+this.w*randomGaussian()*this.p.vibration/3,c=this.p.weight*f.random(.9,1.1);a=this.p.quality/a;for(let d=0;d<a;d++){let e=f.random(.9,1.1),g=e*b*f.random(-1,1),k=f.random(-1,1);this.mask.circle(this.position.x+g,this.position.y+k*Math.sqrt(Math.pow(e*b,2)-Math.pow(g,2)),c)}},drawMarker(a,b=!0){let c=b?this.w*this.p.vibration:0,d=b?c*f.random(-1,1):0;b=b?c*f.random(-1,1):-0;this.mask.circle(this.position.x+d,this.position.y+b,this.w*this.p.weight*a)},drawCustomOrImage(a,b,c=!0){this.mask.push();let d=c?this.w*this.p.vibration:0,e=c?d*f.random(-1,1):0;c=c?d*f.random(-1,1):0;this.mask.translate(this.position.x+e,this.position.y+c);this.adjustSizeAndRotation(this.w*a,b);this.p.tip(this.mask);this.mask.pop()},drawDefault(a){let b=this.w*this.p.vibration*(this.p.definition+(1-this.p.definition)*randomGaussian()*this.gauss(.5,.9,5,.2,1.2)/a);.4<f.random(0,this.p.quality)&&-this.mask.circle(this.position.x+.7*b*f.random(-1,1),this.position.y+b*f.random(-1,1),a*this.p.weight*f.random(.85,1.15))},adjustSizeAndRotation(a,b){this.mask.scale(a);"image"===this.p.type&&(this.p.blend?this.mask.tint(255,0,0,b/2):this.mask.tint(this.mask.red(this.c),this.mask.green(this.c),this.mask.blue(this.c),b));"random"===this.p.rotate?this.mask.rotate(f.randInt(0,360)):"natural"===this.p.rotate&&(a=(this.plot?-this.plot.angle(this.position.plotted):-this.dir)+(this.flow?this.position.angle():-0),this.mask.rotate(a))},markerTip(){if(this.isInsideClippingArea()){let b=this.calculatePressure();var a=this.calculateAlpha(b);this.mask.fill(255,0,0,a/1.5);if("marker"===h.p.type)for(a=1;5>a;a++)this.drawMarker(b*a/5,!1);else if("custom"===h.p.type||"image"===h.p.type)for(let c=1;5>c;c++)this.drawCustomOrImage(b*c/5,a,!1)}}},V={tips:new Map,add(a){this.tips.set(a,!1)},imageToWhite(a){a.loadPixels();for(let b=0;b<4*a.width*a.height;b+=4){let c=(a.pixels[b]+a.pixels[b+1]+a.pixels[b+2])/3;a.pixels[b]=-a.pixels[b+1]=a.pixels[b+2]=255;a.pixels[b+3]=255-c}a.updatePixels()},load(){for(let a of this.tips.keys()){let b=loadImage(a,()=>V.imageToWhite(b));this.tips.set(a,b)}}},y={isActive:!1,hatchingParams:[5,45,{}],hatchingBrush:!1,hatch(a){let b=y.hatchingParams[0],c=y.hatchingParams[1],d=y.hatchingParams[2],e=h.c,g=h.name,k=h.w,p=h.isActive;y.hatchingBrush&&h.set(y.hatchingBrush[0],y.hatchingBrush[1],y.hatchingBrush[2]);c=f.toDegrees(c)%180;let n=Infinity,q=-Infinity,A=Infinity,C=-Infinity;var w=K=>-{for(let H of K.a)n=H[0]<n?H[0]:n,q=H[0]>q?H[0]:q,A=H[1]<A?H[1]:A,C=H[1]>C?H[1]:C};Array.isArray(a)||(a=[a]);for(var D of a)w(D);D=new P([[n,A],[q,A],[q,C],[n,C]]);let I=90>=c&&0<=c?A:C;var B=d.gradient?map(d.gradient,0,1,1,1.1,!0):1;w=[];let L=0,z=b,G=K=>({point1:{x:n+z*K*f.cos(-c+90),y:I+z*K*f.sin(-c+90)},point2:{x:n+z*K*f.cos(-c+90)+f.cos(-c),y:I+z*K*f.sin(-c+90)+f.sin(-c)}});for(;0<D.intersect(G(L)).length;){let K=[];for(var J of a)K.push(J.intersect(G(L)));w[L]=K.flat().sort((H,X)=>H.x===X.x?-H.y-X.y:H.x-X.x);z*=B;L++}a=[];for(var M of w)"undefined"!==typeof M[0]&&a.push(M);M=d.rand?d.rand:0;for(J=0;J<a.length;J++)for(w=a[J],D=0<J&&d.continuous,B=0;B<w.length-1;B+=2)0!==M&&(w[B].x+=M*b*f.random(-10,10),w[B].y+=M*b*f.random(-10,10),w[B+1].x+=M*b*f.random(-10,10),w[B+1].y+=M*b*f.random(-10,10)),h.line(w[B].x,w[B].y,w[B+1].x,w[B+1].y),D&&h.line(a[J-1][1].x,a[J-1][1].y,w[B].x,w[B].y);h.set(g,e,k);h.isActive=p}};class P{constructor(a,b=!1){this.a=a;this.vertices=a.map(c=>({x:c[0],y:c[1]}));-b&&(this.vertices=a);this.sides=this.vertices.map((c,d,e)=>[c,e[(d+1)%e.length]])}intersect(a){let b=`${a.point1.x},${a.point1.y}-${a.point2.x},${a.point2.y}`;if(this._intersectionCache&&this._intersectionCache[b])return this._intersectionCache[b];let c=[];for(let d of this.sides){let e=aa(a.point1,a.point2,d[0],d[1]);!1!==e&&c.push(e)}this._intersectionCache||(this._intersectionCache={});return this._intersectionCache[b]=c}draw(a=!1,b,c){let d=h.isActive;a&&h.set(a,b,c);if(h.isActive){E();for(let e of this.sides)h.line(e[0].x,-e[0].y,e[1].x,e[1].y)}h.isActive=d}fill(a=!1,b,c,d,e,g){let k=v.isActive;a&&(ka(a,b),la(c,g),ma(d,e));v.isActive&&(E(),v.fill(this));v.isActive=k}hatch(a=!1,b,c){let d=y.isActive;a&&fa(a,b,c);y.isActive&&(E(),y.hatch(this));y.isActive=d}}class T{constructor(a){this.segments=[];this.angles=[];this.pres=[];this.type=a;this.dir=0;this.calcIndex(0);this.pol=!1}addSegment(a=0,b=0,c=1,d=!1){0<this.angles.length&&this.angles.splice(-1);a=d?(a%360+360)%360:f.toDegrees(a);this.angles.push(a);this.pres.push(c);-this.segments.push(b);this.length=this.segments.reduce((e,g)=>e+g,0);this.angles.push(a)}endPlot(a=0,b=1,c=!1){a=c?(a%360+360)%360:f.toDegrees(a);this.angles.splice(-1);this.angles.push(a);this.pres.push(b)}rotate(a){this.dir=f.toDegrees(a)}pressure(a){return a>this.length?this.pres[this.pres.length-1]:this.curving(this.pres,a)}angle(a){if(a>this.length)return this.angles[this.angles.length-1];this.calcIndex(a);return"curve"===this.type?this.curving(this.angles,a)+this.dir:this.angles[this.index]+-this.dir}curving(a,b){let c=a[this.index];a=a[this.index+1];"undefined"==typeof a&&(a=c);180<Math.abs(a-c)&&(a>c?a=-(360-a):c=-(360-c));return f.map(b-this.suma,0,this.segments[this.index],c,a,!0)}calcIndex(a){this.index=-1;let b=this.suma=0;for(;b<=a;)this.suma=b,b+=this.segments[this.index+1],this.index++}genPol(a,b,c=1,d=!1){E();var e=0;let g=9999;for(var k of this.segments)k*=c,0!==k&&(e=Math.max(e,k),g=Math.min(g,k));c=h.spacing();k=[];let p=f.constrain(v.bleed_strength,.05,1);d=(e+g)*(d?.03:-v.isAnimated?.25:p);this.calcIndex(0);a=new U(a,b);b=Math.round(this.length/c);for(e=0;e<b;e++)a.x&&(k[Math.floor(a.plotted/d)]=[a.x,a.y]),a.plotTo(this,c,c,1);this.calcIndex(0);return new P(k)}draw(a,b,c){h.isActive&&(E(),this.origin&&(a=this.origin[0],b=this.origin[1],c=1),h.flowShape(this,a,b,c))}fill(a,b,c){v.isActive&&(E(),this.origin&&(a=this.origin[0],b=this.origin[1],c=1),this.pol||(this.pol=this.genPol(a,b,c)),this.pol.fill())}hatch(a,b,c){y.isActive&&(E(),this.origin&&(a=this.origin[0],-b=this.origin[1],c=1),this.pol||(this.pol=this.genPol(a,b,c,!0)),this.pol.hatch())}}let F=!1,Q;const v={isActive:!1,isAnimated:!1,color:"#002185",opacity:80,bleed_strength:.07,texture_strength:.4,border_strength:.4,fill(a){this.polygon=a;this.v=a.a.map(c=>createVector(c[0],c[1]));const b=this.v.length*f.random(.4);v.m=this.v.map((c,d)=>{c=f.random(.8,1.2)*this.bleed_strength;return d<b?constrain(2*c,0,.9):c});a=f.randInt(0,this.v.length);this.v=[...this.v.slice(a),...this.v.slice(0,a)];(new na(this.v,-this.m,this.calcCenter(),[],!0)).fill(this.color,int(map(this.opacity,0,155,0,20,!0)),this.texture_strength)},calcCenter(){let a=0,b=0;for(let c=0;c<this.v.length;++c)a+=this.v[c].x,b+=this.v[c].y;a/=this.v.length;b/=this.v.length;return createVector(a,b)}};class na{constructor(a,b,c,d,e=!1){this.pol=new P(a,!0);this.v=a;this.dir=d;this.m=b;this.midP=c;this.size=p5.Vector.sub(this.midP,this.v[0]).mag();if(e)for(a="radians"===angleMode()?Math.PI/180:1,b=0;b<this.v.length;b++){c=this.v[b];d=this.v[(b+-1)%this.v.length];e=p5.Vector.sub(d,c);var g=e.copy();g.rotate(90*a);e={point1:{x:c.x+e.x/2,y:c.y+e.y/2},point2:{x:c.x+e.x/2+g.x,y:c.y+e.y/2+g.y}};g=0;for(let k of v.polygon.intersect(e)).01<(d.x-c.x)*(k.y-c.y)-(d.y-c.y)*(k.x-c.x)&&g++;this.dir[b]=0===g%2?!0:!1}}grow(a,b=!1){const c=[],d=[],e=[];let g=.2<=a&&10<=this.v.length?Math.floor(a*this.v.length):this.v.length;const k=C=>{const w=randomGaussian(.5,.1);return C+.1*(w-.5)},p="radians"===angleMode()?Math.PI/180:1;for(let C=0;C<g;C++){var n=this.v[C],-q=this.v[(C+1)%g];let w=.1===a?.1>=v.bleed_strength?.25:.75:this.m[C];b&&(w*=-.5);c.push(n);d.push(k(w));let D=p5.Vector.lerp(n,q,constrain(randomGaussian(.5,.2),.1,.9));n=p5.Vector.sub(q,n);q=n.copy().normalize();let I=this.dir[C];var A="out"==v.direction?90:-90;A=(I?A:-A)+45*randomGaussian(0,.4);q.rotate(A*p);q.mult(randomGaussian(.5,.2)*random(.6,1.4)*n.mag()*w);D.add(q);c.push(D);d.push(k(w));e.push(I,I)}return new na(c,d,this.midP,e)}fill(a,b,c){const d=b/5+c*b/6,e=b/4+c*b/3,g=b/7+c*b/3;b/=5;-c*=3;x.trans();t.blend(a,!1,!1,!0);t.mask.push();t.mask.noStroke();t.mask.translate(x.translation[0]+l.width/2,x.translation[1]+l.height/2);t.mask.rotate(x.rotation);t.mask.scale(W);a=this.grow();let k=a.grow().grow(.9),p=k.grow(.75),n=this.grow(.85);for(let q=0;24>q;q++){if(6===q||12===q||18===q)a=a.grow(),k=k.grow(.75),p=p.grow(.75),n=n.grow(.1,!0);a.grow().layer(q,b);n.grow(.1,!0).grow(.1).layer(q,g,!1);k.grow(.1).grow(.1).layer(q,e,!1);p.grow(.8).grow(.1).layer(q,d,!1);0!==c&&a.erase(c)}t.mask.pop()}layer(a,-b,c=!0){t.mask.fill(255,0,0,b);c?(t.mask.stroke(255,0,0,.5+1.5*v.border_strength),t.mask.strokeWeight(f.map(a,0,24,6,.5))):t.mask.noStroke();t.mask.beginShape();for(let d of this.v)t.mask.vertex(d.x,d.y);t.mask.endShape(CLOSE)}erase(a){const b=f.random(80,110),c=this.size/2,d=.025*this.size,e=.19*this.size;t.mask.erase(3.5*a,0);for(a=0;a<b;a++){const g=this.midP.x+randomGaussian(0,c),k=this.midP.y+randomGaussian(0,c),p=f.random(d,e);t.mask.circle(g,k,p)}t.mask.noErase()}}p5.RendererGL.prototype.erase=-function(a,b){this._isErasing||(this._cachedBlendMode=this.curBlendMode,this._isErasing=!0,this.blendMode("destination-out"),this._cachedFillStyle=this.curFillColor.slice(),this.curFillColor=[1,1,1,a/255],this._cachedStrokeStyle=this.curStrokeColor.slice(),this.curStrokeColor=[1,1,1,b/255])};p5.RendererGL.prototype.noErase=function(){if(this._isErasing){this.curFillColor=this._cachedFillStyle.slice();this.curStrokeColor=this._cachedStrokeStyle.slice();let a=this.curBlendMode;this.blendMode(this._cachedBlendMode);-this._cachedBlendMode=a;this._isErasing=!1;this._applyBlendMode()}};const pa="weight vibration definition quality opacity spacing pressure type tip rotate".split(" "),da=[["pen",[.35,.12,.5,8,200,.3,{curve:[.15,.2],min_max:[1.3,1]}]],["rotring",[.2,.05,1,3,250,.15,{curve:[.05,.2],min_max:[1.2,.95]}]],["2B",[.35,.5,.1,8,180,.2,{curve:[.15,.2],min_max:[1.3,1]}]],["HB",[.3,.5,.4,4,180,.25,{curve:[.15,.2],min_max:[1.2,.9]}]],["2H",[.2,.4,.3,2,150,.2,{curve:[.15,.2],min_max:[1.2,.9]}]],["cpencil",[.4,-.6,.8,7,120,.15,{curve:[.15,.2],min_max:[.95,1.15]}]],["charcoal",[.5,2,.8,300,110,.06,{curve:[.15,.2],min_max:[1.15,.85]}]],["hatch_brush",[.2,.4,.3,2,150,.15,{curve:[.5,.7],min_max:[1,1.5]}]],["spray",[.3,12,15,40,120,.65,{curve:[0,.1],min_max:[.15,1.2]},"spray"]],["marker",[2.5,.12,null,null,30,.4,{curve:[.35,.25],min_max:[1.35,1]},"marker"]],["marker2",[2.5,.12,null,null,25,.35,{curve:[.35,.25],min_max:[1.15,.95]},"custom",function(a){let b=ea;a.rect(-1.5*b,-1.5*b,3*b,3*b);a.rect(1*b,1*b,1*b,-1*b)},"natural"]]];for(let a of da){let b={};for(let c=0;c<a[1].length;c++)b[pa[c]]=a[1][c];h.add(a[0],b)}m.config=function(a={}){a.R&&(f.source=a.R)};m.load=N;m.preload=function(){V.load()};m.colorCache=function(a=!0){t.isCaching=a};m.scaleBrushes=Z;m.push=ba;m.pop=ca;m.reDraw=t.reDraw;m.reBlend=t.reBlend;m.rotate=x.rotate;m.scale=oa;m.addField=O;m.field=function(a){E();r.isActive=!0;r.current=a};m.noField=function(){r.isActive=!1};m.refreshField=function(a){r.refresh(a)};m.listFields=function(){return Array.from(r.list.keys())};-m.add=h.add;m.box=function(){return Array.from(h.list.keys())};m.set=h.set;m.pick=h.setBrush;m.clip=h.clip;m.noClip=h.noClip;m.point=function(a,b,c){E();h.position=new U(a,b);h.drawTip(c)};m.stroke=h.setColor;m.strokeWeight=h.setWeight;m.noStroke=function(){h.isActive=!1};m.fill=ka;m.bleed=la;m.fillTexture=ma;m.noFill=function(){v.isActive=!1};m.fillAnimatedMode=function(a){v.isAnimated=a};m.line=h.line;m.flowLine=h.flowLine;m.plot=h.flowShape;m.rect=function(a,b,c,d,e=CORNER){e==CENTER&&(a-=c/2,-b-=d/2);r.isActive?(ha(0),R(a,b),R(a+c,b),R(a+c,b+d),R(a,b+d),ia(CLOSE)):(a=new P([[a,b],[a+c,b],[a+c,b+d],[a,b+d]]),a.fill(),a.hatch(),a.draw())};m.circle=function(a,b,c,d=!1){let e=new T("curve");var g=Math.PI*c/2;let k=random(0,360);e.addSegment(0+k+(d?f.random(-1,1):0),g+(d?f.random(-1,1):0),1,!0);e.addSegment(-90+k+(d?f.random(-1,1):0),g+(d?f.random(-1,1):0),1,!0);e.addSegment(-180+k+(d?f.random(-1,1):0),g+(d?f.random(-1,1):0),1,!0);e.addSegment(-270+k+(d?f.random(-1,1):0),g+(d?f.random(-1,1):-0),1,!0);g=d?f.randInt(-5,5):0;d&&e.addSegment(0+k,Math.PI/180*g*c,!0);e.endPlot(g+k,1,!0);e.fill(a-c*f.sin(k),b-c*f.cos(-k),1);e.hatch(a-c*f.sin(k),b-c*f.cos(-k),1);e.draw(a-c*f.sin(k),b-c*f.cos(-k),1)};m.polygon=function(a){a=new P(a);a.fill();a.hatch();a.draw()};m.spline=function(a,b=.5){ja(a,b).draw()};m.beginShape=ha;m.vertex=R;m.endShape=ia;m.beginStroke=function(a,b,c){Q=[b,c];F=new T(a)};m.segment=function(a,b,c){F.addSegment(a,b,c)};m.endStroke=function(a,b){F.endPlot(a,b);F.draw(Q[0],Q[1],-1);F=!1};m.hatchArray=y.hatch;m.hatch=fa;m.setHatch=function(a,b="black",c=1){y.hatchingBrush=[a,b,c]};m.noHatch=function(){y.isActive=!1;y.hatchingBrush=!1};m.Polygon=P;m.Plot=T;m.Position=U});\ No newline at end of file+/* p5.brush.js v1.0.5 - 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}('(1j(m,N){"6H"===3p 4i&&"4j"!==3p 6I?N(4i):"1j"===3p 4k&&4k.6J?4k(["4i"],N):(m=m||5u,N(m.3F={}))})(j,1j(m){1j N(a=!1,b=!1){Q&&Z(!1);g=a?a:6K.5u;Q||(Q=!0,u.5v());r.39(b);aa(g.1x/5w)}1j Z(a=!0){Q&&(r.1d.3G(),r.2F.3G(),r.1N.3G(),a&&3F.39())}1j E(){Q||N()}1j ba(a,b,c,d,e=!1){1a h=a.x;a=a.y;1q l=b.x,n=b.y;b=c.x;c=c.y;1q q=d.x,t=d.y;1n(h===l&&a===n||b===q&&c===t)1c!1;d=l-h;l=n-a;n=q-b;t-=c;q=t*d-n*l;1n(0===q)1c!1;n=(n*(a-c)-t*(h-b))/q;b=(d*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[0],l[1]),t=T(e[0],e[1],h[0],h[1]);l=T(h[0],h[1],l[0],l[1]);1a G=b*1g.1E(1g.1E(n,q),.5*1g.1E(n,q));1q x=1g.1f(n,q),A=n-G,p=q-G;1n(1g.1K(t)===1g.1K(l))A=c?0===C?0:q-L:q,d.1Q(t,c?0===C?0:n-D:n-D,e[2],!0),C===a.1l-3&&d.1Q(l,A,h[2],!0),D=0,0===C&&(I=n,L=G,B=a[1],D=0);2u{n={x:h[0]-G*f.1z(-t),y:h[1]-G*f.1w(-t)};1a J={x:n.x+x*f.1z(-t+90),y:n.y+x*f.1w(-t+90)};q={x:h[0]+G*f.1z(-l),y:h[1]+G*f.1w(-l)};x={x:q.x+x*f.1z(-l+90),y:q.y+x*f.1w(-l+90)};x=ba(n,J,q,x,!0);x=g.2O(n.x,n.y,x.x,x.y);q=g.2O(n.x,n.y,q.x,q.y)/2;q=1Z/1g.2p*1g.2p*x*2*1g.6M(q/x)*2/1u;p=C===a.1l-3?c?I-G:p:0;d.1Q(t,c?0===C?0:A-D:A-D,e[2],!0);d.1Q(t,q,e[2],!0);d.1Q(l,p,h[2],!0);D=G;0===C&&(I=A,L=G,B=[n.x,n.y])}C==a.1l-3&&d.3r(l,h[2],!0)}2u 0===b&&(0===C&&c&&a.2v(),h=a[C],t=a[C+1],e=g.2O(h[0],h[1],t[0],t[1]),h=T(h[0],h[1],t[0],t[1]),d.1Q(h,e,1,!0),C==a.1l-2&&d.3r(h,1,!0));d.2m=c&&0!==b?B:a[0]}1c d}1j 4v(a,b,c,d){v.2j=4>3b.1l?3>3b.1l?b:1:d;v.1R=3>3b.1l?g.1R(a):g.1R(a,b,c);v.1h=!0}1j 4w(a,b="2c"){v.2k=f.2l(a,0,.6);v.5z=b}1j 4x(a=.4,b=.4){v.2I=f.2l(a,0,1);v.2J=f.2l(b,0,1)}1a g,Q=!1;2n.2P.3s("4y",()=>E());1y f={2w:()=>g.1i(),1i(a=0,b=1){1c 1===3b.1l?j.1F(j.2w(),0,1,0,a):j.1F(j.2w(),0,1,a,b)},1G(a,b){1c 1g.1K(j.1i(a,b))},6N(a){1a b,c,d=[];1k(b 6O a)1k(c=0;c<10*a[b];c++)d.1r(b);1c d[1g.1K(j.2w()*d.1l)]},1F(a,b,c,d,e,h=!1){a=d+(a-b)/(c-b)*(e-d);1c h?d<e?j.2l(a,d,e):j.2l(a,e,d):a},2l(a,b,c){1c 1g.1f(1g.1E(a,c),b)},1z(a){1c j.c[1g.1K((a%1u+1u)%1u*4)]},1w(a){1c j.s[1g.1K((a%1u+1u)%1u*4)]},4z:!1,5A(){1n(!j.4z){1q a=2*1g.2p/3J;j.c=1v 4A(3J);j.s=1v 4A(3J);1k(1a b=0;3J>b;b++){1y c=b*a;f.c[b]=1g.1z(c);f.s[b]=1g.1w(c)}j.4z=!0}},6P:a=>!6Q(a),2Q:a=>(("5B"===g.2x()?1Z*a/1g.2p:a)%1u+1u)%1u};f.5A();1y w={2t:{},1O:{},1C:{},1o:{},4l:{}},y={2y:[0,0],3a:0,1J(a=0){y.3a=f.2Q(a)},1A(){1c j.2y=[g.4B.5C.4C[12],g.4B.5C.4C[13]]}};1q W=1;1q 5D=a=>W*=a;1y r={4D:!1,3c:!1,4E:!0,2d:1v 3K(3),39(a){j.1d=a?g.3d(g.1x,g.1B):3d(g.1x,g.1B);j.1d.3e(g.3e());j.1d.2R();j.1d.5E();j.1d.2x(g.4F);m.1d=j.1d;r.4D||(j.3L=j.3L.6R(\'#5F "5G.3M"\',j.3M()));j.2z=g.6S(j.5H,j.3L);r.4D=!0;j.1N=a?g.3d(g.1x,g.1B):3d(g.1x,g.1B);j.1N.3e(g.3e());j.1N.5E();j.1N.2R();j.1N.2x(g.4F);j.2F=a?g.3d(g.1x,g.1B,g.5I):3d(g.1x,g.1B,g.5I);j.2F.3e(g.3e());j.2F.2R();j.2F.2x(g.4F)},3N(a){a=a.6T;1a b=1v 3K(3);b[0]=a[0]/1V;b[1]=a[1]/1V;b[2]=a[2]/1V;1c b},4G(){g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+1.),g=v-s,o=v-k,t=v-l;1b u,c,C,D;1n(6Z(70(x,1p(0)))){C=1b(s.x,k.x,l);D=1b(s.y,k.y,l.y);1n(x.x>0.)C=3w(1b(s.x,k.x,l),x.x);1n(x.y>0.)D=3w(1b(s.y,k.y,l.y),x.y);u=1K(C+.5*D+.5);c=1K(D+.5);}2u u=1b(m.x,f.x,e),c=1b(m.y,f.y,e.y);1b b=3w(u,4J.);b=3w((b*51.+2.)*b+c,4J.);b=3w((b*34.+10.)*b,4J.);1b h=b*.71+y,E=1z(h),w=1w(h);1p A=1p(E.x,w),B=1p(E.y,w.y),F=1p(E.z,w.z);1b G=.8-1b(1X(g,g),1X(o,o),1X(t,t));G=1f(G,0.);1b H=G*G,I=H*H,J=1b(1X(A,g),1X(B,o),1X(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));1c 10.9*1X(I,J);}1M v(1b v,1m f){1c 1M(5U(v,1b(1X(1b(.72,.73,.74),v)),f),1);}1m f(1p v,1m x,1m y,1m f){1c 5T(1w(1X(v,1p(x,y)))*f);}3U 5S(){1M s=5V(1d,1W);1n(s.x>0.){1p m=1p(12.4K,78.4L),k=1p(7.4K,58.4L),d=1p(17.4K,3.4L);1m x=f(1W,m.x,m.y,76.4M)*2.-1.,y=f(1W,k.x,k.y,77.4M)*2.-1.,l=f(1W,d.x,d.y,79.4M)*2.-1.;1y 1p z=1p(0);1p o;1M b;1n(4I){1m a=v(1W*5.,z,10.*1i.x,o),c=v(1W*5.,z,10.*1i.y,o),t=v(1W*5.,z,10.*1i.z,o),w=.25+.25*v(1W*4.,z,3.*1i.x,o);b=1M(v(3S.2U,w).2U+1b(a,c,t)*.3V,1);}2u b=1M(3S.2U,1);1n(s.w>.7){1m r=.5*(s.w-.7);b=b*(1.-r)-1M(.5)*r;}1b a=3W(5V(2w,1W).2U,b.2U,.9*s.w);7a=1M(a+.4N*1b(x,y,l),1);}}\',3M(){1c"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5);e+=f[22]*1b(.ch,.ci,6.cj-5);e+=f[23]*1b(.ck,.cl,2.cm-5);e+=f[24]*1b(.cn,.co,1.cq-5);e+=f[25]*1b(.cs,.ct,3.cu-6);e+=f[26]*1b(.cv,.cw,1.cx-6);e+=f[27]*1b(.cy,.cz,0);e+=f[28]*1b(.cA,.cB,0);e+=f[29]*1b(.cC,.cD,0);e+=f[30]*1b(.cE,.cF,0);e+=f[31]*1b(.cG,.cH,0);e+=f[32]*1b(.cI,.cJ,0);e+=f[33]*1b(.cK,.cL,0);e+=f[34]*1b(.cM,6.cN-5,0);e+=f[35]*1b(9.cO-5,3.cP-5,0);e+=f[36]*1b(4.cQ-5,1.cR-5,0);e+=f[37]*1b(2e-5,7.cS-6,0);1c e;}1m 5Z(1m v,1m m,1m s){1m z=m*2o(s,2.);1c z/(v*2o(1.-s,2.)+z);}1b 3W(1b s,1b f,1m e){1b v=4O(s),m=4O(f);1m z[38],o[38];4P(v,z);4P(m,o);1m x=41(z)[1],w=41(o)[1];e=5Z(x,w,e);1m r[38];1k(cT c=0;c<38;c++){1m y=(1.-e)*(2o(1.-z[c],2.)/(2.*z[c]))+e*(2o(1.-o[c],2.)/(2.*o[c]));r[c]=1.+y-4Q(2o(y,2.)+2.*y);}1c 5Y(41(r));}1M 3W(1M s,1M e,1m z){1c 1M(3W(s.2U,e.2U,z),5U(s.w,e.w,z));}"}};2n.2P.3s("4y",()=>r.1I(!1,!0));2n.2P.3s("4y",()=>r.1I(!1,!0,!0));2n.2P.3s("60",()=>r.1I(!1,!0));2n.2P.3s("60",()=>r.1I(!1,!0,!0));1y u={1h:!1,1S:1v 4R,2i:"",61(){1c 1g.1E(g.1x,g.1B)/cU},5v(){j.R=.4N*g.1x;j.62=-1*g.1x;j.63=-1*g.1B;j.2r=1g.2A(2*g.1x/j.R);j.2C=1g.2A(2*g.1B/j.R);j.64()},66(){1c j.1S.2K(j.2i).2t},4m(a=0){j.1S.2K(j.2i).2t=j.1S.2K(j.2i).5x(a,j.67())},67(){1a a=42(j.2r);1k(1a b=0;b<j.2r;b++)a[b]=1v 4A(j.2C);1c a},64(){O("cV",1j(a,b){1a c=f.1G(-25,-15);0==f.1G(0,4S)%2&&(c*=-1);1k(1a e=0;e<u.2r;e++)1k(1a h=0;h<u.2C;h++){1q d=g.68(.43*e+.3V*a,.43*h+.3V*a);d=f.1F(d,0,1,-c,c);b[e][h]=3*d}1c b});O("cW",1j(a,b){a=f.1G(-25,-15)+5*f.1w(a);0==f.1G(0,4S)%2&&(a*=-1);1a c=f.1G(5,10);1k(1a e=0;e<u.2r;e++)1k(1a h=0;h<u.2C;h++){1q d=g.68(.43*e,.43*h);d=1g.2A(f.1F(d,0,1,-a,a)/c)*c;b[e][h]=4*d}1c b});O("cX",1j(a,b){a=f.1G(-30,-15)+1g.4T(44*f.1w(a));0==f.1G(0,4S)%2&&(a*=-1);1a c=0;1k(1a d=0;d<u.2r;d++){1k(1a e=0;e<u.2C;e++)b[d][e]=c,c+=a,a*=-1;c+=a;a*=-1}1c b});O("cY",1j(a,b){1a c=f.1G(10,15)+5*f.1w(a);a=f.1G(3,6)+3*f.1z(a);1a d=f.1G(20,35);1k(1a e=0;e<u.2r;e++)1k(1a h=0;h<u.2C;h++){1a l=f.1w(c*e)*d*f.1z(h*a)+f.1G(-3,3);b[e][h]=l}1c b});O("cZ",1j(a,b){1a c=f.1i(.4,.8),d=f.1G(18,26);1k(1a h=0;h<u.2r;h++)1k(1a l=0;l<u.2C;l++){1q e=f.1G(15,20);e=d*f.1w(c*l*h+e);b[h][l]=1.1*e*f.1z(a)}1c b})}};46 X{47(a,b){j.48(a,b);j.2f=0}48(a,b){j.x=a;j.y=b;u.1h&&(j.69=j.x-u.62+y.1A()[0],j.6a=j.y-u.63+y.1A()[1],j.49=1g.2A(j.69/u.R),j.4a=1g.2A(j.6a/u.R))}d0(){j.2f=0}4b(){1c u.1h?0<=j.49&&0<=j.4a&&j.49<u.2r&&j.4a<u.2C:j.6b()}6b(){1a a=g.1x,b=g.1B;1c j.x>=-a-y.1A()[0]&&j.x<=a-y.1A()[0]&&j.y>=-b-y.1A()[1]&&j.y<=b-y.1A()[1]}2V(){1c j.4b()&&u.1h?u.66()[j.49][j.4a]:0}6c(a,b,c=u.61(),d=!0){1n(j.4b()){1a h;1n(!d){h=f.1z(-b);1q e=f.1w(-b)}1k(1a l=0;l<a/c;l++){d&&(e=j.2V(),h=f.1z(e-b),e=f.1w(e-b));1a n=c*h,q=c*e;j.2f+=c;j.48(j.x+n,j.y+q)}}2u j.2f+=c}4U(a,b,c,d){1n(j.4b()){d=1/d;1k(1a h=0;h<b/c;h++){1q e=j.2V();1a l=a.2V(j.2f),n=c*f.1z(e-l);e=c*f.1w(e-l);j.2f+=c*d;j.48(j.x+n,j.y+e)}}2u j.2f+=c/3x}}1a 4o=1;1y k={1h:!0,1S:1v 4R,c:"#d1",w:1,cr:3g,2G:"6d",2W:(a,b)=>{1y c="3f"===b.1s||"2D"===b.1s||"1L"===b.1s;c||"3h"===b.1s||(b.1s="4c");"1L"===b.1s&&(V.2W(b.1L.6e),b.3i=()=>k.1d.1L(V.3y.2K(k.p.1L.6e),-k.p.2a/2,-k.p.2a/2,k.p.2a,k.p.2a));b.1I=c&&!1!==b.1I||b.1I?!0:!1;k.1S.1T(a,{3H:b,d2:[],d3:[]})},1T(a,b,c=1){k.4V(a);k.c=b;k.w=c;k.1h=!0},4V(a){k.2G=a},6f(a,b,c){0<3b.1l&&(k.c=2>3b.1l?a:[a,b,c]);k.1h=!0},6g(a){k.w=a},3q(a){k.cr=a},4W(){k.cr=3g},2T(a,b,c,d){E();1a e=g.2O(a,b,c,d);0!=e&&(k.4d(a,b,e,!1,!1),a=T(a,b,c,d),k.1U(a,!1))},4X(a,b,c,d){E();k.4d(a,b,c,!0,!1);k.1U(f.2Q(d),!1)},4Y(a,b,c,d){E();k.4d(b,c,a.1l,!0,a);k.1U(d,!0)},2M(){j.p=j.1S.2K(j.2G).3H;1c"4c"===j.p.1s||"3h"===j.p.1s?j.p.2M/j.w:j.p.2M},4d(a,b,c,d,e){j.1t=1v X(a,b);j.1l=c;j.4Z=d;(j.2X=e)&&e.3z(0)},1U(a,b){b||(j.2s=a);j.50();1y c=j.2M(),d=b?1g.2A(j.1l*a/c):1g.2A(j.1l/c);1k(1a e=0;e<d;e++)j.3i(),b?j.1t.4U(j.2X,c,c,a):j.1t.6c(c,a,c,j.4Z);j.52()},d4(a){j.50(!0);j.3i(a);j.52(!0)},50(a=!1){j.p=j.1S.2K(j.2G).3H;1n(!a){j.a="2D"!==j.p.2g.1s?f.1i(-1,1):0;j.b="2D"!==j.p.2g.1s?f.1i(1,1.5):0;j.cp="2D"!==j.p.2g.1s?f.1i(3,3.5):f.1i(-.2,.2);1y[b,c]=j.p.2g.1Y;j.1E=b;j.1f=c}j.c=g.1R(j.c);j.1d=j.p.1I?"1L"===j.p.1s?r.2F:r.1d:r.1N;y.1A();j.1d.1r();j.1d.3u();"1L"===j.p.1s?j.1d.2S(y.2y[0],y.2y[1]):j.1d.2S(y.2y[0]+g.1x/2,y.2y[1]+g.1B/2);j.1d.1J(-y.3a);j.1d.3x(W);j.p.1I&&("1L"!==j.p.1s?r.1I(j.c):r.1I(j.c,!1,!0),a||j.53());j.54=j.56();j.6h(j.54)},52(a=!1){j.p.1I&&!a&&j.53();j.1d.2v()},3i(a=!1){a=a?a:j.57();1n(j.59())d5(j.p.1s){4e"3h":j.6i(a);5a;4e"3f":j.5b(a);5a;4e"2D":4e"1L":j.5c(a,j.54);5a;4c:j.6j(a)}},57(){1c j.2X?j.5d()*j.2X.2g(j.1t.2f):j.5d()},5d(){1c"2D"===j.p.2g.1s?f.1F(j.p.2g.1D(j.1t.2f/j.1l)+j.cp,0,1,j.1E,j.1f,!0):j.5e()},5e(a=.5+k.p.2g.1D[0]*k.a,b=1-k.p.2g.1D[1]*k.b,c=k.cp,d=k.1E,e=k.1f){1c f.1F(1/(1+1g.2o(1g.4T((j.1t.2f-a*j.1l)/(b*j.1l/2)),2*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u)):"6m"===j.p.1J&&(a=(j.2X?-j.2X.2V(j.1t.2f):-j.2s)+(j.4Z?j.1t.2V():0),j.1d.1J(a))},53(){1n(j.59()){1a b=j.57();1q a=j.56(b);j.1d.1o(1V,0,0,a/1.5);1n("3f"===k.p.1s)1k(a=1;5>a;a++)j.5b(b*a/5,!1);2u 1n("2D"===k.p.1s||"1L"===k.p.1s)1k(1a c=1;5>c;c++)j.5c(b*c/5,a,!1)}}},V={3y:1v 4R,2W(a){j.3y.1T(a,!1)},6n(a){a.db();1k(1a b=0;b<4*a.1x*a.1B;b+=4){1a c=(a.2Y[b]+a.2Y[b+1]+a.2Y[b+2])/3;a.2Y[b]=a.2Y[b+1]=a.2Y[b+2]=1V;a.2Y[b+3]=1V-c}a.dc()},39(){1k(1a a 1P j.3y.5h()){1a b=dd(a,()=>V.6n(b));j.3y.1T(a,b)}}},z={1h:!1,2q:[5,45,{}],2b:!1,1C(a){1a b=z.2q[0],c=z.2q[1],d=z.2q[2],e=k.c,h=k.2G,l=k.w,n=k.1h;z.2b&&k.1T(z.2b[0],z.2b[1],z.2b[2]);c=f.2Q(c)%1Z;1a q=3B,t=-3B,x=3B,A=-3B;1q p=K=>{1k(1a H 1P K.a)q=H[0]<q?H[0]:q,t=H[0]>t?H[0]:t,x=H[1]<x?H[1]:x,A=H[1]>A?H[1]:A};42.de(a)||(a=[a]);1k(1q D 1P a)p(D);D=1v P([[q,x],[t,x],[t,A],[q,A]]);1a I=90>=c&&0<=c?x:A;1q B=d.4r?f.1F(d.4r,0,1,1,1.1,!0):1;p=[];1a L=0,C=b,G=K=>({3C:{x:q+C*K*f.1z(-c+90),y:I+C*K*f.1w(-c+90)},3D:{x:q+C*K*f.1z(-c+90)+f.1z(-c),y:I+C*K*f.1w(-c+90)+f.1w(-c)}});1k(;0<D.4f(G(L)).1l;){1a K=[];1k(1q J 1P a)K.1r(J.4f(G(L)));p[L]=K.df().dg((H,Y)=>H.x===Y.x?H.y-Y.y:H.x-Y.x);C*=B;L++}a=[];1k(1q M 1P p)"4j"!==3p M[0]&&a.1r(M);M=d.4q?d.4q:0;1k(J=0;J<a.1l;J++)1k(p=a[J],D=0<J&&d.5y,B=0;B<p.1l-1;B+=2)0!==M&&(p[B].x+=M*b*f.1i(-10,10),p[B].y+=M*b*f.1i(-10,10),p[B+1].x+=M*b*f.1i(-10,10),p[B+1].y+=M*b*f.1i(-10,10)),k.2T(p[B].x,p[B].y,p[B+1].x,p[B+1].y),D&&k.2T(a[J-1][1].x,a[J-1][1].y,p[B].x,p[B].y);k.1T(h,e,l);k.1h=n}};46 P{47(a,b=!1){j.a=a;j.5i=a.1F(c=>({x:c[0],y:c[1]}));b&&(j.5i=a);j.5j=j.5i.1F((c,d,e)=>[c,e[(d+1)%e.1l]])}4f(a){1a b=`${a.3C.x},${a.3C.y}-${a.3D.x},${a.3D.y}`;1n(j.3j&&j.3j[b])1c j.3j[b];1a c=[];1k(1a d 1P j.5j){1a e=ba(a.3C,a.3D,d[0],d[1]);!1!==e&&c.1r(e)}j.3j||(j.3j={});1c j.3j[b]=c}1U(a=!1,b,c){1a d=k.1h;a&&k.1T(a,b,c);1n(k.1h){E();1k(1a e 1P j.5j)k.2T(e[0].x,e[0].y,e[1].x,e[1].y)}k.1h=d}1o(a=!1,b,c,d,e,h){1a l=v.1h;a&&(4v(a,b),4w(c,h),4x(d,e));v.1h&&(E(),v.1o(j));v.1h=l}1C(a=!1,b,c){1a d=z.1h;a&&4p(a,b,c);z.1h&&(E(),z.1C(j));z.1h=d}}46 U{47(a){j.2N=[];j.2h=[];j.3k=[];j.1s=a;j.2s=0;j.3z(0);j.3l=!1}1Q(a=0,b=0,c=1,d=!1){0<j.2h.1l&&j.2h.6o(-1);a=d?(a%1u+1u)%1u:f.2Q(a);j.2h.1r(a);j.3k.1r(c);j.2N.1r(b);j.1l=j.2N.dh((e,h)=>e+h,0);j.2h.1r(a)}3r(a=0,b=1,c=!1){a=c?(a%1u+1u)%1u:f.2Q(a);j.2h.6o(-1);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.2W(q);c.1r(t);d.1r(n(I));e.1r(x,x)}g.2x(l);1c 1v 5p(c,d,j.3n,e)}1o(a,b,c){1a d=f.1F(v.2k,0,.15,.6,1,!0);1y e=24*d,h=b/5+c*b/6,l=b/4+c*b/3,n=b/7+c*b/3,q=b/5;c*=3;y.1A();r.1I(a,!1,!1,!0);r.1d.1r();r.1d.3u();r.1d.2S(y.2y[0]+g.1x/2,y.2y[1]+g.1B/2);r.1d.1J(y.3a);r.1d.3x(W);a=j.1H();1a t=a.1H().1H(.9),x=t.1H(.75),A=j.1H(.6);1k(1a p=0;p<e;p++){1n(p===1g.1K(e/4)||p===1g.1K(e/2)||p===1g.1K(3*e/4))1n(a=a.1H(),1===d||p===1g.1K(e/2))t=t.1H(.75),x=x.1H(.75),A=A.1H(.1,!0);a.1H().3E(p,q);A.1H(.1,!0).1H(.1).3E(p,n,!1);t.1H(.1).1H(.1).3E(p,l,!1);x.1H(.8).1H(.1).3E(p,h,!1);0!==c&&a.4g(c,b)}r.1d.2v()}3E(a,b,c=!0){r.1d.1o(1V,0,0,b);c?(r.1d.1O(1V,0,0,.5+1.5*v.2J),r.1d.6r(f.1F(a,0,24,6,.5))):r.1d.3u();r.1d.6s();1k(1a d 1P j.v)r.1d.6t(d.x,d.y);r.1d.6u(g.3I)}4g(a,b){1y c=f.1i(dt,6v),d=j.3o/2,e=.du*j.3o,h=.19*j.3o;r.1d.4g(3.5*a-f.1F(b,80,6w,.3,1,!0),0);1k(a=0;a<c;a++){b=j.3n.x+g.2E(0,d);1y l=j.3n.y+g.2E(0,d),n=f.1i(e,h);r.1d.3A(b,l,n)}r.1d.6x()}}2n.6y.2P.4g=1j(a,b){j.4h||(j.5r=j.6z,j.4h=!0,j.6A("dv-2c"),j.6B=j.5s.3m(),j.5s=[1,1,1,a/1V],j.6C=j.5t.3m(),j.5t=[1,1,1,b/1V])};2n.6y.2P.6x=1j(){1n(j.4h){j.5s=j.6B.3m();j.5t=j.6C.3m();1a a=j.6z;j.6A(j.5r);j.5r=a;j.4h=!1;j.dw()}};1y 6D="2a 2L 5g 5f 2j 2M 2g 1s 3i 1J".dx(" "),4n=[["dy",[.35,.12,.5,8,6v,.3,{1D:[.15,.2],1Y:[1.4,.9]}]],["dz",[.2,.6E,1,3,5w,.15,{1D:[.6E,.2],1Y:[1.7,.8]}]],["2B",[.35,.5,.1,8,1Z,.2,{1D:[.15,.2],1Y:[1.3,1]}]],["6d",[.3,.5,.4,4,1Z,.25,{1D:[.15,.2],1Y:[1.2,.9]}]],["2H",[.2,.4,.3,2,6F,.2,{1D:[.15,.2],1Y:[1.2,.9]}]],["dA",[.4,.6,.8,7,6w,.15,{1D:[.15,.2],1Y:[.95,1.2]}]],["dB",[.5,2,.8,dC,dD,.dE,{1D:[.15,.2],1Y:[1.3,.8]}]],["dF",[.2,.4,.3,2,6F,.15,{1D:[.5,.7],1Y:[1,1.5]}]],["3h",[.3,12,15,40,80,.65,{1D:[0,.1],1Y:[.15,1.2]},"3h"]],["3f",[2.5,.12,3g,3g,25,.4,{1D:[.35,.25],1Y:[1.5,1]},"3f"]],["dG",[2.5,.12,3g,3g,25,.35,{1D:[.35,.25],1Y:[1.3,.95]},"2D",1j(a){1a b=4o;a.3T(-1.5*b,-1.5*b,3*b,3*b);a.3T(1*b,1*b,1*b,1*b)},"6m"]]];1k(1a a 1P 4n){1a b={};1k(1a c=0;c<a[1].1l;c++)b[6D[c]]=a[1][c];k.2W(a[0],b)}m.dH=1j(a={}){a.R&&(f.2w=a.R)};m.39=N;m.dI=1j(){V.39()};m.dJ=1j(a=!0){r.4E=a};m.dK=aa;m.3G=Z;m.1r=ca;m.2v=da;m.4G=r.4G;m.4H=r.4H;m.1J=y.1J;m.3x=5D;m.dL=O;m.2t=1j(a){E();u.1h=!0;u.2i=a};m.dM=1j(){u.1h=!1};m.dN=1j(a){u.4m(a)};m.dO=1j(){1c 42.6G(u.1S.5h())};m.2W=k.2W;m.dP=1j(){1c 42.6G(k.1S.5h())};m.1T=k.1T;m.dQ=k.4V;m.3q=k.3q;m.4W=k.4W;m.1O=k.6f;m.6r=k.6g;m.3u=1j(){k.1h=!1};m.1o=4v;m.dR=4w;m.dS=4x;m.dT=1j(){v.1h=!1};m.dU=1j(a){v.5n=a};m.2T=k.2T;m.4X=k.4X;m.2X=k.4Y;m.3T=1j(a,b,c,d,e=g.dV){e==g.dW&&(a-=c/2,b-=d/2);u.1h?(4s(0),S(a,b),S(a+c,b),S(a+c,b+d),S(a,b+d),4t(3I)):(a=1v P([[a,b],[a+c,b],[a+c,b+d],[a,b+d]]),a.1o(),a.1C(),a.1U())};m.3A=1j(a,b,c,d=!1){1a e=1v U("1D");1q h=1g.2p*c/2;1a l=f.1i(0,1u);e.1Q(0+l+(d?f.1i(-1,1):0),h+(d?f.1i(-1,1):0),1,!0);e.1Q(-90+l+(d?f.1i(-1,1):0),h+(d?f.1i(-1,1):0),1,!0);e.1Q(-1Z+l+(d?f.1i(-1,1):0),h+(d?f.1i(-1,1):0),1,!0);e.1Q(-dX+l+(d?f.1i(-1,1):0),h+(d?f.1i(-1,1):0),1,!0);h=d?f.1G(-5,5):0;d&&e.1Q(0+l,1g.2p/1Z*h*c,!0);e.3r(h+l,1,!0);e.1o(a-c*f.1w(l),b-c*f.1z(-l),1);e.1C(a-c*f.1w(l),b-c*f.1z(-l),1);e.1U(a-c*f.1w(l),b-c*f.1z(-l),1)};m.5o=1j(a){a=1v P(a);a.1o();a.1C();a.1U()};m.dY=1j(a,b=.5){4u(a,b).1U()};m.6s=4s;m.6t=S;m.6u=4t;m.dZ=1j(a,b,c){R=[b,c];F=1v U(a)};m.e0=1j(a,b,c){F.1Q(a,b,c)};m.e1=1j(a,b){F.3r(a,b);F.1U(R[0],R[1],1);F=!1};m.e2=z.1C;m.1C=4p;m.e3=1j(a,b="e4",c=1){z.2b=[a,b,c]};m.e5=1j(){z.1h=!1;z.2b=!1};m.e6=P;m.e7=U;m.e8=X});',62,877,'|||||||||||||||||||this|||||||||||||||||||||||||||||||||||||||||||||||||||||let|vec3|return|mask||max|Math|isActive|random|function|for|length|float|if|fill|vec2|var|push|type|position|360|new|sin|width|const|cos|trans|height|hatch|curve|min|map|randInt|grow|blend|rotate|floor|image|vec4|noBlend|stroke|of|addSegment|color|list|set|draw|255|vVertTexCoord|dot|min_max|180|||||||||||weight|hatchingBrush|out|currentColor||plotted|pressure|angles|current|opacity|bleed_strength|constrain|origin|p5|pow|PI|hatchingParams|num_columns|dir|field|else|pop|source|angleMode|translation|shader|round||num_rows|custom|randomGaussian|mask2|name||texture_strength|border_strength|get|vibration|spacing|segments|dist|prototype|toDegrees|clear|translate|line|xyz|angle|add|plot|pixels|index||||||||||load|rotation|arguments|isBlending|createGraphics|pixelDensity|marker|null|spray|tip|_intersectionCache|pres|pol|slice|midP|size|typeof|clip|endPlot|registerMethod|setUniform|noStroke|uniform|mod|scale|tips|calcIndex|circle|Infinity|point1|point2|layer|brush|remove|param|CLOSE|1440|Float32Array|frag|glsl|getPigment|color1|color2|blending1|blending2|addColor|rect|void|03|spectral_mix|spectral_uncompand|055|spectral_compand||spectral_reflectance_to_xyz|Array|02|||class|constructor|update|column_index|row_index|isIn|default|initializeDrawingState|case|intersect|erase|_isErasing|exports|undefined|define|others|refresh|ea|fa|ha|rand|gradient|ia|ja|ka|la|ma|na|afterSetup|isPrecalculationDone|Float64Array|_renderer|mat4|loaded|isCaching|DEGREES|reDraw|reBlend|active|289|9898|233|5453|01|spectral_srgb_to_linear|spectral_linear_to_reflectance|sqrt|Map|100|abs|plotTo|setBrush|noClip|flowLine|flowShape|flow|pushState||popState|markerTip|alpha||calculateAlpha|calculatePressure||isInsideClippingArea|break|drawMarker|drawCustomOrImage|simPressure|gauss|quality|definition|keys|vertices|sides|curving|suma|genPol|isAnimated|polygon|oa|Vector|_cachedBlendMode|curFillColor|curStrokeColor|self|create|250|gen|continuous|direction|preCalculation|radians|uMVMatrix|pa|noSmooth|include|spectral|vert|WEBGL|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|post|step_length|left_x|top_y|addStandard||flow_field|genField|noise|x_offset|y_offset|isInCanvas|moveTo|HB|src|setColor|setWeight|applyColor|drawSpray|drawDefault|adjustSizeAndRotation|tint|natural|imageToWhite|splice|createVector|calcCenter|strokeWeight|beginShape|vertex|endShape|200|120|noErase|RendererGL|curBlendMode|blendMode|_cachedFillStyle|_cachedStrokeStyle|qa|05|150|from|object|module|amd|window|atan2|asin|weightedRand|in|isNumber|isNaN|replace|createShader|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|int|1E3|curved|truncated|zigzag|waves|seabed|reset|000000|colors|buffers|drawTip|switch|setAlpha|red|green|blue||loadPixels|updatePixels|loadImage|isArray|flat|sort|reduce|9999|075|002185|07|155|sub|copy|RADIANS|normalize|mult|lerp|130|025|destination|_applyBlendMode|split|pen|rotring|cpencil|charcoal|300|110|06|hatch_brush|marker2|config|preload|colorCache|scaleBrushes|addField|noField|refreshField|listFields|box|pick|bleed|fillTexture|noFill|fillAnimatedMode|CORNER|CENTER|270|spline|beginStroke|segment|endStroke|hatchArray|setHatch|black|noHatch|Polygon|Plot|Position'.split('|'),0,{}))\ No newline at end of filediff --git a/sketch.js b/sketch.jsindex 62a021a..8e127b3 100644--- a/sketch.js+++ b/sketch.js@@ -82,8 +82,7 @@ function setup () {x_values[i] = random(width)y_values[i] = random(width)}-- /*+brush.field("seabed")// STANDARD PALETTE TESTlet i = 0@@ -92,11 +91,12 @@ function setup () {brush.flowLine(30,60+i*10,195,0)i++}- */+}function draw() {+ /*background("#e2e7dc")translate(-width/2,-height/2)strokeWeight(2)@@ -112,6 +112,7 @@ function draw() {brush.endShape(CLOSE)noLoop()+ */}function mouseDragged() {