I'm trying to create an interface similar to how polar clock works
I'm just starting out with trying to get the seconds bit working correctly..
My code so far is:
Code:
float radius = 75;
float clockDiameter = radius * 2;
float cx, cy;
void setup() {
size(200, 200);
background(127);
cx = 100;
cy = 100;
}
void draw() {
//ellipse(cx, cy, clockDiameter, clockDiameter);
float s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI;
stroke(255);
strokeWeight(1);
float theta = radians(s);
//arc(cx, cy, clockDiameter, clockDiameter, PI, radians(250));
//line(cx, cy, cx + cos(s) * radius, cy + sin(s) * radius);
//arc(50, 55, 80, 80, TWO_PI-PI/2, TWO_PI);
arc(cx, cy, clockDiameter, clockDiameter, TWO_PI-PI/2, theta);
}
I'm having trouble with the PI bit in the arc call I think.. I'm close I think.. Can someone shed some light? I'm trying to do it so the arc always starts at the top like on a analog clock and depending on how many seconds there are define an angle for the end position..
Thanks
Dan