Skip to content

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

Tests

Alejandro706c79d03d78
diff --git a/p5.brush.js b/p5.brush.js
index 9b1ccf7..1354aa3 100644
--- a/p5.brush.js
+++ b/p5.brush.js
@@ -2109,7 +2109,7 @@
* EXPORTED
*/
function setBleed(_i, _texture = 0) {
- F.b = R.constrain(_i,0.1,0.6);
+ F.b = R.constrain(_i,0,0.6);
F.t = _texture > 1 ? 1 : _texture;
}
@@ -2143,6 +2143,7 @@
isAnimated: false,
b: 0.07,
t: 0,
+ o: 80,
/**
* Fills the given polygon with a watercolor effect.
* @param {Object} polygon - The polygon to fill.
diff --git a/sketch.js b/sketch.js
index bdae1bc..b62c9c0 100644
--- a/sketch.js
+++ b/sketch.js
@@ -138,21 +138,28 @@ function setup () {
}
brush.stroke(150)
+
+ brush.bleed(0)
for (let p of pol_array) {
+ brush.fill(random(palette),35)
p.draw()
+
+ p.fill()
}
+ brush.noFill()
brush.set("marker2",random(palette),1)
- brush.hatch(1,30,{gradient: 0.4, random: false, continuous: true})
+ brush.hatch(0.5,30,{gradient: 0.4, random: false, continuous: true})
brush.hatchArray(pol_array)
// You can draw rectangles (x,y,width,height,mode) - mode is optional, you can set it to "center"
brush.set("marker2",random(palette),1)
- brush.hatch(1,130,{gradient: 0.3, random: false, continuous: true})
+ brush.hatch(0.2,130,{gradient: 0.3, random: false, continuous: true})
brush.hatchArray(pol_array)
//brush.rect(100,100,100,100,"center")
// You can draw ricles (x,y,radius)
+
/*