Emitter
Extends:
Direct Subclass:
Emitters are the System engine's particle factories. They cause particles to be rendered by emitting them, and store all particle initializers and behaviours.
Constructor Summary
Public Constructor | ||
public |
constructor(properties: object): * Constructs an Emitter instance. |
Member Summary
Public Members | ||
public |
age: * |
|
public |
behaviours: array The behaviours for particles emitted by this emitter. |
|
public |
Ensures that particles emitted by this emitter are positioned according to the emitter's properties. |
|
public |
Determines if the emitter will dispatch internal events. |
|
public |
|
|
public |
currentEmitTime: integer The current emit iteration. |
|
public |
The friction coefficient for all particle to emit by. |
|
public |
|
|
public |
emitterBehaviours: array The behaviours for the emitter. |
|
public |
|
|
public |
The emitter's internal event dispatcher. |
|
public |
The emitter's id. |
|
public |
The index of the emitter as it is added to the system. |
|
public |
initializers: array The initializers for particles emitted by this emitter. |
|
public |
Determines if the emitter is emitting particles or not. |
|
public |
life: * |
|
public |
|
|
public |
parent: * |
|
public |
particles: array The particles emitted by this emitter. |
|
public |
The number of particles to emit per second (a [particle]/b [s]) |
|
public |
totalEmitTimes: integer The total number of times the emitter should emit particles. |
|
public |
The class type. |
Method Summary
Public Methods | ||
public |
addBehaviour(behaviour: Behaviour): Emitter Adds a behaviour to the emitter. |
|
public |
addBehaviours(behaviours: array<Behaviour>): Emitter Adds multiple behaviours to the emitter. |
|
public |
addEmitterBehaviour(behaviour: Behaviour): Emitter Adds an emitter behaviour to the emitter. |
|
public |
addEmitterBehaviours(behaviours: array<Behaviour>): Emitter Adds multiple behaviours to the emitter. |
|
public |
addInitializer(initializer: Initializer): Emitter Adds a particle initializer to the emitter. |
|
public |
addInitializers(initializers: array<Initializer>): Emitter Adds multiple particle initializers to the emitter. |
|
public |
addOnEmitterDeadEventListener(-: onEmitterDead): Emitter Adds the event listener for the EMITTER_DEAD event. |
|
public |
Creates a particle by retreiving one from the pool and setting it up with the supplied initializer and behaviour. |
|
public |
destroy(): * Kills the emitter. |
|
public |
Proxy method for the internal event dispatcher's dispatchEvent method. |
|
public |
Sets the total number of times the emitter should emit particles as well as the emitter's life. Also intializes the emitter rate. This enables the emitter to emit particles. |
|
public |
Experimental emit method that is designed to be called from the System.emit method. |
|
public |
Generates new particles. |
|
public |
Runs the integration algorithm on the emitter and all particles. |
|
public |
Removes all behaviours from the emitter. |
|
public |
Removes all behaviours from the emitter. |
|
public |
Removes all initializers. |
|
public |
removeAllParticles(): * Kills all of the emitter's particles. |
|
public |
removeBehaviour(behaviour: Behaviour): Emitter Removes the behaviour from the emitter's behaviours array. |
|
public |
removeEmitterBehaviour(behaviour: Behaviour): Emitter Removes the behaviour from the emitter's behaviours array. |
|
public |
removeInitializer(initializer: Initializer): Emitter Removes an initializer from the emitter's initializers array. |
|
public |
setBehaviours(behaviours: array<Behaviour>): Emitter Sets the emitter's behaviours. |
|
public |
setEmitterBehaviours(behaviours: array<Behaviour>): Emitter Sets the emitter's behaviours. |
|
public |
setInitializers(initializers: array<Initializer>): Emitter Sets the emitter's particle initializers. |
|
public |
Sets the life of the emitter. |
|
public |
setPosition(newPosition: object): Emitter Sets the position of the emitter. |
|
public |
Sets the emitter rate. |
|
public |
setRotation(newRotation: object): Emitter Sets the rotation of the emitter. |
|
public |
setTotalEmitTimes(totalEmitTimes: number): Emitter Sets the total emit times for the emitter. |
|
public |
setupParticle(particle: Particle): * Sets up a particle by running all initializers on it and setting its behaviours. |
|
public |
stopEmit(): * Stops the emitter from emitting particles. |
|
public |
Updates the emitter according to the time passed by calling the generate and integrate methods. |
|
public |
updateEmitterBehaviours(time: number): * Updates the emitter's emitter behaviours. |
Inherited Summary
From class Particle | ||
public |
The particle's acceleration |
|
public |
The particle's age |
|
public |
The particle's alpha |
|
public |
behaviours: array The particle's behaviours array |
|
public |
The particle's body |
|
public |
The particle's color store |
|
public |
Determines if the particle is dead or not |
|
public |
The particle's distance to the camera, only set by the GPURenderer for depth sorting purposes. |
|
public |
The particle's easing |
|
public |
The particle's energy loss |
|
public |
The particle's unique id |
|
public |
The particle's life |
|
public |
The particle's mass |
|
public |
The particle's last position, velocity and acceleration |
|
public |
The particle's parent |
|
public |
The particle's position |
|
public |
The particle's radius |
|
public |
The particle's rotation |
|
public |
The particle's scale |
|
public |
Determines if the particle is sleeping or not |
|
public |
The particle's transform collection |
|
public |
The class type. |
|
public |
Determines whether to use alpha or not |
|
public |
Determines whether to use color or not |
|
public |
The particle's velocity |
|
public |
addBehaviour(behaviour: Behaviour): * Adds a behaviour to the particle. |
|
public |
addBehaviours(behaviours: array<Behaviour>): * Adds multiple behaviours to the particle. |
|
public |
destroy(): * Destroys the particle. |
|
public |
Gets the particle's current direction. |
|
public |
removeAllBehaviours(): * Removes all behaviours from the particle. |
|
public |
removeBehaviour(behaviour: Behaviour): * Removes the behaviour from the particle. |
|
public |
Resets the particle's default properties and clear's its particle's position, velocity, acceleration, color and rotation. Also destroy's the particle's transform collection & removes all behaviours. |
|
public |
Updates the particle's properties by applying each behaviour to the particle. Will also update the particle's energy, unless it's age is greater than it's life in which case it will be destroyed. |
Public Constructors
public constructor(properties: object): * source
Constructs an Emitter instance.
Override:
Particle#constructorParams:
Name | Type | Attribute | Description |
properties | object | The properties to instantiate the emitter with |
Return:
* | void |
Public Members
public behaviours: array source
The behaviours for particles emitted by this emitter.
Override:
Particle#behaviourspublic bindEmitter: boolean source
Ensures that particles emitted by this emitter are positioned according to the emitter's properties.
Public Methods
public addBehaviour(behaviour: Behaviour): Emitter source
Adds a behaviour to the emitter. All emitter behaviours are added to each particle when they are emitted.
Override:
Particle#addBehaviourParams:
Name | Type | Attribute | Description |
behaviour | Behaviour | The behaviour to add to the emitter |
public addBehaviours(behaviours: array<Behaviour>): Emitter source
Adds multiple behaviours to the emitter.
Override:
Particle#addBehavioursParams:
Name | Type | Attribute | Description |
behaviours | array<Behaviour> | an array of emitter behaviours |
public addEmitterBehaviour(behaviour: Behaviour): Emitter source
Adds an emitter behaviour to the emitter.
Params:
Name | Type | Attribute | Description |
behaviour | Behaviour | The behaviour to add to the emitter |
public addEmitterBehaviours(behaviours: array<Behaviour>): Emitter source
Adds multiple behaviours to the emitter.
Params:
Name | Type | Attribute | Description |
behaviours | array<Behaviour> | an array of emitter behaviours |
public addInitializer(initializer: Initializer): Emitter source
Adds a particle initializer to the emitter. Each initializer is run on each particle when they are created.
Params:
Name | Type | Attribute | Description |
initializer | Initializer | The initializer to add |
public addInitializers(initializers: array<Initializer>): Emitter source
Adds multiple particle initializers to the emitter.
Params:
Name | Type | Attribute | Description |
initializers | array<Initializer> | an array of particle initializers |
public addOnEmitterDeadEventListener(-: onEmitterDead): Emitter source
Adds the event listener for the EMITTER_DEAD event.
Params:
Name | Type | Attribute | Description |
- | onEmitterDead | The function to call when the EMITTER_DEAD is dispatched. |
public createParticle(): Emitter source
Creates a particle by retreiving one from the pool and setting it up with the supplied initializer and behaviour.
public dispatch(event: string, target: object<Particle>) source
Proxy method for the internal event dispatcher's dispatchEvent method.
public emit(totalEmitTimes: number, life: number): Emitter source
Sets the total number of times the emitter should emit particles as well as the emitter's life. Also intializes the emitter rate. This enables the emitter to emit particles.
public experimental_emit(): Emitter source
Experimental emit method that is designed to be called from the System.emit method.
public generate(time: number): * source
Generates new particles.
Params:
Name | Type | Attribute | Description |
time | number | System engine time |
Return:
* | void |
public integrate(time: number): * source
Runs the integration algorithm on the emitter and all particles. Updates the particles with the timstamp passed.
Params:
Name | Type | Attribute | Description |
time | number | System engine time |
Return:
* | void |
public removeAllBehaviours(): Emitter source
Removes all behaviours from the emitter.
Override:
Particle#removeAllBehaviourspublic removeBehaviour(behaviour: Behaviour): Emitter source
Removes the behaviour from the emitter's behaviours array.
Override:
Particle#removeBehaviourParams:
Name | Type | Attribute | Description |
behaviour | Behaviour | The behaviour to remove |
public removeEmitterBehaviour(behaviour: Behaviour): Emitter source
Removes the behaviour from the emitter's behaviours array.
Params:
Name | Type | Attribute | Description |
behaviour | Behaviour | The behaviour to remove |
public removeInitializer(initializer: Initializer): Emitter source
Removes an initializer from the emitter's initializers array.
Params:
Name | Type | Attribute | Description |
initializer | Initializer | The initializer to remove |
public setBehaviours(behaviours: array<Behaviour>): Emitter source
Sets the emitter's behaviours.
Params:
Name | Type | Attribute | Description |
behaviours | array<Behaviour> | an array of emitter behaviours |
public setEmitterBehaviours(behaviours: array<Behaviour>): Emitter source
Sets the emitter's behaviours.
Params:
Name | Type | Attribute | Description |
behaviours | array<Behaviour> | an array of emitter behaviours |
public setInitializers(initializers: array<Initializer>): Emitter source
Sets the emitter's particle initializers.
Params:
Name | Type | Attribute | Description |
initializers | array<Initializer> | an array of particle initializers |
public setLife(life: number): Emitter source
Sets the life of the emitter.
Params:
Name | Type | Attribute | Description |
life | number |
|
the life of this emitter in milliseconds |
public setPosition(newPosition: object): Emitter source
Sets the position of the emitter.
Params:
Name | Type | Attribute | Description |
newPosition | object | an object the new x, y and z props |
public setRate(rate: Rate): Emitter source
Sets the emitter rate.
Params:
Name | Type | Attribute | Description |
rate | Rate | a rate initializer object |
public setRotation(newRotation: object): Emitter source
Sets the rotation of the emitter.
Params:
Name | Type | Attribute | Description |
newRotation | object | an object the new x, y and z props |
public setTotalEmitTimes(totalEmitTimes: number): Emitter source
Sets the total emit times for the emitter.
Params:
Name | Type | Attribute | Description |
totalEmitTimes | number |
|
the total number of times to emit particles |
public setupParticle(particle: Particle): * source
Sets up a particle by running all initializers on it and setting its behaviours. Also adds the particle to this.particles.
Params:
Name | Type | Attribute | Description |
particle | Particle | The particle to setup |
Return:
* | void |
public update(time: number): * source
Updates the emitter according to the time passed by calling the generate and integrate methods. The generate method creates particles, the integrate method updates existing particles.
If the emitter age is greater than time, the emitter is killed.
This method also indexes/deindexes particles.
Override:
Particle#updateParams:
Name | Type | Attribute | Description |
time | number | System engine time |
Return:
* | void |