+ 2

Hello, any solution so that the animation speed is not altered.

I have tried to solve the problem but I do not understand what happens, does anyone know any solution? https://code.sololearn.com/WKkuvu3fvMSh/?ref=app

20th Apr 2020, 4:44 AM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar
2 ответов
+ 3
<!--Cosider modifying script--> <script> var pos = 0; animation1(); function animation1() { if (pos >= 30) {animation2();} else { pos += 0.1; p.style.left = pos + "%"; requestAnimationFrame(animation1);; }; x.innerHTML = pos; }; function animation2() { if (pos <= 0) {animation1();} else { pos -= 0.1; p.style.left = pos + "%"; requestAnimationFrame(animation2); }; x.innerHTML = pos; }; </script>
20th Apr 2020, 5:36 AM
Absolute Zero ϟ
Absolute Zero ϟ - avatar
+ 3
thanks for the help, the truth is that I imagined the solution more or less like this but I didn't quite know how to write it. :)
20th Apr 2020, 7:31 AM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar