Brendan Hsu's Generative Flower
Code
var scrollSpeed = 2; function buildArray (n, fillFunction) { let outputArray = []; for (let i = 0; i < n; i++) { outputArray.push(fillFunction(i)) } return outputArray } function setup() { // Create the canvas createCanvas(1700,800); x1 = 0; x2 = width; noLoop() } function randomRange (min, max) { return min + ((max-min) * Math.random()) } class Flower { constructor(x,y,size,group){ this.x = x; this.y = y; this.size=size; this.group=group } draw(){ // A design for a simple flower translate(this.x, this.y); //scale scale(this.size); // noStroke(); stroke("blue") for (var i = 0; i < 10; i ++) { if (this.group==1){ fill("White")} if (this.group==2){ fill(color(random(0,255),random(0,100),random(0,999)));} ellipse(50, 80, 20, 80); rotate(PI/5); circle(50, 50, 50); } resetMatrix(); } } let myFlower = new Flower (); function flowerRows(noOfRows,rowLength,size,x,y,group,width){ return buildArray(noOfRows,i2=> buildArray(rowLength,i => new Flower(randomRange(x+0, x+width),y+50*(i2+1),size,group))) } let myFlower4=flowerRows(20,20,0.15,40,0,1,400) let myFlower5=flowerRows(20,5,0.5,469,0,2,1200) const myFlower6 = ['1', '2', '3', '4', '5','6','7','8','9']; const myFlower7 = ['1', '2', '3', '4', '5','6','7','8','9']; function draw() { background('gray'); x1 -= scrollSpeed; x2 -= scrollSpeed; if (x1 < -width){ x1 = width; } if (x2 < -width){ x2 = width; } // Set colors fill(100, 1, 300, 200); stroke(200, 100, 190); // white flowers myFlower4.forEach(x => x.forEach(y => y.draw())) // blue and purple flowers myFlower5.forEach(x => x.forEach(y => y.draw())) }