Home Reference Source
public class | source

Gravity

Extends:

BehaviourForce → Gravity

Behaviour that forces particles down the y axis.

Static Method Summary

Static Public Methods
public static

fromJSON(json: *): *

Constructor Summary

Public Constructor
public

constructor(gravity: number, life: number, easing: string, isEnabled: boolean): *

Constructs a Gravity behaviour instance.

Member Summary

Public Members
public

The class type.

Inherited Summary

From class Behaviour
public get

life: Number: *

Gets the behaviour's life.

public set

life: *

Ensures that life is infinity if an invalid value is supplied.

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

The class type.

private

_life: *

public abstract

applyBehaviour(target: Particle | Emitter, time: Number, index: integer): *

Apply behaviour to the target as a factor of time.

public abstract

Destory this behaviour.

public

energize(particle: Particle, time: Number): *

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

mutate(target: Particle | Emitter, time: Number): *

Change the target's properties according to specific behaviour logic.

public

Normalize a force by 1:100;

public

Normalize a value by 1:100;

public

reset(life: number, easing: function)

Reset this behaviour's parameters

From class Force
public static

Creates a Force initializer from JSON.

public

The normalized force to exert on the particle in

public

mutate(particle: object, time: number, index: integer): *

Mutates the particle.acceleration property.

public

reset(fx: number, fy: number, fz: number)

Resets the behaviour properties.

Static Public Methods

public static fromJSON(json: *): * source

Creates a Force initializer from JSON.

Override:

Force#fromJSON

Params:

NameTypeAttributeDescription
json *

Return:

*

Public Constructors

public constructor(gravity: number, life: number, easing: string, isEnabled: boolean): * source

Constructs a Gravity behaviour instance.

Override:

Force#constructor

Params:

NameTypeAttributeDescription
gravity number

the force to pull the particle down the y axis

life number

the life of the particle

easing string

the easing equation to use

isEnabled boolean
  • optional
  • default: true

Determines if the behaviour will be applied or not

Return:

*

void

Public Members

public type: string source

The class type.

Override:

Behaviour#type