We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everybody, I've wrote that code but in this code i can draw a rectangle only at tenth frame.
//alpha channel for stroke
int a=255;
void setup () {
//size (1920,1080);
background(0);
frameRate(30);
fullScreen();
noFill();
}
void draw () {
fill(0, 50);
noStroke();
rect(width/2,height/2, width, height);
float x = random(width+20);
float y = random(height+20);
if(frameCount == 10) {
rectMode(CENTER);
strokeWeight(2);
stroke(125, 125, 125, a);
rect(width/2, height/2, x, y);
}
}
How can i draw a rectangle for every ten frame? I've tried to write a variable for frame count but it didn't work. Thanks for help.
Answers
Try
if(frameCount%10 == 0)
Check: https://processing.org/reference/modulo.html
Kf
Thank you so much kfrajer.