p5.js Image mask() Method
The mask() method of p5.Image in p5.js library is used to apply the given mask to the image. This is done by using the alpha channel of the mask image as the alpha channel of this image.
mask( srcImage )
Parameters: This function accepts a single parameter as mentioned above and described below.
- srcImage: It is a p5.Image that would be used as the mask to be applied.
The following libraries are included in the “head” section of the HTML page while implementing the following example.
Example: The example below illustrates the mask() method in p5.js library.
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/