Aug 11, 2008
back again with some funny isoStuff.
Here’s an optimized and enhanced version of the previous post, and with source code explained.
It now has dynamic colors and you can choose colors and size (for hi and low values).
See it moving
Ok now some explanation:
The main trick behind this (for who didn’t noticed) is that the code simply redraw at every frame just the first line of blocks. Then simply draw() that first line into a BitmapData that scrolls of a block size… and the trick lives!
Ok, speaking about optimization… two main things:
1. Draw it without a line (just fills) and it goes 2x faster
2. Even that first line (60 pieces only) was not actually so fast…
About this second point the code involved with sine-wave and dynamic colors calculation contains some math equation, but nothing can really send your CPU @100%. The main CPU draining comes from the visual/rendering part.
One solution I implemented in this experiment (and it’s a trick can be used very often) is simply draw into a bitmap even that first line without adding to childList the vector part. With this little trick fps went from 15 to 31 =).
Continue Reading »
Feb 24, 2008
I just edited the Fountain equalizer post adding the source code.
You’ll just need to download the two particles classes and copy the main code.
I received really a lot of requests about the code in the comments and by mail, and I am very pleased about this… means you liked it.
Expect more equalizing fun.
Dec 27, 2007
Here’s a new experiment.
It uses the computeSpectrum method together with a simple particles class i wrote.
I think the effect is graphically very satisfing and personally cannot stop to look at it.
The song is “Aria regina della notte” from Mozart’s “Flauto Magico”.
Tomorrow I’ll post code and sources of this.
Hope you’ll be hypnothized from this as I am.
The picture is not well explaining, you must see this in action.
Ok, sorry for the late but here we are with the source code:
Download the SimpleParticleGenerator and SimpleParticle class zipped togheter, then just use this code to build the equalizer.
I release the code just now because I wanted to wrap the main code in a class too, and maybe add some methods to scale it like a component, but I realized it’s totally unuseful for few lines of code, and I don’t wanna loose the fun part in the experiment.
I promise that from now I will be faster to release the source code
// Author: Pierluigi Pesenti
// Web: http://blog.oaxoa.com
var req:URLRequest=new URLRequest("mozart.mp3");
var sound:Sound=new Sound(req);
var ba:ByteArray=new ByteArray();
// create a sprite and add 1*samples istances of the SimpleParticleGenerator class
var _holder:Sprite=new Sprite();
for(var i:uint=0; i
Expect more equalizing fun.