//My idea for this project started with having the
//flowers open and close as the mouse moves from
//left to right. In addition to that, the background
//also changes from day to night. When moving the
//mouse up and down, the flower begins to grow as
//if it were blooming and continues to vary in size.
import proxml.*;
import candy.*;
float scaleval = 1.0;
SVG petal;
void setup() {
size(600, 600);
petal = new SVG("petal.svg",this);
noCursor();
}
void draw() {
background(58, 60+(mouseX/20), 30);
scaleval = float(mouseY)/height * 2.0;
//growing flower
pushMatrix();
translate(50, 100);
scale(1 * scaleval);
flower(0, 0);
popMatrix();
pushMatrix();
translate(400, 500);
scale(0.8 * scaleval);
flower(0, 0);
popMatrix();
pushMatrix();
translate(500, 100);
scale(0.5 * scaleval);
flower(0, 0);
popMatrix();
//still flower
pushMatrix();
translate(100, 400);
scale(0.9);
flower(0, 0);
popMatrix();
pushMatrix();
translate(180, 500);
scale(0.45);
flower(0, 0);
popMatrix();
pushMatrix();
translate(250, 350);
scale(0.6);
flower(0, 0);
popMatrix();
pushMatrix();
translate(350, 150);
scale(0.7);
flower(0, 0);
popMatrix();
pushMatrix();
translate(450, 250);
scale(0.5);
flower(0, 0);
popMatrix();
}
void flower(int x, int y) {
float r = float(mouseX)/width * PI/3;
smooth();
stroke(75, 30, 51, 150);
strokeWeight(8);
fill(191, 94, 162, 150);
ellipse(0, 0, 50, 50);
rotate(r);
petals(0, 0);
rotate(r);
petals(0, 0);
rotate(r);
petals(0, 0);
rotate(r);
petals(0, 0);
rotate(r);
petals(0, 0);
rotate(r);
petals(0, 0);
}
void petals(int x, int y) {
petal.customStyle();
smooth();
fill(190, 183, 130, 195);
stroke(253, 249, 204, 115);
strokeCap(ROUND);
strokeWeight(0.5);
petal.draw();
}