Skip to content

Instantly share code, notes, and snippets.

@wonderburg7
Created September 16, 2018 12:22
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/5a6e8bd483b03e1cb70a942aa9cd3be0 to your computer and use it in GitHub Desktop.
Save wonderburg7/5a6e8bd483b03e1cb70a942aa9cd3be0 to your computer and use it in GitHub Desktop.
PImage img, img1, img2, img3, img4; // Declare a variable of type PImage
int x = 0;
int y = 0;
int bigdistance = 2000;
int distance = 200;
int gridpoints = (bigdistance/distance);
int picheight = 210,picwidth = 210;
void setup() {
size(2000,2000);
// background(255, 123, 41);
//background(0, 255, 226);
background(0);
//background(237, 26, 150);
imageMode(CENTER);
img1 = loadImage("one (1).png");
img1.resize(picheight,picwidth);
img2 = loadImage("one (2).png");
img2.resize(picheight,picwidth);
img3 = loadImage("one (3).png");
img3.resize(picheight,picwidth);
img4 = loadImage("one (4).png");
img4.resize(picheight,picwidth);
noLoop();
}
void draw() {
for (int j = 0; j < gridpoints; j++){
for (int i = 0; i < gridpoints; i++){
pushMatrix();
// Make a new instance of a PImage by loading an image file
int random = int(random(4));
/*x = int(random(2000));
y = int(random(2000));*/
if (random == 0){
img =img1;
} else if (random == 1){
img = img2;
} else if (random == 2){
img = img3;
} else if (random == 3){
img = img4;
}
img.resize(picheight,picwidth);
//translate(x+picheight/2,y+picwidth/2);
translate(x,y);
//translate(img.width/2, img.height/2);
//int twisty = int((random(360)));
rotate(radians(int(random(360))));
image(img,0,0);
x += distance;
popMatrix();
}
if ((x % distance) == 0){
x = (distance/2);
} else {
x = 0;
}
y += distance;
}
save("gloves.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment