HTML canvas clip() Method
Clip of a rectangular region of 200*120 pixels from the canvas. Then, draw a red rectangle. Only the part of the red rectangle that is inside the clipped area is visible:
// Clip a rectangular area
// Draw red rectangle after clip()
Try it yourself »
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the clip() method.
Note: Internet Explorer 8 and earlier versions, do not support the <canvas> element.
Definition and Usage
The clip() method clips a region of any shape and size from the original canvas.
Tip: Once a region is clipped, all future drawing will be limited to the clipped region (no access to other regions on the canvas). You can however save the current canvas region using the save() method before using the clip() method, and restore it (with the restore() method) any time in the future.
HTML Canvas Reference
Thank You For Helping Us!
Your message has been sent to W3Schools.