Enjoy a spectacular particle storm! In this experiment we use a bitmap filled with Perlin noise to create an acceleration field. The field controls the motion of thousands of particles creating a turbulent, dramatic effect. We use the BlurFilter plus a continuously altered ColorTransform to obtain the effect of fading trails behind the particles, which change color over time.
- Download all source files corresponding to this effect: perlinpixels.zip
Download the zip package linked above for complete, well-commented, and easy to customize source code.
In our snow display example Realistic 3D Snowfall Effect in ActionScript 3 and Flash, we illustrated and explained in detail how a bitmap filled with Perlin noise could be used to create an acceleration field for falling particles. Here we are applying a similar technique. This time, however, the particles are not Sprites; instead they are drawn as single pixels to a bitmap. This technique allows for a great increase in the number of particles that we can animate.
The basic idea is to apply an acceleration vector to a particle based on the color of a corresponding point on a Perlin noise bitmap. Each particle is represented by an instance of the AbstractParticle class. An AbstractParticle not a display object but rather just an abstract description of a particle and its attributes such as position, velocity, and color. Similarly, our AbstractParticleDisplay is not a display object, but rather just a class which collects methods for manipulating these abstract particles. The main fla file in the zip package makes use of these classes when drawing single-pixel particles to a bitmap.
Just download the code, take a peek, and play with it!