Particle animations with long-range forces

It's now time to transcend reality and start playing around with particles and physics. In this section, we'll be moving lots of particles around under the action of long-range forces and create some interesting patterns and animations.

In this section and the next, we'll generally be dealing with large numbers of particles and lots of calculations. To reduce any unnecessary overheads, we shall therefore make use of a slightly lighter version of the Ball class that we'll call Star. The Star class is similar to the Ball class, but does not draw a gradient fill and so does away with the extra code needed to do that. The remaining examples in this chapter will make use of the Star class.

Particle paths ...

Get The Essential Guide to Physics for Flash Games, Animation, and Simulations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.