Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PImage img; // Declare a variable of type PImage
int x = 0;
int y = 0;
int bigdistance = 2000;
int distance = 100;
int gridpoints = (bigdistance/distance);
void setup() {
size(2000,2000);
background(0);
}
void draw() {
for (int j = 0; j < gridpoints-1; j++){
for (int i = 0; i < gridpoints-1; i++){
// Make a new instance of a PImage by loading an image file
int random = int(random(5));
if (random == 0){
img = loadImage("File 05-08-2018, 21 07 05.png");
} else if (random == 1){
img = loadImage("Photo 17-06-2018, 15 18 15.png");
} else if (random == 2){
img = loadImage("Photo 08-06-2018, 13 18 17.png");
} else if (random == 3){
img = loadImage("Photo 05-06-2018, 22 14 34.png");
} else if (random == 4){
img = loadImage("File 05-08-2018, 19 43 36.png");
}
img.resize(140,140);
// Draw the image to the screen at coordinate (0,0)
image(img,x,y);
//rect(x,y,10,10);
x += distance;
}
if ((x % distance) == 0){
x = (distance/2);
} else {
x = 0;
}
y += distance;
}
save("hexgrid1.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.