I got 3 frames to my animation and I'm trying to get it to play correctly. BUt, it will only play 1 frame of the animation. Here is my code:
function playHomeAnimation(){
var timer =0;
timer+=1;
if(timer==0){
document.getElementById('home').src="home3.jpg";
}
else if(timer==1){
document.getElementById('home').src="home2.jpg";
}
else if(timer==2){
document.getElementById('home').src="home1.jpg";
}
else if(timer>=3){
timer = 3;
}
else{
document.getElementById('home').src="home1.jpg";
}
setTimeout(playHomeAnimation(), 400);
playHomeAnimation();
}