Fork me on GitHub
View source

package haxepunk.graphics.emitter

class BaseEmitter<T>


extends Graphic

Variables

read only particleCount : Int

Amount of currently existing particles.

scale : Float

Functions

View source

centerOrigin () : Void

Resets originX/Y to 0 since there are no dimensions.

View source

clear () : Void

Clears all particles.


Available since:

2.5.2

View source

emit (name : String, x : Float = 0, y : Float = 0, angle : Float = 0) : Particle

Emits a particle.


Parameters:
name   

Particle type to emit.

x   

X point to emit from.

y   

Y point to emit from.

angle   

Base angle to start from.


Returns:

The Particle emited.

View source

emitInCircle (name : String, x : Float, y : Float, radius : Float) : Particle

Randomly emits the particle inside the specified radius


Parameters:
name   

Particle type to emit.

x   

X point to emit from.

y   

Y point to emit from.

radius   

Radius to emit inside.


Returns:

The Particle emited.

View source

emitInRectangle (name : String, x : Float, y : Float, width : Float, height : Float) : Particle

Randomly emits the particle inside the specified area


Parameters:
name   

Particle type to emit

x   

X point to emit from.

y   

Y point to emit from.

width   

Width of the area to emit from.

height   

height of the area to emit from.


Returns:

The Particle emited.

View source

render (point : Vector2, camera : Camera) : Void

View source

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

Sets the alpha range of the particle type.


Parameters:
name   

The particle type.

start   

The starting alpha.

finish   

The finish alpha.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

setColor (name : String, start : Color = Color.White, finish : Color = Color.Black, ease : EaseFunction) : ParticleType

Sets the color range of the particle type.


Parameters:
name   

The particle type.

start   

The starting color.

finish   

The finish color.

ease   

Optional easer function.


Returns:

This ParticleType object.

View source

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

Sets the gravity range for a particle type.


Parameters:
name   

The particle type.

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 (name : String, 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 a particle type.


Parameters:
name   

The particle type.

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

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

Defines the rotation range for a particle type.


Parameters:
name   

The particle type.

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.


Available since:

2.6.0

View source

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

Sets the scale range of the particle type.


Parameters:
name   

The particle type.

start   

The starting scale.

finish   

The finish scale.

ease   

Optional easer function.


Returns:

This ParticleType object.


Available since:

2.6.0

View source

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

Sets the trail of the particle type.


Parameters:
name   

The particle type.

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.


Available since:

2.6.0

View source

update () : Void