Ghost on the Lake: AS3, Particles, Attractors, Pretty
Saturday 19 August 2006 - Filed under Flash
Well, this is the artsiest thing I’ve done in quite a while. I was playing around with AS3, decided to do a particle system. Got that working quickly so I started adding things to it. Plugged in a strange attractor algorithm, started coloring it, adding bitmap filters, etc. Started to look good and was just crying out for some musical accompaniment. Hopefully Moby won’t sue me.
Ghost on the Lake
Some cool things to note:
1. Althought it may sometimes appear to sync to the music, there is no relation. The shape is evolved using a single algorithm, varying a single property over time (plus 3D rotation). I just set the initial params and let it run. I did do some tweaking to find a good starting point, which param to change, and how much to change it, so that you get some decent shapes for the majority of the song, but once it starts, it’s on its own.
2. That’s 10,000 particles being rendered there! On very frame I plot them all out using the new parameters in the attractor algorithm, rotate them all on two axes, determine a color for each one, and then render it to a buffer bitmap, draw it to the main bitmap and the reflection and apply some filters. 10,000. Every frame. Yeah, it cooks your cpu, but it runs pretty decent even on my older mac mini. God I love AS3.
3. The whole thing (minus the music which streams) comes in at under 3k! Again, God I love AS3.
2006-08-19 » keith

19 August 2006 @ 7:32 pm
keith,
your swf does strange things to firefox on windows… when i close the new window, i see the following error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at GhostOnTheLake/::setupSound()
at GhostOnTheLake/::init()
at GhostOnTheLake$iinit()
when i dismiss or continue firefox crashes. i wonder if this could be exploited…
19 August 2006 @ 7:47 pm
wow!
can you publish the source so that I can learn something?
thanks anyway
19 August 2006 @ 7:58 pm
Yeah. I’ve noticed that on Firefox too. Gotta figure out what causes that.
For now, no source. Sorry.
19 August 2006 @ 8:48 pm
Nice. No error here, running FF 1.5.0.5, with player 9,0,16,0.
19 August 2006 @ 8:52 pm
Fascinating. I want more!
It doesn’t crash on my Firefox, I’m using v1.5.0.6 on winxp sp2, maybe it’s a Flash for Macs bug, I’ve seen one that crashes Firefox on a Mac before (the guy that found it out told me it could be something about protected memory)
19 August 2006 @ 9:28 pm
No problems in Firefox here. As for the experiment, I think I might just have to think about changing careers after seeing that.
Great piece of work Keith.
19 August 2006 @ 10:17 pm
I have seen that error at times. I wrote a complete MP3 player in flex/as3
2 July 2007 @ 9:48 am
Nice job! It’s nice to see such “outside-the-box” creativity being done with AS. Scripting with Flash is now just as much an art as it is a science as you have demonstrated with this experiment.
21 March 2008 @ 3:50 am
This is just beautiful. I love it!
I think the link to the Moby tune may be bad or something…I’m getting an error.
Great stuff. I’m starting to experiment with particles now (I guess everyone’s doing it). I just stopped by to check my CPU usage on this animation of yours to see if it was as heavy as some of the things I’m doing. Yep! But I think you know how to optimize better than I do…I’m working on it!
Flower Twist
RGB Sinks and Springs