Submit your widget

Image erasable effect with jQuery

Created 4 years ago   Views 19899   downloads 2543    Author boblemarin
Image erasable effect with jQuery
View DemoDownload 252.8 KB
59
Share |

This is a jQuery plugin that makes an image erasable (with mouse or touch movements)

This plugin replaces the targeted image by an interactive canvas that can be erased using touch or mouse inputs. You can specify a callback for completion and set the brush size.

Please note that I don't claim that the completion detection process is ultimately accurate. In fact you should rather use a completeRatio around 0.8 if you want a near-complete erase process.

To transform an image or canvas into an erasable canvas, just use this syntax :

$('#yourImage').eraser();

To specify a brush size, add some options (default value is 40) :

$('#yourImage').eraser( { size: 30 } );
// and you can also change the size later :
// $('#yourImage').eraser( 'size', 30 } );

You can reset the canvas (back to the original image) with this code :

$('#yourImage').eraser('reset');

Read more:https://github.com/boblemarin/jQuery.eraser