How to make a smooth animation using inline scripts?
I am trying to animate a ball so that it moves across the screen. I am trying to do this by using an inline script.
I use the following function to draw the image of the ball on a new position:
but this leads to a "trail" of images, as can be seen below:
I've tried to expend my function by drawing a white square after I've drawn the ball, but this leads to a flickering effect.
So my question is, what is the correct way of doing this? I will look into drawing a new canvas each time, but I'm afraid that this will lower the refresh rate.