clear-canvas
Clear canvas.
Installation
npm install clear-canvas --save
Usage
var clear = ; ; // ctx is canvas 2D context.
Demo
Checkout the live demo.
clear = ; //canvas setupvar canvas = document;canvaswidth = '500';canvasheight = '300';canvasstyleoutline = "1px solid black";documentbody; // Get the context.var ctx = canvas; // Draw a triangle.ctx;ctx;ctx;ctx;ctx;ctx; // Clear the canvas after 1000ms.;
API
;
ctx
: 2D canvas context.
saveTransform
: [Optional] Defaults to true
, need if you need to preverse the state.