We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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(); }
Answers
Have you seen the clock example on the processing site? https://processing.org/examples/clock.html you can get the current time using hour(), minute(), and second().
also here's how to format code for the forum. Guaranteed to get you more help :)
https://forum.processing.org/two/discussion/8045/how-to-format-code-and-text#latest
you could calc a value minutesSinceMidnight from hours and minutes
this value would go from 0 to 24*60 or so
use map to map this range to the range you want (e.g. width to 0)
or map to an angle