Sprite MouseOver
EdwinToh opened this issue · comments
When rolling over a sprite that has transparency, the mouse actually tracks the transparent bits of the png as well, is there a way to track only the opaque pixels?
What do you mean by "tracking" the transparent bits?
Like if a PNG is a star, the PNG is a square right? When I add a mouseover event listener to it, the mouseover triggers over the entire PNG (which is a square). However I only want it to trigger when I rollover the start itself, and not the transparent bits.
I added a small function that demonstrate how to do this:
Here is the test file:
https://github.com/batiste/sprite.js/blob/master/tests/test_image_alpha_collision.html
Cheers
Thanks! It works perfectly!
Just realised that if I have a sprite sheet it detects the hidden frames as well.