I'm making a game in javascript (for IE 10) that has a colision system. I want to colide the objects only when 2 visible parts colide, i want to ignore the transparent parts of the images.
Has any way to know if a position from an < img > is transparent or not?
getcolors() ). If the image is in RGBA mode, then presumably it has transparency in it, but it double-checks by getting the minimum and maximum values of every color channel ( img. getextrema() ), and checks if the alpha channel's smallest value falls below 255.
There is no background-opacity property in CSS, but you can fake it by inserting a pseudo element with regular opacity the exact size of the element behind it.
Images that have transparency often illustrate it by using a gray and white checkered pattern. The idea is that you can see which parts of the image will be transparent before you save it. The checkered pattern is the background. There's no transparency.
'Burn' the image into an HTML5 canvas, then get the specific pixel from the canvas and check its Alpha (http://falcon80.com/HTMLCanvas/PixelManipulation/getImageData.html).
I think it would be easier if you only worked with HTML5 canvas instead of moving around DOM segments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With