Timing with mills()
in
Programming Questions
•
11 months ago
Hi,
I am a beginner and I am having trouble with mills(), I have 16 ellipses or "lights" and I want to control when they appear at certain times and time in between etc but I just can't figure it out...
Hope someone can help!
Here is my code.
void setup() {
size(1000, 1000);
}
void light1() {
ellipse(200, 100, 55, 55);
}
void light2() {
ellipse(200, 300, 55, 55);
}
void light3() {
ellipse(200, 500, 55, 55);
}
void light4() {
ellipse(200, 700, 55, 55);
}
void light5() {
ellipse(400, 100, 55, 55);
}
void light6() {
ellipse(400, 300, 55, 55);
}
void light7() {
ellipse(400, 500, 55, 55);
}
void light8() {
ellipse(400, 700, 55, 55);
}
void light9() {
ellipse(600, 100, 55, 55);
}
void light10() {
ellipse(600, 300, 55, 55);
}
void light11() {
ellipse(600, 500, 55, 55);
}
void light12() {
ellipse(600, 700, 55, 55);
}
void light13() {
ellipse(800, 100, 55, 55);
}
void light14() {
ellipse(800, 300, 55, 55);
}
void light15() {
ellipse(800, 500, 55, 55);
}
void light16() {
ellipse(800, 700, 55, 55);
}
void draw () {
int startLoopTime = millis();
smooth();
background(0);
if (millis() < startLoopTime+1000) {
light2();
}
else {
light3();
}
}
1