How Did Google Gravity and Google Sphere Work?

Classic browser experiments like Google Gravity and Google Sphere were not official Google Easter eggs, but rather third-party web experiments created by developer Ricardo Cabello, known online as Mr.doob. When users typed the name of an experiment into Google Search and clicked the I'm Feeling Lucky button, they were immediately redirected to the top search result, which hosted the interactive JavaScript simulation. Once loaded, these pages used client-side web technologies to manipulate the Document Object Model (DOM) and apply real-time physics or 3D transformations to a replica of the Google homepage.

The Role of the "I'm Feeling Lucky" Button

The "I'm Feeling Lucky" button bypassed the standard search results page and sent the user's browser directly to the first URL in Google's index for that query. Because Mr.doob's experiments—hosted on mrdoob.com—were extremely popular and heavily linked, they consistently held the number-one ranking for queries like "Google Gravity" and "Google Sphere."

This created the illusion that Google itself was transforming its own homepage. In reality, the user was leaving google.com and loading an external HTML and JavaScript page designed to look like the classic Google Search interface.

How Google Gravity Worked

Google Gravity (2009) simulated 2D Newtonian physics on the elements of the search page. Instead of relying on static CSS positioning, the script took control of every visible HTML element—such as the logo, search bar, buttons, and navigation links—and turned them into physical bodies.

  • DOM Extraction: On page load, the script measured the exact bounding box (width, height, and \((x, y)\) coordinates) of each HTML element.
  • Physics Engine: It used a JavaScript port of the Box2D physics engine (box2d.js) to create a virtual 2D world with gravity, collision detection, and rigid-body dynamics.
  • Real-Time Rendering: On every animation frame, the physics engine calculated the new position and rotation angle \(\theta\) of each body under gravitational acceleration \(g\). The script then applied these values back to the corresponding HTML elements using CSS transform properties (such as translate and rotate), allowing users to drag, throw, and collide the page elements with one another.

How Google Sphere Worked

Google Sphere (2009) used a different mathematical approach, arranging the page's elements into a rotating 3D sphere that reacted to the user's cursor.

  • Spherical Coordinates: The script distributed the HTML elements across the surface of a virtual sphere of radius \(R\) using spherical coordinates \((\phi, \theta)\) converted into 3D Cartesian coordinates \((x, y, z)\).
  • 3D Projection: Because early browsers lacked widespread hardware-accelerated CSS 3D transforms, the script calculated 2D screen projections manually in JavaScript. Elements further away along the \(z\)-axis were scaled down and given lower z-index values to create depth.
  • Cursor Interaction: Moving the mouse updated the angular velocity of the sphere, smoothly rotating all elements around the center of the screen while keeping the search functionality intact.

Over time, two changes ended the classic "I'm Feeling Lucky" workflow. First, Google introduced Google Instant in 2010, which began showing live search results as users typed, making the "I'm Feeling Lucky" button harder to click without disabling instant results. Second, modern browsers and search engines evolved, and many third-party mirrors or clones of the experiments appeared, diluting the single-click redirect. Today, the original experiments can still be experienced directly on archival sites and developer repositories.