I am working on a project in processing at the moment and I would like to import a different random image for each frame every time. Is this even possible? ideally I would like to fill a folder with images and have the program pull a different random image each frame but I am unsure if this can be done. Code to pull a single image is below.
I would think putting loadImage in the draw loop would work, but is there a way to call a random image from a folder?
PImage myImage;
void setup() {
size(400, 400);
myImage = loadImage("wood.jpeg");
myImage.loadPixels();
}
void draw() {
image(myImage, 100, 100, 200, 200);
}
Aucun commentaire:
Enregistrer un commentaire