Home Reference Source
import FollowEmitter from 'three-nebula/src/emitter/FollowEmitter.js'
public class | source

FollowEmitter

Extends:

ParticleEmitter → FollowEmitter

Constructor Summary

Public Constructor
public

constructor(mouseTarget: Element, ease: Number, pObj: Object)

The FollowEmitter class inherits from System.Emitter

Member Summary

Public Members
public

camera: *

public

canvas: *

public

ease: *

public
public

The class type.

Private Members
private

Method Summary

Public Methods
public

Destory this Emitter

public

emit()

start emit particle

public
public

mousemove(e: *)

public

setCameraAndCanvas(camera: *, canvas: *)

public

stop emiting

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

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

update(time: number, index: integer): *

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.

From class Emitter
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

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.

public

Adds a behaviour to the emitter.

public

addBehaviours(behaviours: array<Behaviour>): Emitter

Adds multiple behaviours to the emitter.

public

Adds an emitter behaviour to the emitter.

public

addEmitterBehaviours(behaviours: array<Behaviour>): Emitter

Adds multiple behaviours to the emitter.

public

Adds a particle initializer to the emitter.

public

addInitializers(initializers: array<Initializer>): Emitter

Adds multiple particle initializers to the emitter.

public

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

dispatch(event: string, target: object<Particle>)

Proxy method for the internal event dispatcher's dispatchEvent method.

public

emit(totalEmitTimes: number, life: number): Emitter

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

generate(time: number): *

Generates new particles.

public

integrate(time: number): *

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

Kills all of the emitter's particles.

public

Removes the behaviour from the emitter's behaviours array.

public

Removes the behaviour from the emitter's behaviours array.

public

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

setRate(rate: Rate): Emitter

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

update(time: number): *

Updates the emitter according to the time passed by calling the generate and integrate methods.

public

Updates the emitter's emitter behaviours.

Public Constructors

public constructor(mouseTarget: Element, ease: Number, pObj: Object) source

The FollowEmitter class inherits from System.Emitter

use the FollowEmitter will emit particle when mousemoving

Override:

Emitter#constructor

Params:

NameTypeAttributeDescription
mouseTarget Element

mouseevent's target;

ease Number

the easing of following speed;

pObj Object

the parameters object;

Public Members

public camera: * source

public canvas: * source

public ease: * source

public mouseTarget: * source

public type: string source

The class type.

Override:

Emitter#type

Private Members

private _allowEmitting: boolean source

Public Methods

public destroy() source

Destory this Emitter

Override:

Emitter#destroy

public emit() source

start emit particle

Override:

Emitter#emit

public initEventHandler() source

public mousemove(e: *) source

Params:

NameTypeAttributeDescription
e *

public setCameraAndCanvas(camera: *, canvas: *) source

Params:

NameTypeAttributeDescription
camera *
canvas *

public stopEmit() source

stop emiting

Override:

Emitter#stopEmit