Clears the pixels on the canvas.
clear()
makes every pixel 100% transparent. Calling clear()
doesn't clear objects created by createX()
functions such as createGraphics(), createVideo(), and createImg(). These objects will remain unchanged after calling clear()
and can be redrawn.
In WebGL mode, this function can clear the screen to a specific color. It interprets four numeric parameters as normalized RGBA color values. It also clears the depth buffer. If you are not using the WebGL renderer, these parameters will have no effect.
Examples
Syntax
clear([r], [g], [b], [a])
Parameters
r
Number:
normalized red value.
g
Number:
normalized green value.
b
Number:
normalized blue value.
a
Number:
normalized alpha value.
Notice any errors or typos? Please let us know. Please feel free to edit src/color/setting.js and open a pull request!