Reputation: 442
Is it possible to draw with transparency like you would draw with any colour?
For example if i'm using a createGraphics()
you can use clear()
to make the canvas transparent, but what if I wanted to draw a black background with a see-through hole in the middle (draw a "transparent filled" ellipse that cuts through?).
Upvotes: 1
Views: 1379
Reputation: 42176
You could play around with the blendMode()
function. Here is the reference for the blendMode()
function.
Or you could call the set()
function on each pixel. Here is the reference for the set()
function.
Or you could look into using an image mask. For example, you could create an image with a transparent center ahead of time, and then display that over top your sketch.
Another option is to use the mask()
function. Here is the reference for the mask()
function.
Upvotes: 1