Some weeks ago I did yet another chrome experiment for Instrument. In fact, it was a experiment I half started when I realised that with the css property -webkit-transform (and MozTransform) I could scale elements. So I ported my basic 3D engine to Javascript and I got it working in a few hours. But in the end I didn't finish that one.
So for this "second phase" I finished it, but this time using Google Image API. The end result looks like this:
Once I had this one done I got totally addicted to Javascript and wondered what else could I try. I have to say that the fact of being able to change the code from anywhere without having to recompile anything is priceless. I keep modifying the Google Sphere every week whenever I find new Javascript tricks, and to improve the movements a bit. The first iteration of the experiment used jsTween but found some problems with it (I actually don't remember what were the problems) and luckily I found JSTweener which with some modifications performed flawlessly.
Then I though about my good old DOF experiment with Papervision3D, and though how could achieve the same effect with Javascript. The trick is background offset. Just check this image and you'll understand :)
While working on this one I really missed the Hi-ReS! Stats because at the beginning it was going a bit slow with only 100 balls. So I ported the Stats to Javascript and thanks to this I ended up having 300 balls runing quite decently. This is how it looks like:
Of course, you'll need Google Chrome (win/linux/mac) to see all this in full glory.
So, apparently, Javascript is able to move a bunch of pixels these days. Next thing will be to render a actual polygon.
PS: Should I say that the sources are available? ;)
9 comments written so far...
Great work - inspiring. Are you doing any less Flash work? I've had the opinion for about 6 months that I think Flash will be used less and less for 'pretty websites'. I do Flex work (Flash Catalyst whoo hoo!) and I see Flash as a great tool for RIAs, but 'pretty' Flash... I donno. Computers are only get faster, Javascript engines are getting faster.
Well, right now Flash is in a difficult situation. For years Flash was perfect platform for designers that wanted their designs to be interactive and move. Then those designers improved their skills and needed more. Adobe created Actionscript 3 which made those designer/developers happy, but made a lot of designers unhappy. Now the problem is that from Flash 9 to Flash 10, there hasn't been much improvement. Everyone was expecting accelerated 3D and Adobe didn't delivered.
The actual situation is: Flash is too hard to code for a designer, and performs too slow for a developer.
Some people are moving to Unity3D and, in my case I saw how javascript was growing these days but I found that there weren't many good examples for the people to play with. That's why I'm these days doing mostly Javascript stuff.
Flash is still going to be around, but Adobe really need to do something about all this.
Just amazing! Too bad I'm not too fond of JavaScript as a language, so I'll just stick to Flash :) I'm curious to see where Flash will be headed in the near future, seeing this kind of stuff being done in JavaScript (and as you said, many people starting to use Unity3D), but I'm pretty confident there's no adobocalyptic scenario in sight just yet :)
Tksh: Nice one! Although that's one of the things I modified from JSTweener ;)
David: Yeah for sure, not the end of flash at all. But usually trends start with what people do in their free time. I still work every day doing flash stuff.
'Flash is too hard to code for a designer, and performs too slow for a developer.'
I agree that designers should not be coding at all, but AS being slow...well it depends on what you want to do.
Flash is not meant to do 3D work, and I don't think it ever will (or at least as well as others). At FITC I talked with Jim Corbett (SR flash engineer) and I told him that I believed that 3D is not Flash's domain and I hoped that the pursuit of 3D wasn't taking away from other parts of Flash R&D . He completely agreed and the impression I got was that Adobe management chose to throw 3D into Flash because 3D work is trendy these days.
If someone wants to make a game, I'd go with Unity, for website UI - I'd suggest JS like jQuery, for RIAs & Video I'd go Flash.
Your thoughts?
June 11th 2009
Alan
Well, it's hard to predict how it will all go. But it's easy to see how actionscript developers have been pushing the platform for a while now. Which was fun for a while, it was like a second chance for all the people that wanted to do 3D on MSDOS or Amiga but didn't had the knowledge.
Maybe now is the time for a 3D accelerated plugin, but as Adobe tried that 10 years ago and didn't work like Shockwave Flash they won't try again.
If they don't do that, then they'll have to fight with HTML5. And that will be a hard fight to win, specially when authoring tools start to appear.
Hey Doobster!
Sorry to dig up this old thread but I'm having a difficult time finding the source of your 3D port, would you mind posting or shooting me a link? It is a nice cross platform solution that I believe could be extended to use some of the fun new CSS3 Transformations sweeping the web. In fact, (this is just a research day for me so I'm considering a few options) I wanted to point you to some work by Zach Johnson with CSS3 Transforms in a cross-browser environment: http://www.zachstronaut.com/posts/2009/02/22/jquery-patch-css-transform.html. With some simple extensions, we could have a very lightweight 3D HTML engine for all sorts of fun effects.
You mean Threedoob for Actionscript?
I'm working these days making Threedoob for Javascript decent. Want to make it public/open source as soon as possible. But there are still a few things to fix.
What say you?