Processing clock code

This can be cut and pasted into Processing to make a clock.

void setup() {

 size(800,800);

 background(255);

 }

void draw() {

 background(255);  // clear the screen

 translate(width/2, height/2);

  scale(3);

  strokeWeight(1);

  int radius = 120; float theta = 6.28/60;

  int n = 0;

  while(n < 60){ // put on 60 tick marks

    float x = radius * cos(n*theta);

    float y = radius * sin(n*theta);

    float x1= (radius - 10) * cos(n*theta);

    float y1 = (radius - 10) * sin(n*theta);

   stroke(0);

   line (x,y,x1,y1);

   if(n%5==0){

    stroke(0,0,255);  

    strokeWeight(2);  

    x = (100) * cos(n*theta);

    y = (100) * sin(n*theta);

    x1= (120) * cos(n*theta);

    y1 = (120) * sin(n*theta);

    line(x,y,x1,y1);  

    }   

   n = n + 1;}  

  

 // second hand   

 radius = 100; 

 theta = 3.1415*second()/30-3.1415/2;

 float x = radius * cos(theta);

 float y = radius * sin(theta);

 float delta = 3.1415/50;

 strokeWeight(2);

 float x1 = (radius - 10) * (cos(theta - delta));

 float y1 = (radius - 10) * (sin(theta - delta));  

 float x2 = (radius - 10) * (cos(theta + delta));

 float y2 = (radius - 10) * (sin(theta + delta));

 line(0,0,x,y); line(x,y,x1,y1); line(x,y,x2,y2);

 

   

  // minute hand   

 radius = 80; 

 theta = 3.1415*minute()/30-3.1415/2 + theta / 60;

 x = radius * cos(theta);

 y = radius * sin(theta);

 delta = 3.1415/40;

 strokeWeight(5);

 x1 = (radius - 15) * (cos(theta - delta));

 y1 = (radius - 15) * (sin(theta - delta));  

 x2 = (radius - 15) * (cos(theta + delta));

 y2 = (radius - 15) * (sin(theta + delta));

 line(0,0,x,y); line(x,y,x1,y1); line(x,y,x2,y2);

 

  // hour hand   

 radius = 60; 

 theta = 3.1415*hour()/6 - 3.1415/2 + theta/60;

 x = radius * cos(theta);

 y = radius * sin(theta);

 delta = 3.1415/30;

 strokeWeight(10);  

 x1 = (radius - 20) * (cos(theta - delta));

 y1 = (radius - 20) * (sin(theta - delta));  

 x2 = (radius - 20) * (cos(theta + delta));

 y2 = (radius - 20) * (sin(theta + delta));

 line(0,0,x,y); line(x,y,x1,y1); line(x,y,x2,y2);

  

 fill (0,0, 255);

 ellipse (0,0,20,20);

  

 }