Dynamic Mask // ver B

_20080522_dynamicMask_b
download—view the code

How do you use it?
Just move the mouse around. This doesn’t run in a browser because it requires disk access to write a file.

What is it?
Simulates a “spotlight” effect by masking an image with PImage’s mask method. The mask method requires two image files: the image that will be masked, and a grayscale image for the mask itself. This sketch demonstrates a way to make a dynamic mask… Before the photo is displayed, the mouse movements position a white circle on a black background. This is then saved as a TIF file that is immediately loaded back into the program as the mask. Because this happens in each cycle of the draw() loop the mask functions interactively.

The look of ambient light is the result of the “black” color in the alpha image being not-quite-black. It is therefor interpreted as very slightly transparent rather than opaque. The circle is filled with pure white which results in the transparent area of the mask.

Comments are closed.