A 404 page is the one place where you're allowed to be silly. I made three small packages that let visitors wreck the page they are on: a black hole that swallows it, a spaceship that shoots it to bits, and a snap that turns half of it to dust. Each one has a "Put it back" button, and that button was the hard part.
Try them: https://fluri.xyz/black-hole/ · https://fluri.xyz/page-asteroids/ · https://fluri.xyz/page-snap/
<script src="https://cdn.jsdelivr.net/npm/@fluritheme/black-hole@1/dist/black-hole.global.js" data-auto></script> All three are free, MIT and have zero dependencies. They start from a small button, the Konami code, a timer or your own code.
Rule one: never touch the layout
If you remove or move real elements, the page reflows, things jump, and you can't promise to restore it. So the page is only ever changed with transform, opacity, clip-path and visibility, which don't affect layout. Before anything starts, each piece's own inline values for those properties are saved, and "Put it back" writes them back.
Choosing the pieces
The pieces are headings, paragraphs, images, buttons, list items and cards that are on screen. Three checks keep it sane:
- Never a piece inside another piece, or a card and its heading would fly apart.
- Nothing fixed or sticky, and nothing that covers more than about a third of the screen.
- For text, measure the words with a
Range, not the element. A heading's box is as wide as the page; the words are not.
Three ways to go
Black hole. The nearest pieces go first. Each gets a pull toward the hole plus a sideways push, so it spirals in, and it shrinks and spins faster as it gets close. The hole grows as it eats.
Asteroids. A ship flies over the page; every laser is a point checked against each piece's rectangle. While playing, clicks are stopped in the capture phase so nobody follows a link by accident.
Snap. Random pieces are wiped away with an animated clip-path: inset() while dust is emitted along the moving edge. The dust lives in one Float32Array, eight numbers per speck, so thousands of specks create no garbage. Images are sampled on a tiny canvas for their colours; if the image comes from another site without CORS, reading it throws, so that's wrapped in a try and the dust falls back to one colour.
For prefers-reduced-motion, the black hole and the snap become a calm fade, and the game drops its flying debris.
They're part of Fluri, my collection of interactive website effects. The npm packages are free; there's a no-code version for WordPress, Shopify and Wix.
Which one would you put on your 404 page?
npm: https://www.npmjs.com/package/@fluritheme/black-hole · https://www.npmjs.com/package/@fluritheme/page-asteroids · https://www.npmjs.com/package/@fluritheme/page-snap

