Home Reference Source
public class | source

Rotate

Extends:

Behaviour → Rotate

Behaviour that rotates particles.

Static Method Summary

Static Public Methods
public static

fromJSON(json: *): *

Constructor Summary

Public Constructor
public

constructor(x: number, y: number, z: number, life: number, easing: function, isEnabled: boolean): *

Constructs a Rotate behaviour instance.

Member Summary

Public Members
public get

Gets the rotation type.

public set

Sets the rotation type.

public

X axis rotation.

public

Y axis rotation.

public

Z axis rotation.

Private Members
private

The rotation type.

Method Summary

Public Methods
public

initialize(particle: object): *

Initializes the behaviour on a particle.

public

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

Mutates the particle.rotation property.

public

reset(x: number, y: number, z: number, life: number, easing: function): *

Resets the behaviour properties.

Private Methods
private

_setRotation(particleRotation: Vector3D, value: string | number): *

Sets the particle's rotation prior to the behaviour being applied.

NOTE It's hard to see here, but this is mutating the particle's rotation even though the particle is not being passed in directly.

NOTE the else if below will never be reached because the value being passed in will never be of type Vector3D.

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

Static Public Methods

public static fromJSON(json: *): * source

Returns a new instance of the behaviour from the JSON object passed.

Override:

Behaviour#fromJSON

Params:

NameTypeAttributeDescription
json *

Return:

*

Public Constructors

public constructor(x: number, y: number, z: number, life: number, easing: function, isEnabled: boolean): * source

Constructs a Rotate behaviour instance.

Override:

Behaviour#constructor

Params:

NameTypeAttributeDescription
x number

X axis rotation

y number

Y axis rotation

z number

Z axis rotation

life number

The life of the behaviour

easing function

The easing equation to use for transforms

isEnabled boolean
  • optional
  • default: true

Determines if the behaviour will be applied or not

Return:

*

void

Public Members

public get rotationType: string: * source

Gets the rotation type.

Return:

string

public set rotationType: * source

Sets the rotation type.

Return:

*

void

public x: number | Span source

X axis rotation.

public y: number | Span source

Y axis rotation.

public z: number | Span source

Z axis rotation.

Private Members

private _rotationType: string source

The rotation type. ENUM of ['same', 'set', 'to', 'add'].

Public Methods

public initialize(particle: object): * source

Initializes the behaviour on a particle.

Override:

Behaviour#initialize

Params:

NameTypeAttributeDescription
particle object

the particle to initialize the behaviour on

Return:

*

void

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

Mutates the particle.rotation property.

Override:

Behaviour#mutate

Params:

NameTypeAttributeDescription
particle object

the particle to apply the behaviour to

time number

engine time

index integer

the particle index

Return:

*

void

See:

public reset(x: number, y: number, z: number, life: number, easing: function): * source

Resets the behaviour properties.

Override:

Behaviour#reset

Params:

NameTypeAttributeDescription
x number

X axis rotation

y number

Y axis rotation

z number

Z axis rotation

life number

the life of the behaviour

easing function

the easing equation to use for transforms

Return:

*

void

Private Methods

private _setRotation(particleRotation: Vector3D, value: string | number): * source

Sets the particle's rotation prior to the behaviour being applied.

NOTE It's hard to see here, but this is mutating the particle's rotation even though the particle is not being passed in directly.

NOTE the else if below will never be reached because the value being passed in will never be of type Vector3D.

Params:

NameTypeAttributeDescription
particleRotation Vector3D

the particle's rotation vector

value string | number

the value to set the rotation value to, if 'random' rotation is randomised

Return:

*

void