We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hiya,
Very new to procession and just trying to sketch out an idea for work. I'm trying to create a sketch where the mouse is a torch revealing the image. the screen is totally black if the mouse is not in focus. Does anyone have any help regarding this?
Any help is mundo appreciated!
K
Answers
processing.org/examples/brightness.html
You are looking for an effect that some would describe as that created by a flashlight. I don't happen to have an example on hand, but I can describe the process required. You must display each pixel of the image individually, setting the alpha value to the distance between the pixel and the mouse.
If you want to have the screen go completely black when the mouse leaves the window, you will likely have to use a different approach to retrieving the mouse location, seeing as Processing's
mouseX
andmouseY
don't track the mouse outside of the canvas. You can get the mouse coordinates on the screen using the native Java classPointerInfo
. You will also need to accommodate for the relative position of the window by accessing the location in theframe
object.EDIT: And @XYZZY beats me to it...
http://bazaar.launchpad.net/~philho/+junk/Processing/view/head:/_QuickExperiments/_Interactive/RevealImage/RevealImage.pde
http://bazaar.launchpad.net/~philho/+junk/Processing/view/head:/_QuickExperiments/MaskImage/MaskImage.pde