cavas.clearRect(x1, y1, x2, y2)
Make transparent a rectangle defined by the bounding area of x1,y2 to x2,y2.
Parameters: x1 The x position of the first corner y1 The y position of the first corner x2 The x position of the second corner y2 The y position of the second corner
Example: // Fill a canvas with red and poke a transparent hole in the middle of it function makeTransparentHole(name) { var canvas = sb.getCanvas(name); var holeWidth = canvas.width / 3; var holeHeight = canvas.height / 3; canvas.fill(0xff0000); canvas.clearRect(holeWidth, holeHeight, 2*holeWidth, 2*holeHeight); }