particle systems

Particle systems have a huge number of uses in graphical simulation. Smoke, fire, and water in particular are often most efficiently emulated with a particle system. Each particle is a simple billboard with a number assigned to it to indicate its age. The transparency of the particle usually increases as it ages. Forces may also be applied to the particle system to simulate wind, gravity, etc.

var mapA = THREE.ImageUtils.loadTexture( "images/smoke.png" );
var cloud = new THREE.Object3D();
scene.add(cloud);
var psys = new SpriteParticleSystem({
  cloud:cloud,
  rate:3,
  num:300,
  texture:mapA,
  scaleR:[1,5],
  speedR:[0,10],
  rspeedR:[-0.8,0.8],
  lifespan:[3,4],
  terminalSpeed:10
});
psys.addForce(new THREE.Vector3(50,0,0));
psys.start();

Before creating the particle system, the texture used for the particles must be loaded and a "cloud" object created. The cloud object is the parent of the particles. The particle system object itself is called SpriteParticleSystem, and the arguments to the constructor are listed below. Note that the constructor is passed a literal JavaScript object containing all of the option settings. After creating, forces (if any) are added to the particle system using addForce, and then start is called to make the system ready for use.

cloud
User provided object that contains (is parent of) the particles.
rate
The approximate rate at which the particles are randomly generated per second.
num
The total number of particles in the particle system. Will never be exceeded. Particles are recycled when a new one is needed.
texture
The texture that will be visible on the particles.
scaleR
The size range of the particles.
speedR
The translational speed range of the particles (in a random direction).
rspeedR
The rotational speed range of the particles.
lifespan
The lifespan range of the particles in seconds.
terminalSpeed
The fastest the particles are allowed to move regardless of force.

1-2-three
example 17: particle systems