int w, x, l; int hs, ms, ss; void setup() { size(300,300); w = (width < height) ? (width / 2) : (height / 2); x = floor(w * 1.8); hs = floor(w * 0.5); ms = floor(w * 0.65); ss = floor(w * 0.7); l = floor(w * 0.8); background(#999999); PFont fontA = loadFont("Courier-bold-24.vlw"); textFont(fontA, floor(24 * w / 200)); textAlign(CENTER); smooth(); } void draw() { fill(#666666); rect(0,0,width,height); fill(#ffffff); stroke(2); ellipse(width/2, height/2, x, x); fill(#999999); String time = nf(hour(),2) + ":" + nf(minute(),2) + ":" + nf(second(),2); text(time,width*0.5,height*0.5+w*0.5); pushMatrix(); translate(width/2, height/2); fill(#000000); for (int i = 1; i <= 12; i++) { text(i, l * cos(2 * PI * (i % 12) / 12 - HALF_PI)+floor(4 * w / 200), l * sin(2 * PI * (i % 12) / 12 - HALF_PI)+floor(8 * w / 200)); } smooth(); strokeWeight(floor(3 * w / 200)); line(0, 0, ss * cos(2 * PI * second() / 60 - HALF_PI), ss * sin(2 * PI * second() / 60 - HALF_PI)); strokeWeight(floor(4 * w / 200)); line(0, 0, ms * cos(2 * PI * minute() / 60 - HALF_PI), ms * sin(2 * PI * minute() / 60 - HALF_PI)); strokeWeight(floor(6 * w / 200)); line(0, 0, hs * cos(2 * PI * (hour() % 12) / 12 - HALF_PI), hs * sin(2 * PI * (hour() % 12) / 12 - HALF_PI)); popMatrix(); }