xxxxxxxxxx
60
let n = 6;
let seed;
let font1 = "Gambarino-Regular.otf";
let gambarino;
function setup() {
createCanvas(windowWidth, windowHeight);
gambarino = loadFont(font1);
seed = random(1000);
}
function draw() {
randomSeed(seed, true);
background(255);
push();
blendMode(EXCLUSION);
for (k = 0; k < n; k++) {
flower(
random(width),
random(height),
random(100, 160),
round(random(6, 12))
);
}
textFont(gambarino);
noStroke();
fill(255);
textSize(80);
textAlign(LEFT, CENTER);
textLeading(70);
text("These are\nRandom\nFlowers", 30, 120);
pop();
}
function flower(x, y, sz, petals) {
strokeWeight(2);
stroke(255);
for (i = 0; i < petals; i++) {
noFill();
translate(x, y);
rotate((PI / (petals / 2)) * i);
ellipse(sz / 1.5 / 2, sz / 1.5 / 2, sz / 1.5);
resetMatrix();
}
fill(255);
ellipse(x, y, sz);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}