Home Reference Source
public class | source

Repulsion

Extends:

BehaviourAttraction → Repulsion

Behaviour that causes particles to be repelled from a target position.

Static Method Summary

Static Public Methods
public static

fromJSON(json: object): Body

Creates a Body initializer from JSON.

Constructor Summary

Public Constructor
public

constructor(targetPosition: Vector3D, force: number, radius: number, life: number, easing: function): *

Constructs an Repulsion behaviour instance.

Member Summary

Public Members
public

Repulsion is attraction with negative force.

public

The class type.

Method Summary

Public Methods
public

reset(targetPosition: Vector3D, force: number, radius: number, life: number, easing: function): *

Resets the behaviour properties.

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 Attraction
public static

fromJSON(json: object): Body

Creates a Body initializer from JSON.

public

The attraction force in 3D space

public

The attraction force scalar multiplier

public

The linear attraction force

public

The attraction radius

public

The radius of the attraction squared

public

The position the particles will be attracted to

public

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

Mutates particle acceleration.

public

reset(targetPosition: Vector3D, force: number, radius: number, life: number, easing: function): *

Resets the behaviour properties.

Static Public Methods

public static fromJSON(json: object): Body source

Creates a Body initializer from JSON.

Override:

Attraction#fromJSON

Params:

NameTypeAttributeDescription
json object

The JSON to construct the instance from.

Return:

Body

Return Properties:

NameTypeAttributeDescription
json.x number

The target position x value

json.y number

The target position y value

json.z number

The target position z value

json.force number

The attraction force scalar multiplier

json.life number

The life of the particle

json.easing string

The behaviour's decaying trend

Public Constructors

public constructor(targetPosition: Vector3D, force: number, radius: number, life: number, easing: function): * source

Constructs an Repulsion behaviour instance.

Override:

Attraction#constructor

Params:

NameTypeAttributeDescription
targetPosition Vector3D

The position the particles will be repelled from

force number

The repulsion force scalar multiplier

radius number

The repulsion radius

life number

The life of the particle

easing function

The behaviour's decaying trend

Return:

*

void

Public Members

public force: number source

Repulsion is attraction with negative force.

Override:

Attraction#force

public type: string source

The class type.

Override:

Behaviour#type

Public Methods

public reset(targetPosition: Vector3D, force: number, radius: number, life: number, easing: function): * source

Resets the behaviour properties.

Override:

Attraction#reset

Params:

NameTypeAttributeDescription
targetPosition Vector3D

the position the particles will be attracted to

force number

the attraction force multiplier

radius number

the attraction radius

life number

the life of the particle

easing function

The behaviour's decaying trend

Return:

*

void