Remember waiting for the DVD logo to hit the corner? Our new tutorial builds a square that bounces around and picks a fresh color every time it hits a wall, one piece of code at a time:
Try it here:
Remember waiting for the DVD logo to hit the corner? Our new tutorial builds a square that bounces around and picks a fresh color every time it hits a wall, one piece of code at a time:
Try it here:
Yo, this is a fun little concept! A square that bounces and switches color on wall hits pairs nicely with the idea of driving motion with velocity and feasting on random HSLs. These questions help you tune the feel of the animation without touching the core loop.
This is such a fun little project, and the DVD logo nostalgia is real. I like how simple the core loop is: position, velocity, flip direction on a wall hit, and pick a new color. Using requestAnimationFrame keeps it smooth, and the random HSL colors give it a nice playful feel without much extra code. I also agree with WaffleFries that it is a great way to practice velocity and collision logic. I might try adding a small trail effect or letting the square speed up slightly after each bounce. Thanks for sharing the tutorial, it is a great starter project.
:: Copyright KIRUPA 2026 //--
``` ```