Javascript erase image with cursor

送分小仙女□ 提交于 2019-12-19 04:07:17

问题


Is it possible with javascript?

I'm trying to implement a scratchcard type thing, and I was wondering if the user could 'scratch it' with his cursor and then javascript would remove/erase the image to show the text below.

But i've not been able to find anything (javascript wise) which can erase abit (cursor location) of an image.

Does anyone have any suggestions/ideas?

Thanks.


回答1:


Use html5 canvas element.

Checkout this fiddle for an example: http://jsfiddle.net/ArtBIT/WUXDb/1/




回答2:


jQuery Plugin: http://www.senamion.com/blog/jScratchcard.html

HTML5: http://www.catchmyfame.com/2011/06/28/a-jquery-canvas-scratch-off/



来源:https://stackoverflow.com/questions/11903404/javascript-erase-image-with-cursor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!