We are about to switch to a new forum software. Until then we have removed the registration on this forum.
int del=200;
void setup() {
size(700,500);
rect(200,100,300,300);
rect(150,220,50,150);
rect(500,220,50,150);
}
void draw() {
fill(125,0,0);
leftred();
delay(del);
rightred();
delay(del);
leftwhite();
delay(del);
rightwhite();
delay(del);
}
void rightred() {
colorMode(HSB,500);
println("2 ");
fill(10);
rect(500,220,50,150);
}
void rightwhite() {
colorMode(HSB,500);
println("4 ");
fill(499);
rect(500,220,50,150);
}
void leftred() {
colorMode(HSB,500);
println("1 ");
fill(10);
rect(150,220,50,150);
}
void leftwhite() {
colorMode(HSB,500);
println("3 ");
fill(499);
rect(150,220,50,150);
}
//The above program has two rectangles on each side of the center rectangle whose color must change alternatively from black to white and vice versa. But it doesnt. Can someone explain to me why? Thanks in advance.
Answers
https://Processing.org/reference/delay_.html
Thanks GoToLoop. Is there any other way that I can do it?