Question about my crazy clock ; )
in
Programming Questions
•
1 years ago
Hello Guys !!!
I created a code about a crazy clock ^^ , when the mouse is down, it change color and make appears a spiral but i wonder 2 questions :
1- why my arrows are less fast when my mouse is down/change blackground ?, it's cool but i don' t understand because this arrows are doing this, it was not my intention at first, so i would like to understand ^^
2- I tried to create a Mousepressed code to animate slowly the spirale when i click with my mouse but unfortunately i didn't succeed, could you me help please ?
This is my code to illustrate my questions :
float secondes;
float heures;
float minutes;
void setup() {
size(200, 200);
smooth();
}
void draw() {
background(0);
// Dessin de l'horloge
translate(width / 2, height / 2);
strokeWeight(6);
stroke(255,0,0);
ellipse(0, 0, 200, 200);
// secondes
strokeWeight(1);
fill(0);
secondes +=0.02;
pushMatrix();
rotate(secondes);
line(0, 0, 0, 95);
popMatrix();
// minutes
strokeWeight(2);
minutes +=0.1;
pushMatrix();
rotate(minutes);
line(0, 0, 0, -90);
popMatrix();
// heures
strokeWeight(4);
heures += 0.3;
pushMatrix();
rotate(heures);
line(0, 0, 0, -50);
popMatrix();
//spirale
for(float i =0;i<mouseY-100;i++){
rotate(10);
fill(0,255,0);
ellipse(i,0,0.5,0.5);
}
}
Thank you again for your help !
I created a code about a crazy clock ^^ , when the mouse is down, it change color and make appears a spiral but i wonder 2 questions :
1- why my arrows are less fast when my mouse is down/change blackground ?, it's cool but i don' t understand because this arrows are doing this, it was not my intention at first, so i would like to understand ^^
2- I tried to create a Mousepressed code to animate slowly the spirale when i click with my mouse but unfortunately i didn't succeed, could you me help please ?
This is my code to illustrate my questions :
float secondes;
float heures;
float minutes;
void setup() {
size(200, 200);
smooth();
}
void draw() {
background(0);
// Dessin de l'horloge
translate(width / 2, height / 2);
strokeWeight(6);
stroke(255,0,0);
ellipse(0, 0, 200, 200);
// secondes
strokeWeight(1);
fill(0);
secondes +=0.02;
pushMatrix();
rotate(secondes);
line(0, 0, 0, 95);
popMatrix();
// minutes
strokeWeight(2);
minutes +=0.1;
pushMatrix();
rotate(minutes);
line(0, 0, 0, -90);
popMatrix();
// heures
strokeWeight(4);
heures += 0.3;
pushMatrix();
rotate(heures);
line(0, 0, 0, -50);
popMatrix();
//spirale
for(float i =0;i<mouseY-100;i++){
rotate(10);
fill(0,255,0);
ellipse(i,0,0.5,0.5);
}
}
Thank you again for your help !
1