Skip to content

Instantly share code, notes, and snippets.

@sighrobot
Created December 12, 2013 20:07
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 sighrobot/7934521 to your computer and use it in GitHub Desktop.
Save sighrobot/7934521 to your computer and use it in GitHub Desktop.
Generates layers of triangles with semi-random dimensions
int i = 0;
int j = 0;
boolean run = true;
void setup() {
background(#ffffff);
size(600, 600);
frameRate(1000);
}
void draw() {
if (run) {
stroke(#808080);
strokeWeight(random(1, 10));
fill(0, 0, random(63, 255));
triangle(0, 0, i, 0, 0, i);
i++;
if (i == width - j) {
i = 0;
j = j + (int) random(10, 100);
}
if (j >= width) run = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment