clearRect - method of the CanvasCtx object
Description:
Clears the pixels in specified rectangle
Syntax:
Object clearRect(Long x, Long y, Long width, Long height)
Parameters:
x | (Long) The x-coordinate of the left upper corner of the rectangle to clear |
y | (Long) The y-coordinate of the left upper corner of the rectangle to clear |
width | (Long) Width of the rectangle to be cleared (in pixels). |
height | (Long) Height of the rectangle to be cleared (in pixels). |
---|
Example:
The
ctx variable represents the drawing canvas (
CanvasCtx). The setup is done on the "
Draw" tab at the beginning of the script of drawing event
onDraw as follows:
var ctx =
pEvent.
GetCtx(1);
JavaScriptSelect and copy to clipboard
ctx.fillStyle = "blue";
ctx.fillRect(0, 0, 300, 150);
ctx.clearRect(20, 20, 100, 50);