Examples and Comments

Due to great popularity of our 'Particles Made of Light', we present four more examples with different effects added and more particles. In the process, we discovered incredible improvement in performance in FP 10.1 in comparison with FP 10. Click each screen shot to open a Flash movie. Download source code from the link below.

100,000 particles with performance monitor:
75,000 particles:
60,000 particles:
88,000 particles, interactive:


More 3D Particles Made of Light

Our recent post, Particles Made of Light, continues being very poular, and a few of our visitors asked us for more examples. We present them here. We added more particles, used a different depth-darkening method, added interactivity to one of the examples. And, of course, we used different coloring and different parametric surfaces.

One of the major updates in these new examples is a depth-based lighting method. Particles further from the viewer will contribute less light than nearer particles. The effect is subtle, but it creates a more pleasing sense of space to the particle display.

As in some of our previous examples, we are making use of colors which can be calculated in a fast way with bitwise operations. The colors used here are pure red, light cyan, light yellow, and gray. For example, light cyan is created by setting the green and blue components to equal a common value, and the red component equal to half this value. Cutting a quantity in half can be done with a fast bit shift operation. The other colors here are formed similarly; see the code for the details.

FP 10.1 versus FP 10

While testing our examples on several Windows and Mac machines, we noticed a very siginificant performance improvement in FP 10.1. Flash Player 10.1 runs 100,000 particles at 30 FPS comfortably, while FP 10 considerably slows down. The actual numbers depend on the platform. In our first example, we included a little perfomance monitor for easy testing. The monitor is an instance of our custom AS3 class BasicInfo.

The BasicInfo Performance Monitor

There are many AS3 performance monitors available. See our earlier post Testing Frame Rate of a Flash Movie for comments. Our BasicInfo monitor is very simple and provides information about frame rate and memory consumption.

To add the monitor to your movie, place the file BasicInfo.as (included in the package) in the same directory as your fla file, and add the following line of code to your Document Class or on the Timeline:

this.addChild(new BasicInfo());

The particles in this example are given x, y, and z coordinates in space according to equations in two variables s and t. These equations determine what is called a parametric surface. See our parametric surfaces grapher to play with parametric surfaces: Parametric Surfaces in Rectangular Coordinates.

Other Flash and Math particle effects

Back to Flash CS4 Tutorials              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.