This is an old learning project, rebuilt. The original was one of my first attempts at 3D on the web. Rather than leave it gathering dust, I rebuilt it in React Three Fiber, to see how much of what I'd learned the hard way the modern tooling now handles for me. It's simple on purpose: a spinning cube, one light, and a wall to catch the shadow. Move your mouse and the light follows, so the shadow swings and stretches across the back wall in real time.
useFrame runs every frame, and refs give it something to move. The cube's spin and the light's position both update there, outside React's render cycle.Swap the cube for cut-paper characters and the light for a flashlight, and this becomes a shadow puppet theater: a kid moves the light, and the characters' shadows loom, shrink and dance across the wall. Swap the art again and it's a spooky storybook page where you shine a light into the dark to find what's hiding, or a product viewer where shoppers light the item themselves instead of looking at one fixed photo.