We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello dear people! As many others, I'm also a beginner with Processing willing to execute certain idea and feeling helpless with that. The thing is following :
I want to create a loop constantly displaying random images from a folder, one by one, one image on top of another.
All of them should be displayed inside of one unchanged ellipse.
The constant reappearance of new images should be stopped when mouse is clicked. For that moment you would see the last image that appeared before you clicked. When you stop pressing the mouse button, the random image display would continue.
Here is what I've found to make the mask for an ellipse, but that is just one checkpoint. I still have no idea how to create that 'image lottery'.
PGraphics mask;
PImage img;
void setup() {
img=loadImage("0.jpg");
img.resize(1000,0);
size(img.width,img.height);
background(40);
mask=createGraphics(width,height);//draw the mask object
mask.beginDraw();
mask.background(0);//background color to target
mask.fill(255);
mask.ellipse(width/2,height/2,500,500);
mask.endDraw();
img.mask(mask);
image(img,0,0);
}
I will love you endlessly for your help!
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
Oh thanks! Now it is better, right ? But still, do you have any idea about the project I'm willing to make ?
simple draft
Hey! Thanks Chrisir! It runs quite nice. I tried to figure out what makes what in the code and adjust it a bit more for what I wanted. But I didn't succeed I must admit :-<
For example how can I put the images in that ellipse mask (so that they all appear inside of a circular frame in the center of the screen )? I centered them for now, but no idea how to create that ellipse mask. I wanted to apply the mask code I already posted above, but it said Cannot invoke mask (PGraphics) on the array type PImage[] _ .
Another thing is that the images display in their normal order from the folder and I wanted to make them come out at random order.
[]
operator:http://processing.org/reference/arrayaccess.html
yes, as gotoloop said
becomes
for random order please just use
i2 = random(maxImages);
Hey Chrisir! Where should that line for random be placed ?
after line 65 pls
btw you can get rid of stateMain
stateReadImages can be called stateShowImages