Assignment: Canvas Animation (Parts 1–2)

How to Use

Part 1: A square starts diagonally and bounces inside a bounded rectangle.

Part 2: Click the square to trigger an explosion, change its color, and randomize its direction. Clicking outside the square just nudges its path.

Keys: Space Pause/Play • P Toggle Path • R Reset

Device pixel ratio aware • Clean physics • Clear boundaries