int xMin = 0;
int yMax,xMax;
int yMin = 0;
void setup() {
smooth();
size(700,500);
yMax = height;
xMax = width;
frameRate(5);
}
void draw() {
randomFlower();
}
void randomFlower() {
color clr = color(random(20,230),random(20,230), random(20,230));
float trans = random(190, 250);
fill(clr,trans);
translate(random(xMin,xMax),random(yMin, yMax));
float numPetals = random(9, 20);
float petalLength = random(30, 100);
println("Petal length = " + petalLength);
for (float rot = 0; rot < (2 * PI); rot += (2 * PI) / numPetals) {
pushMatrix();
rotate(rot);
beginShape();
vertex(10,10);
bezierVertex(10,10,50,20,10 + petalLength,10 + petalLength);
bezierVertex(10 + petalLength ,10 + petalLength,20,60,10,10);
endShape();
popMatrix();
}
ellipse(0,0,25,25);
}