Last active
September 10, 2018 11:38
-
-
Save mikkoelo/0f6cd1d1ab964427f80e3fda8569d790 to your computer and use it in GitHub Desktop.
Processing_some_random_cats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PImage photo; | |
ArrayList<String> cats = new ArrayList<String>(); | |
void setup() { | |
size(500, 500); | |
cats.add("cat_1.jpeg"); // Replace the "cat_x.xxx" names with picture-names that you put into the program folder. | |
// It works best if the pictures are squares (e.g. 500 x 500) so Processing doesn't have to stretch them | |
cats.add("cat_2.jpg"); | |
cats.add("cat_3.jpeg"); | |
cats.add("cat_4.jpg"); | |
cats.add("cat_5.jpg"); | |
} | |
void draw() { | |
} | |
void mouseClicked(){ // The computer throws a dice and puts one of the images to the canvas every time you click mouse. | |
int i = int(random(cats.size())); | |
photo = loadImage(cats.get(i)); | |
photo.resize(500, 500); | |
image(photo, 0, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment