Import random image on mouseclick
in
Programming Questions
•
1 years ago
Hello,
It's been some time since I have last used processing, and thus stumbled upon a problem that might be simple to fix.
The idea is that I imported a random image when the mouse is clicked. With my current code, importing one random image is working fine, but i cannot manage to write anything with mouseClicked, that results in combining this with "void takerandomimage"...
I hope someone could help me out here. Thanks!
- PImage baseimage;
- int imagenumber;
- void setup()
- {
- size(640,960);
- background(0);
- noStroke();
- smooth();
- imagenumber = int(random(1,4));
- takerandomimage("base"+nf(imagenumber,2)+".png");
- }
- void takerandomimage(String fn)
- {
- baseimage = loadImage(fn);
- scale(random(0.1,0.24));
- image(baseimage,random(0,640),random(0,960));
- }
1