Particle Systems in Java
Here is a simple particle system animator I wrote for fun. The idea is that the applet contains a source of glowing particles which are ejected at a given angle and amoount of spread. The source of the particles may be at a point or spread over an area. Other options include adding gravity and random kicks to the motion of the particles. After each frame, one or more image processing operations are applied to the image. Finally, a suitable color map is used to display the images.
You will need a fast machine to get any speed out of the animation if you turn on too many operations at once.
This applet requires Java 1.1, so users with older browsers will be out of luck. Also note that the applet runs much faster in Internet Explorer than Netscape.
The checkboxes at the bottom are used to turn on and off actions and filters. These are:
Particles - the particle system itself.
Orbiter - Moves the particle system around the applet.
Move Up/Down - Scrolls the image up or down. Selecting both of these is pointless.
Move in/out - Zooms the image in or out
Blur Vertical/Horizontal - Blurs the image
Diffuse - Diffuses pixels around the image. This appears twice tso that you can try it before or after blurring.
Twirl - Distorts the image in a spiral pattern.
Ripple - Provides a "water-ripple" effect. This only really works if all other effects are turned off.
Fade - gradually fades the image. This is provided in two strengths.
Clear - Clear the image. This overrides any other effects and if useful if you want to see the particles without effects or trails or want to clear out stuff left from previous settings.
Note that these effects are written for speed, not accuracy so there may be artifacts due to lack of mathematical accuracy or incompetence.
You can vary parameters for the particles and orbiter using the tabs and sliders. The particle settings are:
Rate - The rate at which particles are emitted.
Angle - The angle of emission. 0 is up.
Spread - The spread around the emission angle.
X/Y/Scatter - The particles are emitted at at points scattered around X%/Y% across the applet.
Colour - the initial color of emitted particles.
Gravity - Gravity
Friction - Friction which slows particles down when less than 1, or speeds them up if greater than 1.
If you want to play with this, here's the source. It requires a couple of classes from the filter library to create the colormaps, but you could quickly hack up your own colormaps instead. [I'm not allowed to release the source of the filter library at present]
Here are a few example particle animations which used to be on this page.