Chrome Experiments!

March 17th 2009

Oh my... I couldn't wait any longer...





And many other cool ones here.

Now, if you want to know a bit of the background/making of...

Some months ago the guys at Instrument commissioned me for doing a experimental piece. This is the first time I get this kind of offer, I had total creative freedom (as long as the piece was cool :D). The experiment mainly had to demonstrate Google Chrome's performance.

First concept

The best thing to do here was to directly code it with Javascript. First needed to get a little framework done, a stats widget and then see where it could go. Then I started porting a super simple collision system in between circles I had in AS3, and mixed that with browser movement. So you could interact with a bunch of circles by shaking your browser. They liked the main concept so I continued developing it.

Google Gravity

At Hi-ReS! I was working on a experiment that consisted basically in the google homepage collapsing and you could play with the elements, throw them around and even search. It was done in flash with box2dflash and I did a custom editor for rebuilding the html layouts. Unfortunately I had to move to another project and the experiment development got stuck.

Back to this project, as I had a little physics engine going on they suggested using it for breaking elements of a site. At first I said that it couldn't be done because in html you can't rotate elements, then they replied with this link and I had to eat my words ;) Then I showed them the flash experiment and they seemed very excited about it. I was about to mention that still couldn't be done because I used Box2D and there wasn't a javascript version, but this time I googled first and, oh! surprise, a Japanese ported it! :D So it was all decided, it was the perfect chance to finish that experiment.

Javascript < Flash ?

It was all looking good then, it was all a matter of the browser being able to handle css rotations fast and at the same time use the box2d engine. And how surprised I was when I saw how fast it performed. Seriously, Javascript in Chrome almost reaches the speed of flash. (no, they didn't pay me to say this :P). Another good thing now was that it wasn't a flash hack anymore, meaning that in the original experiments I had images of the buttons, so in MacOS you would see the button using the Ubuntu skin. Not anymore as now uses directly the html elements \o/

Box2d-js improvements

Then it was time to do the usual process, the actual work, the hacks, refactoring, the addictiveness tests... Eventually faced the problem that box2d-js took a bit of time to load (5-10 seconds) because it loads many files... Well, not anymore! I managed to do a script to put all the files in one and also jsmined it, and I'll be sending the script to Yasushi later :D Glad to be able to contribute something back to box2d-js after all :)

Conclusion

Brilliant project, I may still submit another piece that it's half done, we'll see.

Now go and take a look at the code of each piece and feel free to reuse the code, in fact, I want to see a lot of websites "collapse". The code its really easy to reuse, just add the class "box2d" to any element you want to collapse, and the code will do the rest. If you do anything with it, post it on the comments down here please :)

30 comments written so far...

really cool project.
could you use this with the old phodoob site?
March 18th 2009
Carl
You kick ass.
March 18th 2009
hot chip
Impresionante! :-)
March 18th 2009
mmk
@Carl: Yeah, I've always wanted to put physics on that. Maybe on the v3.0? Some day I'll get the inspiration :D But remember, this is Javascript and not Actionscript ^^
March 19th 2009
mr.doob
they work real nice in safari on a mac too. FF not quite as good.
After hearing so much ranting over the year about the problems with Flash it is funny to see it all being reinvented in the browser with js!
March 19th 2009
gef
you know, I was going to be a big chrome fan, too. I even browsed ~40 pages of their comics. but when I actually downloaded chrome the next day it came out, it crashed to me several times after some totally harmless flash. I got pissed off (separate process per tab? rrrright) and uninstalled it... so my point here is that, unfortunately, I cannot enjoy your kick-ass-ness this time :(
March 19th 2009
makc
Ah, you know, the experiments won't get deleted, so I'm sure that sooner or later you'll see them ;)
March 19th 2009
mr.doob
Works perfectly in Opera too ;)
March 26th 2009
samoth
No, it doesn't. In Opera the elements do not spin.
March 26th 2009
mr.doob
I used your code for part of my April Fool's Day joke on my site. Thanks! Check it out at endingb.net.
April 1st 2009
Eric
Haha! Nice one! :D
April 1st 2009
mr.doob
very good work !!!!!!!!!
April 19th 2010
mimir
I'm late on this one, but... my god man, that's astounding. Such great work! And thanks for sharing the code.
May 26th 2010
Rob
I'm late on this one, but... my god man, that's astounding. Such great work! And thanks for sharing the code.
May 26th 2010
Rob
Oh geez. Like a moron, I clicked back to this page from another and it reposted my comment. Ah well. Your work is so good it's worth complimenting twice. If not thrice :)
May 26th 2010
Rob
So how do I use the code on my website I don't get it? I got told to do this on facebook so this is how I've found this link, just wanted to say it's very cool and I can see you've put a lot of work into it! Well done!

And oh yeah, after you've used it can you take it off?
May 27th 2010
freebiejeebies
rob google gravity is cool but you suck ballz
May 27th 2010
morter kobat
great work.
August 28th 2010
Eishwarya
Abc123
August 30th 2010
Fred
%20AND%201=1
August 30th 2010
anonymous
%20AND%201=2
August 30th 2010
anonymous
AND 1=1/*
August 30th 2010
anonymous
AND 1=2/*
August 30th 2010
anonymous
' AND 1=2/*
August 30th 2010
anonymous
' AND 1=1/*
August 30th 2010
anonymous
' AND 1=2/*
August 30th 2010
anonymous
' ORDER BY 1/*
August 30th 2010
anonymous
' ORDER BY 1/*
August 30th 2010
anonymous
mkl543' UNION ALL SELECT 0x585858535441525444554D50585858/*
August 30th 2010
anonymous
mkl543' UNION ALL SELECT null,0x585858535441525444554D50585858/*
August 30th 2010
anonymous

Have your say!

Name:

Website:

Comment:

Some of the projects that I worked on.



Some of the HTML5 and Actionscript experiments I've done.