Reference erase()

erase()

Starts using shapes to erase parts of the canvas.

All drawing that follows erase() will subtract from the canvas, revealing the web page underneath. The erased areas will become transparent, allowing the content behind the canvas to show through. The fill(), stroke(), and blendMode() have no effect once erase() is called.

The erase() function has two optional parameters. The first parameter sets the strength of erasing by the shape's interior. A value of 0 means that no erasing will occur. A value of 255 means that the shape's interior will fully erase the content underneath. The default value is 255 (full strength).

The second parameter sets the strength of erasing by the shape's edge. A value of 0 means that no erasing will occur. A value of 255 means that the shape's edge will fully erase the content underneath. The default value is 255 (full strength).

To cancel the erasing effect, use the noErase() function.

erase() has no effect on drawing done with the image() and background() functions.

Examples

Syntax

erase([strengthFill], [strengthStroke])

Parameters

strengthFill
Number:

a number (0-255) for the strength of erasing under a shape's interior. Defaults to 255, which is full strength.

strengthStroke
Number:

a number (0-255) for the strength of erasing under a shape's edge. Defaults to 255, which is full strength.

Notice any errors or typos? Please let us know. Please feel free to edit src/color/setting.js and open a pull request!

Related References