Using the mask() method, you can create a mask for an image to specify the transparency in different parts of the image. To run this example locally, you will need two image files and a running local server.
Alpha Mask by p5.js Contributors and the Processing Foundation is licensed under CC BY-NC-SA 4.0.