pour is lightweight particle system.
pour has a simple and straightforward API and embraces prototypal programming, keeping it below 4kb (minified). In addition, it supports both browser- and node-based environments. pour is licensed under the MIT license.
Let's simulate the path of a particle being attracted by a field.
To begin, we set up an empty particle system. A
System holds all
var system = pours; // shorthand for `new pour.System()`
We also set up an
Emitter that emits
Particles and add it to our
var emitter = poure // shorthand for `new pour.Emitter(…)`position: 250 250 // the position of the emittervelocity: 1 0 // the direction & velocity of the particlesspread: MathPI / 4 // 45 degrees spread (in radians);systemaddemitter;
Everytime we call
Emitter emits a new
var particle = emitteremit;
If we add the
Particle to the
System, we can compute its path by calling
system.tick(). Each call to
tick simulates one atomic step. All
Particles will then move according to their current
systemaddparticle;systemtick; // one step further…
By adding a
Field, we can influence all
Particles in our
System. A positive
mass of a
Field will attract them, a negative will repulse them.
field = pourf // shorthand for `new pour.Field(…)`position: pourv100 50 // shorthand for `new pour.Vector(…)`;systemaddfield;systemtick;
If you have a question, found a bug or want to propose a feature, have a look at the issues page.