int seconde, minut, heure; float sinvalsec, cosvalsec, angle_sec, sinvalmin, cosvalmin, angle_min, sinvalheu, cosvalheu, angle_heu, sinvalpt1, cosvalpt1, sinvalpt2, cosvalpt2, sinvalpt3, cosvalpt3, angle_pt1, angle_pt2, angle_pt3; float xsec, ysec, xmin, ymin, xheu, yheu, xpt1, ypt1, xpt2, ypt2, xpt3, ypt3; float rayon_heu = 160.0; float rayon_min = 177.5; float rayon_sec = 195.0; float rayon_int = 40.0; void setup(){ frameRate(1); size(400, 400); background(0); smooth(); } void draw(){ noStroke(); fill(0, 10); rect(0, 0, width, height); seconde = second(); minut = minute(); heure = hour(); stroke(255); noFill(); // definit les 3pts intérieurs angle_pt1 = HALF_PI/3; angle_pt2 = 5 * HALF_PI/3; angle_pt3 = 9 * HALF_PI/3; sinvalpt1 = sin (angle_pt1); cosvalpt1 = cos (angle_pt1); sinvalpt2 = sin (angle_pt2); cosvalpt2 = cos (angle_pt2); sinvalpt3 = sin (angle_pt3); cosvalpt3 = cos (angle_pt3); xpt1 = width/2 + (cosvalpt1 * rayon_int); ypt1 = height/2 + (sinvalpt1 * rayon_int); xpt2 = width/2 + (cosvalpt2 * rayon_int); ypt2 = height/2 + (sinvalpt2 * rayon_int); xpt3 = width/2 + (cosvalpt3 * rayon_int); ypt3 = height/2 + (sinvalpt3 * rayon_int); // 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); bezier(xpt2, ypt2, xheu, yheu, xheu, yheu, xpt3, ypt3); ellipse(xheu, yheu, 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); bezier(xpt3, ypt3, xmin, ymin, xmin, ymin, xpt1, ypt1); ellipse(xmin, ymin, 5, 5); // 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); bezier(xpt1, ypt1, xsec, ysec, xsec, ysec, xpt2, ypt2); ellipse(xsec, ysec, 5, 5); }