Today I thought about #painting #flowers. Instead I made a trip along all points of a #circle with the given radius. I stopped briefly at each of the points and #drew a #curvy #shape based on my own formula. After seeing that it worked I refactored it into a function. So I can #layer multiple calls to flower() and create these #images.
/**
* blackRosesDoodle
* Author: Matthias Jäger
* Date: 2020-04-11
*/
/** UTILS */
// ---------------------------------------------------------------------- //
/** A function that draws a "flower" based on a circular walk */
function flower(radius, noise_offset, noise_inc, angle_inc, len) {
// Walk along all points on a circle
for (let angle = 0; angle < TAU; angle += angle_inc) {
// Make the translation unique
push();
// Translate: poolar coorrdinates
translate(cos(angle) * radius, sin(angle) * radius);
// Then rotate
rotate(angle);
// Then draw a shape for each point the whole thing is hard to explain
beginShape();
for (let shape = 0; shape < len; shape += noise_inc) {
// Kind of a line from the outside to the center of the circle
// but is distorted by noise and harmonic motion
curveVertex(-shape * noise(noise_offset), shape * cos(shape));
noise_offset += noise_inc;
}
endShape(CLOSE);
pop();
}
}
/** MAIN */
// ---------------------------------------------------------------------- //
/** No draw needed */
function setup() {
// Format
createCanvas(800, 800);
// Style
background(255);
fill(0);
stroke(255);
// Position
translate(width * 0.5, height * 0.5);
// Black fill
circle(0, 0, 300);
// Two calls to flower play with the values
flower(300, 10, 0.01, 0.5, 200);
flower(200, 10, 0.01, 0.5, 200);
// Save out
save("blackRoseDoodle.jpg");
}