RosettaCodeData/Task/Draw-a-clock/Processing/draw-a-clock-1.processing

20 lines
404 B
Plaintext

void draw() {
drawClock();
}
void drawClock() {
background(192);
translate(width/2, height/2);
float s = second() * TWO_PI / 60.0;
float m = minute() * TWO_PI / 60.0;
float h = hour() * TWO_PI / 12.0;
rotate(s);
strokeWeight(1);
line(0, 0, 0, -width*0.5);
rotate(-s+m);
strokeWeight(2);
line(0, 0, 0, -width*0.4);
rotate(-m+h);
strokeWeight(4);
line(0, 0, 0, -width*0.2);
}