Lancette di ore, minuti e secondi

Si ripetono le operazioni per i secondi anche per i minuti e le ore.

final color coloreS=color(255, 0, 0);
final color coloreM=color(0, 255, 0);
final color coloreH=color(0, 0, 255);

final float passoS=TWO_PI/60.0;
final float passoM=TWO_PI/60.0;
final float passoH=TWO_PI/12.0;

final int   spessoreS=5;
final int   spessoreM=10;
final int   spessoreH=15;

float       dimensione,
            lunghezzaS,
            lunghezzaM,
            lunghezzaH,
            secondi,
            minuti,
            ore;            

PImage      iSfondo;

float       xc, yc,
            x,  y;

void setup()
{
  size(500, 500);
  frameRate(5);
  smooth();
  noStroke();
  
  xc=width/2;
  yc=height/2;
  dimensione=0.9*width;  
  lunghezzaS=0.8*xc;
  lunghezzaM=0.65*xc;
  lunghezzaH=0.5*xc;
  
  iSfondo=loadImage("sfondo500.png");
}
void draw()
{
  background(iSfondo);  

  ore=passoH*hour()%12-HALF_PI;
  x=xc+cos(ore)*lunghezzaH;
  y=yc+sin(ore)*lunghezzaH;
  stroke(coloreH);  
  strokeWeight(spessoreH);  
  line(xc, yc, x, y); 
  
  minuti=passoM*minute() -HALF_PI;  
  x=xc+cos(minuti)*lunghezzaM;
  y=yc+sin(minuti)*lunghezzaM;
  stroke(coloreM);  
  strokeWeight(spessoreM);  
  line(xc, yc, x, y);

  secondi=passoS*second()-HALF_PI;  
  x=xc+cos(secondi)*lunghezzaS;
  y=yc+sin(secondi)*lunghezzaS;
  stroke(coloreS);
  strokeWeight(spessoreS);
  line(xc, yc, x, y);
}