adds CanvasRenderingContext2D.prototype.clear
JavaScript CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
LICENSE.txt
README.md
context_dot_clear.js

README.md

context.clear

Monkey-patches the 2D canvas context (CanvasRenderingContext2D) to include a clear method that clears the screen.

Usage (after including the library):

var canvas = document.querySelector('canvas')
var context = canvas.getContext('2d')

// ...draw some stuff...
context.clear()
// now it's all gone!

If canvas isn't supported, this silently fails.

It's a very short library. Enjoy!