diff --git a/lib/sketch.js b/lib/sketch.js index 1f5c62f..e60fa44 100644 --- a/lib/sketch.js +++ b/lib/sketch.js @@ -27,6 +27,15 @@ var __slice = Array.prototype.slice; return this; } }; + $.fn.clear = function () { + var sketch = this.data('sketch'); + if (sketch != undefined) { + sketch.context.clearRect(0, 0, sketch.canvas[0].width, sketch.canvas[0].height); + sketch.context = sketch.el.getContext('2d'); + sketch.actions = []; + sketch.action = []; + } + }; Sketch = (function() { function Sketch(el, opts) { this.el = el;