Where's My Basket?

Click the buttons to change the speed.

Objective
To make an object bounce and roatate on the canvas.

Problem
I did not know how to make the object rotate realistically.

Solution
The object is constantly rotated based on a math equation and it switches directions when it collides with a wall.