Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Last active November 7, 2017 16:58
Show Gist options
  • Save n1ckfg/4027625 to your computer and use it in GitHub Desktop.
Save n1ckfg/4027625 to your computer and use it in GitHub Desktop.
Use modulo to time actions independently of frame rate
int frameDivider = 1;
void setup(){
size(640,480);
frameRate(24);
}
void draw(){
if (frameCount % frameDivider == 0) {
background(random(255));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment