Click to See Complete Forum and Search --> : animation


angel7
11-30-2002, 03:52 AM
how can i made simple animation-one image changing another usinf java script who know please answer me at my e-mail annamaria20017@mail.ru

Paco Zarabozo
11-30-2002, 04:19 AM
This script would change images every 5 seconds:

<html>
<img src="x.gif" border="0" name="myimg">

<script>
var imgs = new Array();

//Specify here how much time should be between changes (seconds):

var time = 5;

//Put here as much images as you want:

imgs[0] = "1.gif";
imgs[1] = "2.gif";
imgs[2] = "3.gif";
imgs[3] = "4.gif";
imgs[4] = "5.gif";
imgs[5] = "6.gif";
imgs[6] = "7.gif";
imgs[7] = "8.gif";

var i = 0;

function changeImg() {
document.images['myimg'].source = imgs[i];
i == imgs.length ? i=0 : i++ ;
setTimeout('changeImg()', (time*1000));
}
changeImg();
</script>

</html>


I hope this to help.

Paco.