Saturday, February 20, 2016

FOCAL POINT

I've created the flower that spins and I am struggling but still trying to set up code that will spin it according to the time of day. I've also tried connecting the stem to it, but that ended up a little funky too; I think I placed that code in the wrong area.


float f;

void setup(){
  size(500,500);
  background(255);
}

void draw(){
 background(255);

   f -= .01;
   if(f < -1){
   f = 1;
 }
  
 sunflower(width/2,height/2);
}

void sunflower(int x,int y){
   //x = location
   //y = location

   //pedals
   pushMatrix();
   translate(x,y);
   scale(f,1);
   fill(240,255,36);
   for(int i = 0; i <= 10; i ++){
   rotate(radians(360/10));
   ellipse(0,-50,35,100);
   }
   fill(0);
   ellipse(0,0,75,75);
   popMatrix();

}

No comments:

Post a Comment