Code skill Add a Moving Ball

Create a ball using an object literal. Use the new <canvas> APIs to draw the ball as a white circle at the centre of the game board. Then make the ball move. Watch the ball move from the left of the board to the right of the board and then disappear from the screen.

To see the ball in the results section below you may need to refresh this page and scroll to the right.

See the Pen GB3 M2 by Walker Books UK (@walkerbooks) on CodePen.