import java.applet.*; 
import java.awt.*; 
import java.awt.image.*; 
import java.awt.event.*; 
import java.io.*; 
import java.net.*; 
import java.text.*; 
import java.util.*; 
import java.util.zip.*; 

public class udk_01_rohlf_2 extends BApplet {
float x1,y1;
float x2=-50;
float y2=-90;
float y3=-40;

float leafs=random(-200,-100);
float flower=random(-200,-60);
int num_1=(int)(random(4,16));
int num_2=(int)(random(8,32));


void setup() {
size(400,400);
background(200,160,256);


}

void loop() {
translate(width/2,height/2);
if(num_1%2!=0) {num_1=num_1+1;
}
if(num_2%2!=0) {num_2=num_1+1;
}

int cnt_1=num_1/2;
int cnt_2=num_2/2;

smooth();
stroke(0);
fill(150);
for(int i=0; i<num_1; i++) { 
  rotateZ(PI/cnt_1);
  beginShape(POLYGON);
    curveVertex(0,0);
    curveVertex(0,0);
    curveVertex(-30,y3);
    curveVertex(-10,y2);
    curveVertex(0,leafs);
    curveVertex(10,y2);
    curveVertex(30,y3);
    curveVertex(0,0);
    curveVertex(0,0);
  endShape();
}

noSmooth();
stroke(255);
fill(255,0,250);
for(int h=0; h<num_2; h++) { 
  rotateZ(PI/cnt_2);
  beginShape(POLYGON);
    curveVertex(0,0);
    curveVertex(0,0);
    curveVertex(-20,-20);
    curveVertex(-10,x2);
    curveVertex(0,flower);
    curveVertex(10,x2);
    curveVertex(20,-20);
    curveVertex(0,0);
    curveVertex(0,0);
 endShape();
}
 
noStroke();
fill(0);
ellipseMode(CENTER_DIAMETER);
ellipse(0,0,50,50);


for(int g=0; g<200; g++) {
  float x = random(-15,15);
  float y = random(-15,15);
  point(x,y);
}
}


void mouseMoved() {
x1=-(mouseX-200);
if(x1>0) {x1=-x1;
}
x2=x1/4;
flower=x1;

y1=-(mouseY-200);
if(y1>0) {y1=-y1;
}
y2=y1/2;
leafs=y1;
if(y2>-40) {y3=mouseY/4;
}
}


}
