A particle emitter.

Events

@:dox(show)observedDirty(instance:ParticleEmitter, fromSerializedField:Bool):Void

Event when any observable value as changed on this instance.

@:dox(show)_emitParticle(particle:ParticleItem):Void

@:dox(show)statusChange(current:ParticlesStatus, previous:ParticlesStatus):Void

Event when status field changes.

Constructor

new()

Creates a new ParticleEmitter object.

Variables

@:value(false)observedDirty:Bool = false

Default is false, automatically set to true when any of this instance's observable variables has changed.

@:value(IDLE)@observeread onlystatus:ParticlesStatus = IDLE

Determines whether the emitter is currently emitting particles or not

@:value(false)paused:Bool = false

Determines whether the emitter is currently paused. It is totally safe to directly toggle this.

@:value(0.1)interval:Float = 0.1

How often a particle is emitted, if currently emitting. Can be modified at the middle of an emission safely;

@:value(CIRCLE)launchMode:ParticlesLaunchMode = CIRCLE

How particles should be launched. If CIRCLE (default), particles will use launchAngle and speed. Otherwise, particles will just use velocityX and velocityY.

@:value(false)keepScaleRatio:Bool = false

Keep the scale ratio of the particle. Uses the scaleX value for reference.

@:value(true)visualScaleActive:Bool = true

Apply particle scale to underlying visual or not.

@:value(true)visualColorActive:Bool = true

Apply particle color to underlying visual or not.

@:value(true)visualPositionActive:Bool = true

Apply particle position (x & y) to underlying visual or not.

@:value(true)visualRotationActive:Bool = true

Apply particle angle to underlying visual rotation or not.

@:value(true)visualAlphaActive:Bool = true

Apply particle alpha to underlying visual or not.

@:value(-1)width:Float = -1

The width of the emission area. If not defined (-1), will use visual's width bound to this ParticleEmitter object, if any

@:value(-1)height:Float = -1

The height of the emission area. If not defined (-1), will use visual's height bound to this ParticleEmitter object, if any

@:value(0)x:Float = 0

The x position of the emission, relative to particles parent (if any)

@:value(0)y:Float = 0

The y position of the emission, relative to particles parent (if any)

@:value(10000)maxVelocityX:Float = 10000

If you are using acceleration, you can use maxVelocity with it to cap the speed automatically (very useful!).

@:value(10000)maxVelocityY:Float = 10000

If you are using acceleration, you can use maxVelocity with it to cap the speed automatically (very useful!).

@:value(true)velocityActive:Bool = true

Enable or disable the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(-100)velocityStartMinX:Float = -100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(-100)velocityStartMinY:Float = -100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(100)velocityStartMaxX:Float = 100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(100)velocityStartMaxY:Float = 100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(-100)velocityEndMinX:Float = -100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(-100)velocityEndMinY:Float = -100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(100)velocityEndMaxX:Float = 100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(100)velocityEndMaxY:Float = 100

Sets the velocity range of particles launched from this emitter. Only used with SQUARE.

@:value(0)speedStartMin:Float = 0

Set the speed range of particles launched from this emitter. Only used with CIRCLE.

@:value(100)speedStartMax:Float = 100

Set the speed range of particles launched from this emitter. Only used with CIRCLE.

@:value(0)speedEndMin:Float = 0

Set the speed range of particles launched from this emitter. Only used with CIRCLE.

@:value(100)speedEndMax:Float = 100

Set the speed range of particles launched from this emitter. Only used with CIRCLE.

@:value(10000)maxAngularVelocity:Float = 10000

Use in conjunction with angularAcceleration for fluid spin speed control.

@:value(true)angularAccelerationActive:Bool = true

Enable or disable the angular acceleration range of particles launched from this emitter.

@:value(0)angularAccelerationStartMin:Float = 0

Set the angular acceleration range of particles launched from this emitter.

@:value(0)angularAccelerationStartMax:Float = 0

Set the angular acceleration range of particles launched from this emitter.

@:value(true)angularDragActive:Bool = true

Enable or disable the angular drag range of particles launched from this emitter.

@:value(0)angularDragStartMin:Float = 0

Set the angular drag range of particles launched from this emitter.

@:value(0)angularDragStartMax:Float = 0

Set the angular drag range of particles launched from this emitter.

@:value(true)angularVelocityActive:Bool = true

Enable or disable the angular velocity range of particles launched from this emitter.

@:value(0)angularVelocityStartMin:Float = 0

The angular velocity range of particles launched from this emitter.

@:value(0)angularVelocityStartMax:Float = 0

The angular velocity range of particles launched from this emitter.

@:value(0)angularVelocityEndMin:Float = 0

The angular velocity range of particles launched from this emitter.

@:value(0)angularVelocityEndMax:Float = 0

The angular velocity range of particles launched from this emitter.

@:value(true)angleActive:Bool = true

Enable or disable the angle range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

@:value(0)angleStartMin:Float = 0

The angle range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

@:value(0)angleStartMax:Float = 0

The angle range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

@:value(0)angleEndMin:Float = 0

The angle range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

@:value(0)angleEndMax:Float = 0

The angle range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

@:value(false)ignoreAngularVelocity:Bool = false

Set this if you want to specify the beginning and ending value of angle, instead of using angularVelocity (or angularAcceleration).

@:value(true)launchAngleActive:Bool = true

Enable or disable the angle range at which particles will be launched from this emitter. Ignored unless launchMode is set to CIRCLE.

@:value(-180)launchAngleMin:Float = -180

The angle range at which particles will be launched from this emitter. Ignored unless launchMode is set to CIRCLE.

@:value(180)launchAngleMax:Float = 180

The angle range at which particles will be launched from this emitter. Ignored unless launchMode is set to CIRCLE.

@:value(true)lifespanActive:Bool = true

Enable or disable the life, or duration, range of particles launched from this emitter.

@:value(3)lifespanMin:Float = 3

The life, or duration, range of particles launched from this emitter.

@:value(3)lifespanMax:Float = 3

The life, or duration, range of particles launched from this emitter.

@:value(true)scaleActive:Bool = true

Enable or disable scale range of particles launched from this emitter.

@:value(1)scaleStartMinX:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleStartMinY:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleStartMaxX:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleStartMaxY:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleEndMinX:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleEndMinY:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleEndMaxX:Float = 1

Sets scale range of particles launched from this emitter.

@:value(1)scaleEndMaxY:Float = 1

Sets scale range of particles launched from this emitter.

@:value(true)alphaActive:Bool = true

Enable or disable alpha range of particles launched from this emitter.

@:value(1)alphaStartMin:Float = 1

Sets alpha range of particles launched from this emitter.

@:value(1)alphaStartMax:Float = 1

Sets alpha range of particles launched from this emitter.

@:value(1)alphaEndMin:Float = 1

Sets alpha range of particles launched from this emitter.

@:value(1)alphaEndMax:Float = 1

Sets alpha range of particles launched from this emitter.

@:value(true)colorActive:Bool = true

Enable or disable color range of particles launched from this emitter.

@:value(Color.WHITE)colorStartMin:Color = Color.WHITE

Sets color range of particles launched from this emitter.

@:value(Color.WHITE)colorStartMax:Color = Color.WHITE

Sets color range of particles launched from this emitter.

@:value(Color.WHITE)colorEndMin:Color = Color.WHITE

Sets color range of particles launched from this emitter.

@:value(Color.WHITE)colorEndMax:Color = Color.WHITE

Sets color range of particles launched from this emitter.

@:value(true)dragActive:Bool = true

Enable or disable X and Y drag component of particles launched from this emitter.

@:value(0)dragStartMinX:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragStartMinY:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragStartMaxX:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragStartMaxY:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragEndMinX:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragEndMinY:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragEndMaxX:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(0)dragEndMaxY:Float = 0

Sets X and Y drag component of particles launched from this emitter.

@:value(true)accelerationActive:Bool = true

Enable or disable the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationStartMinX:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationStartMinY:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationStartMaxX:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationStartMaxY:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationEndMinX:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationEndMinY:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationEndMaxX:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

@:value(0)accelerationEndMaxY:Float = 0

Sets the acceleration range of particles launched from this emitter. Set acceleration y-values to give particles gravity.

seed:Float

A random seed used to generated particles. Provide a custom seed to reproduce same chain of particles.

getCustomParticleVisual:(existingVisual:Visual) ‑> Visual

Custom particle visual creation. Use this to emit custom visuals as particle. Another option is to create a subclass of ParticleEmitter and override getParticleVisual() method.

@:value(null)read onlyinitializerName:String = null

Methods

inlinesize(width:Float, height:Float):Void

The width and height of the emission area. If not defined (-1), will use visual's width and height bound to this ParticleEmitter object, if any

inlinepos(x:Float, y:Float):Void

The x and y position of the emission, relative to particles parent (if any)

inlinemaxVelocity(maxVelocityX:Float, maxVelocityY:Float):Void

If you are using acceleration, you can use maxVelocity with it to cap the speed automatically (very useful!).

inlinevelocityStart(startMinX:Float, startMinY:Float, ?startMaxX:Float, ?startMaxY:Float):Void

Sets the velocity starting range of particles launched from this emitter. Only used with SQUARE.

inlinevelocityEnd(endMinX:Float, endMinY:Float, ?endMaxX:Float, ?endMaxY:Float):Void

Sets the velocity ending range of particles launched from this emitter. Only used with SQUARE.

inlinespeedStart(startMin:Float, ?startMax:Float):Void

Set the speed starting range of particles launched from this emitter. Only used with CIRCLE.

inlinespeedEnd(endMin:Float, ?endMax:Float):Void

Set the speed ending range of particles launched from this emitter. Only used with CIRCLE.

inlineangularAcceleration(startMin:Float, startMax:Float):Void

Set the angular acceleration range of particles launched from this emitter.

inlineangularDrag(startMin:Float, startMax:Float):Void

Set the angular drag range of particles launched from this emitter.

inlineangularVelocityStart(startMin:Float, ?startMax:Float):Void

The angular velocity starting range of particles launched from this emitter.

inlineangularVelocityEnd(endMin:Float, ?endMax:Float):Void

The angular velocity ending range of particles launched from this emitter.

inlineangleStart(startMin:Float, ?startMax:Float):Void

The angle starting range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

inlineangleEnd(endMin:Float, ?endMax:Float):Void

The angle ending range of particles launched from this emitter. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

inlinelaunchAngle(min:Float, max:Float):Void

The angle range at which particles will be launched from this emitter. Ignored unless launchMode is set to CIRCLE.

inlinelifespan(min:Float, max:Float):Void

The life, or duration, range of particles launched from this emitter.

inlinescaleStart(startMinX:Float, startMinY:Float, ?startMaxX:Float, ?startMaxY:Float):Void

Sets scale starting range of particles launched from this emitter.

inlinescaleEnd(endMinX:Float, endMinY:Float, ?endMaxX:Float, ?endMaxY:Float):Void

Sets scale ending range of particles launched from this emitter.

inlineaccelerationStart(startMinX:Float, startMinY:Float, ?startMaxX:Float, ?startMaxY:Float):Void

Sets acceleration starting range of particles launched from this emitter.

inlineaccelerationEnd(endMinX:Float, endMinY:Float, ?endMaxX:Float, ?endMaxY:Float):Void

Sets acceleration ending range of particles launched from this emitter.

inlinedragStart(startMinX:Float, startMinY:Float, ?startMaxX:Float, ?startMaxY:Float):Void

Sets drag starting range of particles launched from this emitter.

inlinedragEnd(endMinX:Float, endMinY:Float, ?endMaxX:Float, ?endMaxY:Float):Void

Sets drag ending range of particles launched from this emitter.

inlinecolorStart(startMin:Color, ?startMax:Color):Void

Sets color starting range of particles launched from this emitter.

inlinecolorEnd(endMin:Color, ?endMax:Color):Void

Sets color ending range of particles launched from this emitter.

inlinealphaStart(startMin:Float, ?startMax:Float):Void

Sets alpha starting range of particles launched from this emitter.

inlinealphaEnd(endMin:Float, ?endMax:Float):Void

Sets alpha ending range of particles launched from this emitter.

@:value({ quantity : -1, interval : 0.1 })emitContinuously(interval:Float = 0.1, quantity:Int = -1):Void

Start emitting particles continuously.

Parameters:

interval

How often to emit a particle. 0 = never emit, 0.1 = 1 particle every 0.1 seconds, 5 = 1 particle every 5 seconds.

quantity

How many particles to launch before stopping. -1 (default) = never stop

explode(quantity:Int):Void

Burst a given quantity number of particles at once

Parameters:

quantity

How many particles to launch. Does nothing if lower than 1

stop():Void

Stop emitting (if it was emitting)

emitParticle():Void

This function can be used both internally and externally to emit the next particle.

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

components:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start a tween associated with this entity.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

eagerTween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

Start an eager tween associated with this entity. This is the same as a regular tween, except that it will start updating itself using current frame's delta time instead of next frame like in a regular tween.

Parameters:

easing

The easing to use

duration

The duration of the tween

fromValue

The start value of the tween

toValue

The end value of the tween

update

An update function called at each iteration of the tween

Returns:

The instance of the created Tween object

@:value({ hasField : false })component<C>(?name:String, ?component:Null<C>, hasField:Bool = false):C