Why the ball blinks when it falls? Please help me fix thank you😁 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why the ball blinks when it falls? Please help me fix thank you😁

https://code.sololearn.com/WUKCeJi0wyq4/?ref=app

28th Apr 2021, 7:57 AM
Hello
Hello - avatar
3 Answers
+ 1
From a quick look, I think setInterval() is the culprit, the canvas is cleared & rendered multiple times a frame, try migrating to https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame instead. Although I might be wrong...
28th Apr 2021, 8:14 AM
Shahil Ahmed
Shahil Ahmed - avatar
+ 1
FlamingArrow can I have the code?
28th Apr 2021, 9:14 AM
Hello
Hello - avatar
0
Charlotte 💕❤️😃 [Imaziue Coders] I don't really understand how your code works so I am afraid I can't fix it, but here is a very simple demo program for what you are trying to do. https://code.sololearn.com/WibnH08LDo7w/?ref=app
28th Apr 2021, 9:48 AM
Shahil Ahmed
Shahil Ahmed - avatar