The goal of this "app" is control a ball with the keyboard using events.
Add a keyboard event listener that changes the speedX and speedY using the WASD keys:
'W' increase SpeedY
'S' decrease SpeedY
'A' decrease SpeedX
'D' increase SpeedX
Add an event listener to the window that calls one function to update the speed.
Make sure the SpeedX and Speed Y never go too fast.
In the draw function, change the x and y position using the speedX and speedY variables.
If the circle is outside the canvas then move it to the other side. For example, if the ball is over the right side of the canvas, then move it to the other side. Make sure the ball is all of the way off the edge before moving it, otherwise it may pop.
8 freelancers estão ofertando em média $41 para este trabalho
This seems a fun project. I will do it for you in the next 24 hours (when i will get a 2 hours break...), and came back to you to show my result. Best regards, Alex.