We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'd like to create a program that has one image on top of the other and then when I move the cursor, the top image is erased to reveal the bottom one. But I'm a total beginner and have no clue where to start. Does anyone have advice on how I could achieve something like this? I've managed to code so that one image loads but I can't figure out how to overlay a second one or to do the interaction bit.
Answers
You can just call image () twice with the same coordinates and the second image will obscure the first.
But in your case I think the second image should be a pgraphic. You can then modify this, draw things on it, change the transparency of parts of it so that the first picture shows through.
https://processing.org/reference/PGraphics.html
Thank you so much for your response. In order to make the second image a Pgraphic, do I have to tell it to to load the image somehow?
please don't post duplicates
your code from the (now deleted) duplicate:
you've assigned both images to img, it's no wonder it won't work. define a second image and use that instead.
I apologize for the double posting. I didn't think I was supposed to post code in the "How To" section - sorry! Thank you for your help.
(you can edit the category using the cog at the top there)