How to make something move over time?

edited February 2016 in Questions about Code

I would like my flower to move from one side (east to west) to the next over a course of 24 hours. What I'm trying to make essentially is a clock. (Sunflowers track the sunlight) What I don't get is how to incorporate hours and minutes into my sketch and have the flower move accordingly. This is probably so simple, but it's very difficult for me; can anyone help?

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); for(int i = 0; i <= 10; i ++){ rotate(radians(360/10)); ellipse(0,-50,35,100); } ellipse(0,0,75,75); popMatrix(); }

Tagged:

Answers

Sign In or Register to comment.