Last active
November 7, 2017 16:58
-
-
Save n1ckfg/4027625 to your computer and use it in GitHub Desktop.
Use modulo to time actions independently of frame rate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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