setTimeout pour opacifier
var myImg = document.getElementById('myImg');
function anim() {
var s = myImg.style,
result = s.opacity = parseFloat(s.opacity) - 0.1;
if (result > 0.2) {
setTimeout(anim, 50); // La fonction anim() fait appel à elle-même si elle n'a pas terminé son travail
}
}
anim(); // Et on lance la première phase de l'animation