Home Reference Source
public class | source

Rate

You can directly use an instance of this class. DEFAULT_EMITTER_RATE

Extends:

Initializer → Rate

Calculates the rate of particle emission.

NOTE This doesn't need to be an initializer, it doesn't have an initialize method, it overrides the base init method and it is only relevent to the Emitter class. It would be better to move this to the Emitter module itself as a standalone class.

Static Method Summary

Static Public Methods
public static

fromJSON(json: object): Rate

Creates a Rate initializer from JSON.

Constructor Summary

Public Constructor
public

constructor(numPan: number | array | Span, timePan: number | array | Span): *

Constructs a Rate instance.

Member Summary

Public Members
public

The rate's next time.

public

Sets the number of particles to emit.

public

The rate's start time.

public

Sets the time between each particle emission.

Method Summary

Public Methods
public

Gets the number of particles to emit.

public

init(): *

Sets the startTime and nextTime properties.

Inherited Summary

From class Initializer
public static abstract

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

public static

Determines if the initializer requires a Web GL API to be provided to its constructor.

public
public

type: *

public

init(emitter: Emitter, particle: Particle): *

Initializes the property on the emitter or particle.

public abstract

initialize(target: object)

Place custom property initialization code in this method in the subclass.

public abstract

reset()

Static Public Methods

public static fromJSON(json: object): Rate source

Creates a Rate initializer from JSON.

Override:

Initializer#fromJSON

Params:

NameTypeAttributeDescription
json object

The JSON to construct the instance from.

Return:

Rate

Return Properties:

NameTypeAttributeDescription
json.particlesMin number

The minimum number of particles to emit

json.particlesMax number

The maximum number of particles to emit

json.perSecondMin number

The minimum per second emit rate

json.perSecondMax number

The maximum per second emit rate

Public Constructors

public constructor(numPan: number | array | Span, timePan: number | array | Span): * source

Constructs a Rate instance.

Override:

Initializer#constructor

Params:

NameTypeAttributeDescription
numPan number | array | Span

The number of particles to emit

timePan number | array | Span

The time between each particle emission

Return:

*

void

Public Members

public nextTime: number source

The rate's next time.

public numPan: Span source

Sets the number of particles to emit.

public startTime: number source

The rate's start time.

public timePan: Span source

Sets the time between each particle emission.

Public Methods

public getValue(time: number): number source

Gets the number of particles to emit.

Params:

NameTypeAttributeDescription
time number

Current particle engine time

Return:

number

public init(): * source

Sets the startTime and nextTime properties.

Override:

Initializer#init

Return:

*

void