Skip to content

Instantly share code, notes, and snippets.

@pawal
Created September 16, 2020 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawal/a84edb64367dc5bbfc67999d8d74e9d8 to your computer and use it in GitHub Desktop.
Save pawal/a84edb64367dc5bbfc67999d8d74e9d8 to your computer and use it in GitHub Desktop.
flickering stuff for processing
// flickers and stuff
// by Patrik Wallström in processing
// pawal@amplitut.de 2020-09-16
// user settings
int growthRate = 64; // the higher the faster number of divides
int scanLines = 64; // number of lines per division
// random globals
int x1=1;
int xdivide = 1;
void setup() {
frameRate(60);
fullScreen(P2D,0);
background(0);
noStroke();
fill(102);
}
void draw() {
background(0);
int ydivide = width / (xdivide + 1);
for (int j = 0; j < xdivide+1; j++) {
int ystart = ydivide * j;
int yend = ystart + ydivide;
for (int i = 0; i < scanLines; i++) {
int row = (int) random(0,height);
stroke((int) random(0,255)); // change to x later..?
line (ystart, row, yend, row);
}
x1 = (int) (frameCount / 100) + 1;
xdivide = (int) frameCount / growthRate;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment