I just startd some lessons and thoughted i’d create a lil something. I’m trying to animate a small png with a sequence of images in it in it. But whenever i load the page the animation never runs. I was wondering if you think this makes sense.
CSS:
#face_ani {
position:absolute;
bottom:-2px;
left: 105px;
background:url(images/face_ani.png) no-repeat 0px 200px;
width:363px;
height:456px;
overflow: visible;
background-attachment:fixed;
}
Javascript:
window.onload = InitAll
var frameTotal = new Array(12);
function InitAll() {
if (document.getElementById(“face_ani”).style.backgroundPositionX<360+”px”) {
for (var i=0; i<12; i++) {
var int=self.setInterval(“anim(i)”,71);
}
} else {
var int=window.clearInterval(int);
}
function anim(frame) {
var currFrame = frameTotal[frame];
document.getElementById(“face_ani”).style.backgroundPositionX = (currFrame*12)+”px”;
}