[Solved] Q. Why does the ball stops after moving once. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[Solved] Q. Why does the ball stops after moving once.

I want to set up a loop with the ball but its not moving constantly. https://code.sololearn.com/WaDnPDXVt40R/?ref=app

9th Dec 2021, 4:47 AM
Shobhit :)
Shobhit :) - avatar
3 Answers
+ 3
Instantiate the ball outside of the setInterval method. With your code as is, a new ball is created every 1000/60 ms.
9th Dec 2021, 5:27 AM
ODLNT
ODLNT - avatar
+ 4
Thanks ODLNT 🤗🤩
9th Dec 2021, 5:30 AM
Shobhit :)
Shobhit :) - avatar
+ 2
No prob..., keep up the good work! 👍
9th Dec 2021, 5:32 AM
ODLNT
ODLNT - avatar