/** * a simple clock by Guru */ void setup() { size(300,300); smooth(); } void draw() { background(0); // draw the clockhand for the hour pushMatrix(); // move the hand to the center translate(150,150); // rotate it ( take the hour modulo 12 and add minutes / 60 to it, // then convert to radians) rotate( radians( 30 * ((hour() % 12 ) + float(minute())/60))); hand(7); popMatrix(); // draw the clockhand for the minute pushMatrix(); // move hand to the center translate(150,150); // rotate it rotate( radians( 6 * minute())); hand(8); popMatrix(); } void hand( int l ) { int y = 0; for( int i=l-1; i > 0; i--) { fill(128,128); strokeWeight(3); stroke(255); ellipse( 0, 0 + y, i*i*1.1, i*i*1.1 ); y -= i*i; } }