Dan's Comments

Introduction

We present here some new particle examples which make use of the same basic classes as 'AS3 Experiment: A Bitmap Rotated in 3D Explodes into Particles' applet (some slight modifications of the classes were made to add new features).

Each of these applets presents a collection of particles whose positions evolve according to functions of various parameters, including slider values changeable by the user. Some of the applets make use of the red, green, and blue instance variables of the custom Particle3D class. One applet makes use of the vel and accel instance variables of the Particle3D class to store 3D velocity and acceleration vectors which govern the motion of the particles.

In each applet, a slider is provided to change the amount of depth-based color alteration to use. Particles further from the observer are given a darker color. Depending on the parameters set in the programming, the depth darkening method of the RotatingParticleBoard class also allows for particles to be brightened beyond their original color, so that particles closer to the observer may be shifted towards white.

A slider is also provided in each applet to allow the particles to be moved towards or away from the observer, by changing the recess parameter of the RotatingParticleBoard class. In two of the applets, a checkbox allows the user to decide whether or not the depth-based lighting is shifted with the recess.

Brief notes for each applet

Particle Waves:
In this applet, a collection of randomly colored particles is created (using a simple NoiseParticleMaker class) and given random x and y coordinates constrained to a square. Each particle’s z-coordinate is set as a function of time and the particle’s x and y coordinates. A slider changes the particles’ x and y-coordinates: the x and y coordinates are interpolated between their original, random position, and a color-based position (the particles are sorted by their red and blue color components).

Color Cube:
Here, a slider causes the position of the randomly colored particles to be interpolated between two positions. The first position is a random position within a cube. The second position is also in a cube, but the x, y, and z coordinates of each particle are determined by the particle’s red, blue, and green color components. The particles are pushed outwards toward the walls of the cube for a more aesthetic visual effect.

Orbiting Particles:
Particles are given random positions on the surface of a sphere, and are given initial velocities tangential to the sphere, representing a rotation of the sphere on the z-axis. The positions of the particles then evolve according to a simple gravitational attraction towards the origin. This applet makes use of the vel and accel instance variables of the Particle3D class to store 3D velocity and acceleration vectors. The particles in this applet were given a uniform color as an aesthetic choice, but a modified version of this applet could color the particles differently. For example, a gradient could set the color of the particles according to their initial positions.

Sphere Separation:
In this applet, particles are given random colors and random positions on the surface of a sphere. Sliders shift particles in three perpendicular directions according to the particles’ red, green, and blue components, respectively. More specifically, particles are shifted in the negative or positive direction depending on whether the given color component is greater or less than 50%.

Dan Gries
www.dangries.com
info@dangries.com

Download

The zip file linked above contains all the 'as' and 'fla' files related to this experiment.

Back to Advanced and Experimental              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. To contact us, email Barbara Kaskosz at barbara@flashandmath.com, Doug Ensley at doug@flashandmath.com, or Dan Gries at dan@flashandmath.com.

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