JavaScript plugin for scratch effect.
... just manual. for now.
...
scratch({
wrapper: document.getElementById('scratch'),
imageUrl: 'scratch.jpg',
lineWidth: 60,
useBrush: true,
autoScratch: true,
mode: scratch.MODE_WITHOUT_MOUSEDOWN,
onInit: function() { ... },
onComplete: function() { ... },
onScratch: function(e) {
// e.percent
}
});
DOMElement wrapper (required) - a DOM element where the canvas will be placed.
string imageUrl (required) - path to an image that will be scratched. Canvas will be resized to the image width & height.
int lineWidth (optional)
boolean useBrush (optional)
boolean autoScratch (optional)
object autoScratch: {delay: 5000} (optional) - delay in miliseconds
mode (required):
- scratch.MODE_WITH_MOUSEDOWN
- scratch.MODE_WITHOUT_MOUSEDOWN
function onInit (optional) - called when the image is loaded and canvas created.
function onComplete (optional) - called when user scratched the hole image.
function onScratch(event) (optional) - called every scratch movement. event object contains x, y and percent properties.
MIT