04
Tip My Face
Code
// Create your own brushes like thisbrush.add("watercolor", {
type: "image", // this is the TIP TYPE: choose standard / spray / marker / custom / image
weight: 30, // Base weight of the brush tip
vibration: 2, // Vibration of the lines, spread
definition: 0.5, // Between 0 and 1
quality: 8, // + quality = more continuous line
opacity: 30, // Base opacity of the brush (this will be affected by pressure)
spacing: 5, // Spacing between the points that compose the brush stroke
blend: true, // Activate / Disable realistic color mixing
pressure: {
type: "standard", // Use “standard” for simple gauss bell curve
curve: [0.15,0.2], // If "standard", pick a and b values for the gauss curve
min_max: [0.5,1.2] // For both cases, define min and max pressure (reverse for inverted presure)
},
// if you select the image type brush, link your image below.
image: {
src: "./brush_tips/brush.jpg",
},
// For "custom" and "image" types, you can define the tip angle rotation here.
rotate: "random", // "none" disables rotation | "natural" follows the stroke | "random"
})
brush.add("face_brush", {
type: "image",
weight: 90,
vibration: 5,
definition: 0.5,
quality: 8,
opacity: 175,
spacing: 50,
blend: true,
pressure: {
type: "custom",
curve: (x) => 1, // If "custom", define the pressure curve function here
min_max: [0.5,1.2]
},
image: {
src: "./brush_tips/face_brush.jpg",
},
rotate: "natural",
})
function preload() {
// When using image brushes, it’s essential to add this function to the p5 preload
brush.preload()
}
let palette = ["#7b4800", "#002185", "#003c32", "#fcd300", "#ff2702", "#6b9404"]
function setup () {
C.createCanvas()
angleMode(DEGREES)
background("#fffceb")
translate(-width/2,-height/2)
// Activate the flowfield we're going to use
brush.field("seabed")
for (let i = 0; i < 3; i++) {
// Select the face brush
brush.set("face_brush", random(palette),random(1,3))
// Draw circle in x,y
let x = random(width)
let y = random(height)
brush.circle(x, y, 500)
for (let j = 0; j < 10; j++) {
// Select the watercolor brush
brush.set("watercolor",random(palette),2)
brush.flowLine(x, y, 500, 36 * j)
}
}
}
link to p5 editor
Results
More results with similar technique, but proper brushes jpegs (rather than faces)