Given that canvas
is a canvas element or an OffscreenCanvas
object,
const context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
More Related Contents:
- HTML5 Canvas Resize (Downscale) Image High Quality?
- Resize image with javascript canvas (smoothly)
- HTML5 Canvas camera/viewport – how to actually do it?
- Capture frames from video with HTML5 and JavaScript
- How to use Google fonts in Canvas when Drawing DOM objects in SVG?
- addEventListener for keydown on Canvas
- Load image from url and draw to HTML5 Canvas
- Save canvas as jpg to desktop [duplicate]
- HTML canvas – drawing disappear on resizing
- canvas getContext(“2d”) returns null
- clearing circular regions from HTML5 Canvas
- How to detect shape on a transparent canvas?
- HTML5 Canvas API – formatting individual words with italics
- Scaling an image to fit on canvas
- True Isometric Projection with HTML5 Canvas
- Maximum size of a element
- Get a pixel from HTML Canvas?
- Can I turn off antialiasing on an HTML element?
- Getting binary (base64) data from HTML5 Canvas (readAsBinaryString)
- Any way to clone HTML5 canvas element with its content?
- PHP+JS: How to do Fileuploads in HTML Form as Content-Type Multipart (via JS)?
- Text wrap in a element
- Image manipulation and texture mapping using HTML5 Canvas?
- How to pixelate an image with canvas and javascript
- getting mouse position with javascript within canvas
- Draw HTML5/Javascript Canvas Path in Time
- draw 10,000 objects on canvas javascript
- How to implement SVG’s preserveAspectRatio=”xMinYMin slice” for canvas drawImage method.
- Converting Chart.js canvas chart to image using .toDataUrl() results in blank image
- how to animate drawing lines on canvas