float sinval1; float cosval1; float angle_sec = (second() * PI/30.0) + (3 * HALF_PI); float sinval2; float cosval2; float angle_min = (minute() * PI/30.0) + (3 * HALF_PI); float sinval3; float cosval3; float angle_heu = (hour() * PI/6.0) + (3 * HALF_PI); float rayon_sec = 100.0; float rayon_min = 70.0; float rayon_heu = 40.0; int sec = 0; int minut = 0; int heure = 0; float x1, y1, x2, y2, x3, y3; void setup(){ frameRate(1); size(300, 300); background(0); noStroke(); smooth(); } void draw(){ noStroke(); fill(0, 8); rect (0, 0, width, height); sec = second(); minut = minute(); heure = hour(); // definit l'aiguille des secondes angle_sec = (second() * PI/30.0) + (3 * HALF_PI); sinval1 = sin (angle_sec); cosval1 = cos (angle_sec); x1 = width/2 + (cosval1 * rayon_sec); y1 = height/2 + (sinval1 * rayon_sec); stroke(255); strokeWeight(2); line (width/2, height/2, x1, y1); // definit l'aiguille des minutes angle_min = (minute() * PI/30.0) + (3 * HALF_PI); sinval2 = sin (angle_min); cosval2 = cos (angle_min); x2 = width/2 + (cosval2 * rayon_min); y2 = height/2 + (sinval2 * rayon_min); stroke (102, 0, 0); line (width/2, height/2, x2, y2); // definit l'aiguille des heures sinval3 = sin (angle_heu); cosval3 = cos (angle_heu); x3 = width/2 + (cosval3 * rayon_heu); y3 = height/2 + (sinval3 * rayon_heu); stroke (51, 0, 0); line (width/2, height/2, x3, y3); sec +=1; }