I’d like to achieve an animation/sequence like this:
the animation starts with a loop (imagine a car moving from x1 to x2) then a pause of 1 second then again the animation (imagine a car moving from x2 to x3 etc)
the car loop is achieved adding 1px to the car left: value
but i cant figure out the nested loop how should work
i’m trying to do ti only using setInterval, no jquery
UPDATE: sorry i wasnt clear
but assume we have
var animation = setInterval(car_moves, 10);
how do i trigger this animation every 2 seconds, and the animation should last 0.5sec ?
Look, this is done with jQuery http://jsfiddle.net/qCx69/
interacting with
or without it (this one is not an optimized solution)
http://jsfiddle.net/8bZTA/1/
Updated:
You can even make a set of stops and motions (it can be update for variable speed too)
http://jsfiddle.net/hFH4U/5/