+25

How to run one JavaScript animation after another?

I created 2 JavaScript animation functions, and they run simultaniously. How can i make the second function run after the first one? https://code.sololearn.com/Wv7XGJ9f14jL/?ref=app

5/15/2019 4:45:18 PM

Hicham BOURHIL

4 Answers

New Answer

+9

You can call the second function after the first one finished like this: if (pos1 >= 200) { clearInterval(t1); t2 = setInterval(move2, 3); }

+21

Airree It worked, thank you very much 😊

+7

You can use promises as well uncomment lines 182-193 and comment line 180 https://code.sololearn.com/WM0pzE0DictQ/?ref=app

0

animation query in jquery can help