Fork me on GitHub
View source

package com.haxepunk.graphics

class ParticleType

Template used to define a particle type used by the Emitter class. Instead of creating this object yourself, fetch one with Emitter's add() function.

Constructor

View source

new (name : String, frames : Array<Int>, width : Int, frameWidth : Int, frameHeight : Int) : Void

Constructor.


Parameters:
name   

Name of the particle type.

frames   

Array of frame indices to animate through.

width   

Unused parameter.

frameWidth   

Frame width.

frameHeight   

Frame height.

Functions

View source

ease (f : EaseFunction, t : Float) : Float

View source

setAlpha (start : Float = 1, finish : Float = 0, ?ease : EaseFunction) : ParticleType

Sets the alpha range of this particle type.


Parameters:
start   

The starting alpha.

finish   

The finish alpha.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setColor (start : Int = 0xFFFFFF, finish : Int = 0, ?ease : EaseFunction) : ParticleType

Sets the color range of this particle type.


Parameters:
start   

The starting color.

finish   

The finish color.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setGravity (gravity : Float = 0, gravityRange : Float = 0) : ParticleType

Sets the gravity range of this particle type.


Parameters:
gravity   

Gravity amount to affect to the particle y velocity.

gravityRange   

Random amount to add to the particle's gravity.


Returns:

This ParticleType object.

View source

setMotion (angle : Float, distance : Float, duration : Float, angleRange : Float = 0, distanceRange : Float = 0, durationRange : Float = 0, ?ease : EaseFunction, backwards : Bool = false) : ParticleType

Defines the motion range for this particle type.


Parameters:
angle   

Launch Direction.

distance   

Distance to travel.

duration   

Particle duration.

angleRange   

Random amount to add to the particle's direction.

distanceRange   

Random amount to add to the particle's distance.

durationRange   

Random amount to add to the particle's duration.

ease   

Optional ease function.

backwards   

If the motion should be played backwards.


Returns:

This ParticleType object.

View source

setMotionVector (x : Float, y : Float, duration : Float, durationRange : Float = 0, ?ease : EaseFunction) : ParticleType

Defines the motion range for this particle type based on the vector.


Parameters:
x   

X distance to move.

y   

Y distance to move.

duration   

Particle duration.

durationRange   

Random amount to add to the particle's duration.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setRotation (startAngle : Float, spanAngle : Float, startAngleRange : Float = 0, spanAngleRange : Float = 0, ?ease : EaseFunction) : ParticleType

Sets the rotation range of this particle type.


Parameters:
startAngle   

Starting angle.

spanAngle   

Total amount of degrees to rotate.

startAngleRange   

Random amount to add to the particle's starting angle.

spanAngleRange   

Random amount to add to the particle's span angle.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setScale (start : Float = 1, finish : Float = 0, ?ease : EaseFunction) : ParticleType

Sets the scale range of this particle type.


Parameters:
start   

The starting scale.

finish   

The finish sale.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setTrail (length : Int = 1, delay : Float = 0.1, alpha : Float = 1) : ParticleType

Sets the trail of this particle type.


Parameters:
length   

Number of trailing particles to draw.

delay   

Time to delay each trailing particle, in seconds.

alpha   

Multiply each successive trail particle's alpha by this amount.


Returns:

This ParticleType object.