How can i draw a rectangle for every ten frames?

edited August 2017 in Questions about Code

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.

Tagged:

Answers

Sign In or Register to comment.