Instantly share code, notes, and snippets.

Embed
What would you like to do?
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