float seconds = 0; // this ensures floating-point divisions void setup() { size(400,400); frameRate(60); } void drawNumbers() { pushMatrix(); pushStyle(); fill(0); for (int h=0; h < 12; h++) { ellipse(0,-130,10,10); rotate(TWO_PI/12); } popMatrix(); popStyle(); } void draw() { seconds++; background(204); ellipse(200,200,300,300); // white clock face translate(200,200); drawNumbers(); // second hand pushMatrix(); rotate(TWO_PI*seconds/60); // 60 seconds around the clock line(0,0,0,-130); popMatrix(); // minute hand pushMatrix(); rotate(TWO_PI*seconds/3600); // 60 minutes = 3600 seconds line(0,0,0,-100); popMatrix(); // hour hand pushMatrix(); rotate(TWO_PI*seconds/43200); // 12 hours = 43200 seconds line(0,0,0,-80); popMatrix(); }