ericdrowell / KineticJS

KineticJS is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://www.kineticjs.com
3.98k stars 752 forks source link

how to make an eraser with kineticjs? #961

Closed yechoua closed 10 years ago

yechoua commented 10 years ago

I have in my stage two layer wich contain each an image (these images can be changed with some button) and now her my issue:

I'm trying to make an eraser that can erase on one of the two layer. I mean, i have the layerA that contain an image like a head and a layerB that content sunglass and I whant to be able to erase with a little circle a part of the glass and maybe a part of the head (like when hair are too ugly)

her a jsfiddle of what i have: http://jsfiddle.net/junkees/jA2V8/ I whant to be able to erase on the frog or on cup using kineticjs (not just a simple circle that "reveal" what is under the image, a real eraser, when i mousedown, it's erase and when i mouse up, he stop erasing)

thanx in advance for your help :)

yechoua commented 10 years ago

Here a jsfiddle with what i've done, i'll open a new issue bill because of the drag fonction http://jsfiddle.net/junkees/tf7m3/1/