Clock project (Urgent please)

Hello everyone,
I have to create a clock for my animation class and I have some issues with processing. It’s the first time I’m using this app…
Please if someone can help me, I want to create a line for every minute that pass in a circular form (I don’t know if I’m clear)

1 Like

You need hour minute and second for this - see reference on the website

You need cosine and sine, see tutorial trigonometry on the website

Yes thanks!
i’m already using that tutorials and I wrote that code :
void setup(){
size(1000,1000);

xC = width/2;
yC= height/2;
rayonM = 200 ;
angleM = 2*PI/60;

}

void draw(){
background(255);

xM = xC + rayonM*cos(angleM *minute()-PI/2);
yM = yC + rayonM*sin(angleM *minute()-PI/2);
strokeWeight(10);
 line(xC, yC, xM, yM);
 smooth();
xM = xC + rayonM*cos(angleM *minute()-PI/2);
yM = yC + rayonM*sin(angleM *minute()-PI/2);
strokeWeight(10);
 line(xC, yC, xM, yM);
 line(xC, yC, xM, yM);
 smooth();

}

But with that, the line is disappearing like a real clock and I want the lines to stay on the page, like one line = one minute, and 60 lines = 1 hour.

Hi @laura – welcome.

Please help us to help you by editing your original code post and formatting your code.

To begin: your lines are disappearing because background(255) paints the whole canvas white each frame before drawing something new.

I encourage you to use background

To fill the clock with lines up to the number of minutes : use a for loop with minutes as upper boundary