I saw this crazy wii ad yesterday. But I knew it could be done in the browser (not using flash like they did). So I stayed up all night last night and hacked together a demo...

This demo requires Safari. For best performance I suggest using a WebKit Nightly build. download nightly

Install the bookmark in Safari

Safari Toolbar

Click and drag gravity! up to your toolbar.

Now surf to any page (like Apple or Google or Yahoo!), press the "gravity!" button to enjoy. I suggest trying it on pages with images or forms or flash content.

gravity! mini map
Mini Map

Gravity! has a purple mini-map, which I wrote for debugging. The mini-map shows you what the page looks like from the perspective of the physics engine.

Yes, gravity! is slow. Even in Safari. It could have been written smarter, but this was really just a quick demo for a friend. I'm glad others have found it interesting. You're welcome/encouraged to take the code and make it faster. :)

All of the interesting source code can be found in import.js which is what the bookmarklet (source) inserts into any running page.

This was all made possible by the Box2d-js port of the Box2d physics engine.