API Docs for: 0.9.16
Show:

EmitterEntity Class

Defined in: phoria-entity.js:723
Module: Entity

Emitter is used to generate "particle" physics entities at a given rate per second with a flexible configuration of velocity and position starting point. The emitter itself is not rendered, but exposes a style config that is applied to all child particle entities. An event handler 'onParticle' is provided to allow further customisation of particles as they are generated.

Item Index

Methods

Methods

create

(
  • desc
)
Phoria.Entity
Factory create method - object literal Entity descripton:
{
   position: {x:0,y:0,z:0},    // used as the start position for particles - default (0,0,0)
   positionRnd: {x:0,y:0,z:0}, // randomness to apply to the start position - default (0,0,0)
   rate: Number,               // particles per second to emit - default 0
   maximum: Number,            // maximum allowed particles (zero for unlimited) - default 1000
   velocity: {x:0,y:1,z:0},    // start velocity of the particle - default (0,1,0)
   velocityRnd: {x:0,y:0,z:0}, // randomness to apply to the velocity - default (0,0,0)
   lifetime: Number,           // lifetime in ms of the particle (zero for unlimited) - default 0
   lifetimeRnd: Number,        // lifetime randomness to apply - default 0
   gravity: boolean            // true to apply gravity to particles - default true
   style: {...}                // particle rendering style (@see Phoria.Entity)
   onParticle: function() {...}// particle create callback function
}

Parameters:

Returns:

Phoria.Entity:

entity