Generating time specifies flashes
in
Programming Questions
•
10 months ago
Hi all,
I'm v. new to Processing and could do with a couple of pointers. I'd like to have a screen with four rectangles flashing ON and OFF independently. The flashing rates are different for each rectangle, and for every ON and OFF period. As the flashes will be happening very quickly are there any tips to avoid frames dropping? I need to have the flashing as precise as possible.
The code I have below is the first step, I just need to add the flashing!
I'm v. new to Processing and could do with a couple of pointers. I'd like to have a screen with four rectangles flashing ON and OFF independently. The flashing rates are different for each rectangle, and for every ON and OFF period. As the flashes will be happening very quickly are there any tips to avoid frames dropping? I need to have the flashing as precise as possible.
The code I have below is the first step, I just need to add the flashing!
void setup() {
size (500,500);
background (255);
smooth();
}
void draw() {
//Top left square
rectMode(CENTER);
noStroke();
fill(122);
rect(250,150,100,100);
delay(500);
//left square
rectMode(CENTER);
noStroke();
fill(122);
rect(100,250,100,100);
//right square
rectMode(CENTER);
noStroke();
fill(122);
rect(400,250,100,100);
//Bottom right square
rectMode(CENTER);
noStroke();
fill(122);
rect(250,350,100,100);
}
1