early animation trigger with timeout()
hey guys,
i have a small problem not directly adressed by jquery but it is about a jquery animation.
- i have a sequence where a stone is moved from one position to the next and so on
- this is done by a for() loop where the function stone_move() is called
- the animation is a jquery animate()
i use following code:
- var time = 0;
- for (var i = 0; i < ende; i++) {
- ...
- setTimeout(function(){stone_move(...)},time);
- time += 800;
- };
the problem now is that the last movement is shown immeadiatly and all other movement animations are skipped. i want something like this:
- time = 0 //1. Movement of Stone
- time = 800 //2. Movement of Stone
- time = 1600 //3. Movement of Stone
- ...
- Duration of animation = 700ms
- --> mathematically a sequence of 3 moves should take 2500ms in total
hope you can help me -> my head is spinning around right now