Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 = 400,picwidth = 400;
int glovenumber = 700;
void setup() {
size(2000,2000);
// background(255, 123, 41);
background(0, 255, 226);
//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 < glovenumber; j++){
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;
}
//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("glovesrandom.png");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.