top of page
THE DOLLHOUSE
Welcome to
Heading 1
bottom of page
var flowers = []; // Array to store flowers
var yoff = 0;
let angle = 0;
let maxFlowers = 100; // Adjust the max number of flowers
let frameInterval = 300; // Interval to add new flowers
function setup() {
createCanvas(windowWidth, windowHeight);
// Generate initial batch of flowers
for (var j = 0; j < 25; j++) {
flowers[j] = new Flower(random(30, 90));
}
}
function draw() {
colorMode(RGB);
background(69, 133, 85);
// Every few frames, add a new flower
if (frameCount % frameInterval === 0 && flowers.length < maxFlowers) {
flowers.push(new Flower(random(30, 90)));
}
// Display all flowers
for (var h = 0; h < flowers.length; h++) {
flowers[h].display();
}
}
class Flower {
constructor(tempr) {
this.x = random(width);
this.y = random(height);
this.R = tempr;
this.r = random(0, 255);
this.g = random(0, 255);
this.b = random(0, 255);
}
display() {
push();
translate(this.x, this.y);
rotate(angle);
beginShape();
var xoff = 1000;
for (var i = 0; i < 4 * PI; i += 0.05) {
var r = map(noise(xoff, yoff), 0, 1, this.R * 0.6, this.R * 1.4) * sin(2.4 * i);
var x = r * cos(i);
var y = r * sin(i);
stroke(255);
strokeWeight(0.5);
fill(this.r, this.g, this.b, 250);
vertex(x, y);
}
endShape();
pop();
}
}