chris_angell
07-12-2002, 06:08 PM
I am trying to animate several divs that animate at different intervals, but I can't work out how to ?? I can do it if I copy the code and give it a different function name..
etc animate1();animate2(); and so on.. this is a crap long way to do it, I would like to know an easier way to run animation divisions from the same function but going of at different set times ???? and also if I can loop those specific animations, say three times ??? so they repeat ????
here is my code,
<script>
var y=0;
var yMax1=436;
var yMax2=300;
function animateIt(){
if(y<=yMax1){
document.getElementById('animatedDiv').style.top=y;
document.getElementById('animatedlineDiv').style.top=y;
y=y+60;
setTimeout("animateIt()",10);
}
}
</script>
<input type="button" value="Move!" onClick="animateIt(1)">
<div id="animatedDiv"><img src="images/_black_arrow.gif" width="85" height="85"></div>
<div id="animatedlineDiv">
<img src="images/_black_lines.gif" width="128" height="2"></div>
thank you ... I hope it make sense ?? :thumbsup:
etc animate1();animate2(); and so on.. this is a crap long way to do it, I would like to know an easier way to run animation divisions from the same function but going of at different set times ???? and also if I can loop those specific animations, say three times ??? so they repeat ????
here is my code,
<script>
var y=0;
var yMax1=436;
var yMax2=300;
function animateIt(){
if(y<=yMax1){
document.getElementById('animatedDiv').style.top=y;
document.getElementById('animatedlineDiv').style.top=y;
y=y+60;
setTimeout("animateIt()",10);
}
}
</script>
<input type="button" value="Move!" onClick="animateIt(1)">
<div id="animatedDiv"><img src="images/_black_arrow.gif" width="85" height="85"></div>
<div id="animatedlineDiv">
<img src="images/_black_lines.gif" width="128" height="2"></div>
thank you ... I hope it make sense ?? :thumbsup: