how to repeat the sequence?
in
Programming Questions
•
1 year ago
hi,here i just learned how to play scenes one after another
but now i wonder how to repeat this sequence in a loop or say 5 times?
void setup(){
size(200,200);
frameRate(12);
}
void scene1(){
fill(255,0,0);
rectMode(CENTER);
rect(width/2,height/2,50,50);
}
void scene2(){
fill(0);
ellipse(width/2,height/2,50,50);
}
void scene3(){
fill(255);
line(0,0,width,height);
}
void draw(){
background(127);
int m=millis();
if(m<2000){
scene1();
} else if (m<4000){
scene2();
}else if(m<6000){
scene3();
}
}
but now i wonder how to repeat this sequence in a loop or say 5 times?
void setup(){
size(200,200);
frameRate(12);
}
void scene1(){
fill(255,0,0);
rectMode(CENTER);
rect(width/2,height/2,50,50);
}
void scene2(){
fill(0);
ellipse(width/2,height/2,50,50);
}
void scene3(){
fill(255);
line(0,0,width,height);
}
void draw(){
background(127);
int m=millis();
if(m<2000){
scene1();
} else if (m<4000){
scene2();
}else if(m<6000){
scene3();
}
}
1