How Does the Google Search Katamari Easter Egg Work?
The Google Search Katamari easter egg turns a standard search results page into an interactive game inspired by Katamari Damacy. When you trigger the easter egg, a small ball appears on the screen that you can roll around using your mouse, touch, or keyboard. As the ball moves over text, links, and images on the page, it picks them up and sticks them to its surface, growing larger until you can roll up the entire page.
Triggering the Easter Egg
To start the game, you search for "katamari" on Google. On the results page, a small interactive icon or ball graphic appears in the knowledge panel or near the search results. Clicking or tapping this icon injects and initializes the JavaScript game engine directly on top of the live search results page.
Converting Page Elements into Rollable Objects
A standard webpage is built from a Document Object Model (DOM) tree of HTML elements like headings, paragraphs, spans, and images. To make these elements rollable, the easter egg's script scans the visible page and identifies individual leaf nodes or small blocks of content.
For each eligible element, the script measures its exact position and dimensions on the screen using browser layout APIs. It then detaches or clones those elements from the normal document flow, often replacing them with empty space or hiding the originals so the rest of the page layout does not collapse suddenly.
Physics, Movement, and Collision Detection
The game runs a continuous animation loop, typically using
requestAnimationFrame, to update the ball's position,
velocity, and rotation at 60 frames per second or higher.
- Input Handling: Mouse movements, touch drags, or arrow keys apply directional force to the ball, accelerating it across the viewport.
- Collision Detection: On every frame, the script checks whether the ball's current bounding circle overlaps with the bounding boxes of nearby page elements.
- Size Thresholds: Just like in the original video game, the ball can only pick up objects smaller than its current size. As more small words and icons stick to the ball, its radius increases, unlocking the ability to roll up larger headlines, thumbnails, and entire result blocks.
Rendering the Rolling Ball
When an element is picked up, it is attached to the ball's local coordinate system. The script uses CSS transforms or an HTML5 Canvas layer to rotate and scale the collected items along with the ball's movement. By updating the 2D or pseudo-3D rotation angles of each attached item relative to the ball's center, the browser creates the illusion that flat webpage text and images are tumbling together as a single, growing sphere.