Behaviour
Direct Subclass:
The base behaviour class. Behaviours manage a particle's behaviour after they have been emitted.
Constructor Summary
Public Constructor | ||
public |
constructor(life: number, easing: function, type: string, isEnabled: boolean): * Constructs a Behaviour instance. |
Member Summary
Public Members | ||
public |
The age of the behaviour |
|
public |
Determines if the behaviour is dead or not |
|
public |
The behaviour's decaying trend |
|
public |
The energy of the behaviour |
|
public |
The behaviour's id |
|
public |
Determines if the behaviour will be applied or not |
|
public set |
life: * Ensures that life is infinity if an invalid value is supplied. |
|
public get |
Gets the behaviour's life. |
|
public |
The class type. |
Private Members | ||
private |
_life: * |
Method Summary
Public Methods | ||
public abstract |
applyBehaviour(target: Particle | Emitter, time: Number, index: integer): * Apply behaviour to the target as a factor of time. |
|
public abstract |
destroy() Destory this behaviour. |
|
public |
Compares the age of the behaviour vs integration time and determines if the behaviour should be set to dead or not. |
|
public abstract |
Returns a new instance of the behaviour from the JSON object passed. |
|
public abstract |
initialize(particle: Particle) Set the behaviour's initial properties on the particle. |
|
public abstract |
Change the target's properties according to specific behaviour logic. |
|
public |
normalizeForce(force: Vector3D): Vector3D Normalize a force by 1:100; |
|
public |
normalizeValue(value: number): number Normalize a value by 1:100; |
|
public |
Reset this behaviour's parameters |
Public Constructors
public constructor(life: number, easing: function, type: string, isEnabled: boolean): * source
Constructs a Behaviour instance.
Params:
Name | Type | Attribute | Description |
life | number |
|
The life of the behaviour |
easing | function |
|
The behaviour's decaying trend |
type | string |
|
The behaviour type |
isEnabled | boolean |
|
Determines if the behaviour will be applied or not |
Return:
* | void |
Public Members
public set life: * source
Ensures that life is infinity if an invalid value is supplied.
Return:
* | void |
Private Members
private _life: * source
Public Methods
public abstract applyBehaviour(target: Particle | Emitter, time: Number, index: integer): * source
Apply behaviour to the target as a factor of time. Internally calls the mutate method to change properties on the target Will not do so if the behaviour is disabled
Return:
* | mixed |
public energize(particle: Particle, time: Number): * source
Compares the age of the behaviour vs integration time and determines if the behaviour should be set to dead or not. Sets the behaviour energy as a factor of particle age and life.
Return:
* | void |
public abstract fromJSON(json: object): Behaviour source
Returns a new instance of the behaviour from the JSON object passed.
Params:
Name | Type | Attribute | Description |
json | object | JSON object containing the required constructor properties |
public abstract initialize(particle: Particle) source
Set the behaviour's initial properties on the particle.
Params:
Name | Type | Attribute | Description |
particle | Particle |
public abstract mutate(target: Particle | Emitter, time: Number): * source
Change the target's properties according to specific behaviour logic.
Return:
* | mixed |
public normalizeForce(force: Vector3D): Vector3D source
Normalize a force by 1:100;
Params:
Name | Type | Attribute | Description |
force | Vector3D | The force to normalize. |