This is a remake of one of the first programmatic animations I did with Flash (AS2 at that time). I decided to translate it to AS3, looking for a better performance.
The pseudo swarm behaviour of the particles is obtained by combining the movement of the visible particles with the movement of a non-visible, reference particle.
Interestingly, the animation performed much better when I unified all Event.ENTER_FRAME handlers in one single place. Originally I made each particle and each trail listen to Event.ENTER_FRAME, removing the event listeners when destroying the particle. Now I only listen to Event.ENTER_FRAME in the Main class, and then loop through all instances to call each instance’s update() method.
The background color changes with time; one cycle should take 1 minute to complete. You can also click the background to toggle full screen mode.