Is there a way to detect if a div png background or png image part is transparent by hittest using another div as reference? Lets say, every time #char is over a pixel with opacity less than 100%, this will be detected and alerted. Is there a way to work this out with javascript or jquery?
$(document).ready(function () {
setInterval(moveChar, 20);
var keys = {}
$(document).keydown(function (e) {
keys[e.keyCode] = true;
});
$(document).keyup(function (e) {
delete keys[e.keyCode];
});
function moveChar() {
for (var direction in keys) {
if (!keys.hasOwnProperty(direction)) continue;
if (direction == 37) {
$("#char").animate({
left: "-=5"
}, 0);
}
if (direction == 38) {
$("#char").animate({
top: "-=5"
}, 0);
}
if (direction == 39) {
$("#char").animate({
left: "+=5"
}, 0);
}
if (direction == 40) {
$("#char").animate({
top: "+=5"
}, 0);
walk("down");
}
}
}
});