Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wonderburg7
Created September 16, 2018 12:27
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 wonderburg7/fa5927f6a934b123e2ffe67f7c571db3 to your computer and use it in GitHub Desktop.
Save wonderburg7/fa5927f6a934b123e2ffe67f7c571db3 to your computer and use it in GitHub Desktop.
int rectno = 4000;
int height = 4000;
int width = 4000;
int width2 = 210;
float height2 = (width2*1.618033);
int x;
int y;
color colour1;
int coin2;
void setup() {
size(4000, 4000);
background(1, 1, 1);
ellipseMode(CENTER);
rectMode(CENTER);
noStroke();
noLoop();
}
void draw() {
for (int j = 0; j < rectno; j++){
x = int(random(height));
y = int(random(height));
int coin2 = int(random(5));
if (coin2 == 0){
fill(255, 188, 66);
} else if (coin2 == 1){
fill(7, 134, 252);
} else if (coin2 == 2){
fill(35, 240, 199);
} else if (coin2 == 4){
fill(239, 69, 75);
} else {
fill(8, 3, 87);
}
rect(x, y, width2, height2, 50);
}
save("randorectangles1.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment