int seconde, minut, heure; float sinvalsec, cosvalsec, angle_sec, sinvalmin, cosvalmin, angle_min, sinvalheu, cosvalheu, angle_heu; float xsec, ysec, xmin, ymin, xheu, yheu; float rayon_heu = 135.0; float rayon_min = 165.0; float rayon_sec = 195.0; void setup(){ frameRate(1); size(400, 400); background(0); smooth(); } void draw(){ noStroke(); fill(0); rect(0, 0, width, height); seconde = second(); minut = minute(); heure = hour(); fill(255, 10); stroke(51); // definit l'aiguille des secondes angle_sec = (second() * PI/30.0) + (3 * HALF_PI); sinvalsec = sin (angle_sec); cosvalsec = cos (angle_sec); xsec = width/2 + (cosvalsec * rayon_sec); ysec = height/2 + (sinvalsec * rayon_sec); stroke(255); fill(255, 51); bezier(width/2 - 50, height/2, xsec, ysec, xsec, ysec, width/2 + 50, height/2); ellipse(xsec, ysec, 5, 5); // definit l'aiguille des minutes angle_min = (minute() * PI/30.0) + (3 * HALF_PI); sinvalmin = sin (angle_min); cosvalmin = cos (angle_min); xmin = width/2 + (cosvalmin * rayon_min); ymin = height/2 + (sinvalmin * rayon_min); stroke(255); fill(255, 51); bezier(width/2 - 50, height/2, xmin, ymin, xmin, ymin, width/2 + 50, height/2); ellipse(xmin, ymin, 5, 5); // definit l'aiguille des heures angle_heu = (hour() * PI/6.0) + (3 * HALF_PI); sinvalheu = sin (angle_heu); cosvalheu = cos (angle_heu); xheu = width/2 + (cosvalheu * rayon_heu); yheu = height/2 + (sinvalheu * rayon_heu); stroke(255); fill(255, 51); bezier(width/2 - 50, height/2, xheu, yheu, xheu, yheu, width/2 + 50, height/2); ellipse(xheu, yheu, 5, 5); }