xxxxxxxxxx
19
function setup() {
createCanvas(700, 400);
background(255);
rectMode(CENTER);
}
function draw(){
// the modulo operator % calculates the remainder.
// example: 24 % 25 = 24, 25 % 25 = 0, 26 % 25 = 1, etc.
// this if statement will evaluate True every 25 frames.
if (frameCount % 25 == 0) {
fill(random(255), random(255), random(255));
push();
translate(200, 200);
rotate(radians(frameCount));
rect(0, 0, 400, 20);
pop();
}
}