Felix shows how to use Physics to make the ball move in a realistic manner. (Sometimes the implementation of the effect of gravity uses a technique that is chosen for speed of execution rather than for strict adherence to the laws of nature). As usual, Felix comments the code thoroughly for your benefit. The code follows the graphic in action. Refresh the screen for a different output; the ball will restart from the centre of the box with a different random velocity. If BallTrajectory does not run in your current browser, please try another (such as Chrome).
Ellipse, FillRectF, BeginPath, Fill, ClosePath