[ view source ]
class ParticleEmitter
package ceramic
extends Entity
implements Observable, Component
Available on all targets
A particle emitter.
Events
observedDirty(instance:ParticleEmitter, fromSerializedField:Bool):Void
Event when any observable value as changed on this instance.
statusChange(current:ParticlesStatus, previous:ParticlesStatus):Void
Event when status field changes.
Constructor
Variables
observedDirty:Bool = false
read onlystatus:ParticlesStatus = IDLE
Determines whether the emitter is currently emitting particles or not
paused:Bool = false
Determines whether the emitter is currently paused. It is totally safe to directly toggle this.
interval:Float = 0.1
How often a particle is emitted, if currently emitting. Can be modified at the middle of an emission safely;
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
.
keepScaleRatio:Bool = false
Keep the scale ratio of the particle. Uses the scaleX
value for reference.
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
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
maxVelocityX:Float = 10000
If you are using acceleration
, you can use maxVelocity
with it
to cap the speed automatically (very useful!).
maxVelocityY:Float = 10000
If you are using acceleration
, you can use maxVelocity
with it
to cap the speed automatically (very useful!).
velocityActive:Bool = true
Enable or disable the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityStartMinX:Float = -100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityStartMinY:Float = -100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityStartMaxX:Float = 100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityStartMaxY:Float = 100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityEndMinX:Float = -100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityEndMinY:Float = -100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityEndMaxX:Float = 100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
velocityEndMaxY:Float = 100
Sets the velocity range of particles launched from this emitter. Only used with SQUARE
.
speedStartMin:Float = 0
Set the speed range of particles launched from this emitter. Only used with CIRCLE
.
speedStartMax:Float = 100
Set the speed range of particles launched from this emitter. Only used with CIRCLE
.
speedEndMin:Float = 0
Set the speed range of particles launched from this emitter. Only used with CIRCLE
.
speedEndMax:Float = 100
Set the speed range of particles launched from this emitter. Only used with CIRCLE
.
maxAngularVelocity:Float = 10000
Use in conjunction with angularAcceleration for fluid spin speed control.
angularAccelerationActive:Bool = true
Enable or disable the angular acceleration range of particles launched from this emitter.
angularAccelerationStartMin:Float = 0
Set the angular acceleration range of particles launched from this emitter.
angularAccelerationStartMax:Float = 0
Set the angular acceleration range of particles launched from this emitter.
angularDragActive:Bool = true
Enable or disable the angular drag range of particles launched from this emitter.
angularVelocityActive:Bool = true
Enable or disable the angular velocity range of particles launched from this emitter.
angularVelocityStartMin:Float = 0
The angular velocity range of particles launched from this emitter.
angularVelocityStartMax:Float = 0
The angular velocity range of particles launched from this emitter.
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
.
angleStartMin:Float = 0
The angle range of particles launched from this emitter.
angleEndMin
and angleEndMax
are ignored unless ignoreAngularVelocity
is set to true
.
angleStartMax:Float = 0
The angle range of particles launched from this emitter.
angleEndMin
and angleEndMax
are ignored unless ignoreAngularVelocity
is set to true
.
angleEndMin:Float = 0
The angle range of particles launched from this emitter.
angleEndMin
and angleEndMax
are ignored unless ignoreAngularVelocity
is set to true
.
angleEndMax:Float = 0
The angle range of particles launched from this emitter.
angleEndMin
and angleEndMax
are ignored unless ignoreAngularVelocity
is set to true
.
ignoreAngularVelocity:Bool = false
Set this if you want to specify the beginning and ending value of angle,
instead of using angularVelocity
(or angularAcceleration
).
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
.
launchAngleMin:Float = -180
The angle range at which particles will be launched from this emitter.
Ignored unless launchMode
is set to CIRCLE
.
launchAngleMax:Float = 180
The angle range at which particles will be launched from this emitter.
Ignored unless launchMode
is set to CIRCLE
.
lifespanActive:Bool = true
Enable or disable the life, or duration, range of particles launched from this emitter.
dragActive:Bool = true
Enable or disable X and Y drag component of particles launched from this emitter.
accelerationActive:Bool = true
Enable or disable the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationStartMinX:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationStartMinY:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationStartMaxX:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationStartMaxY:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationEndMinX:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationEndMinY:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
accelerationEndMaxX:Float = 0
Sets the acceleration
range of particles launched from this emitter.
Set acceleration y-values to give particles gravity.
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.
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.
emitContinuously(interval:Float = 0.1, quantity:Int = -1):Void
Start emitting particles continuously.
Parameters:
interval | How often to emit a particle.
|
---|---|
quantity | How many particles to launch before stopping. |
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 |
---|
emitParticle():Void
This function can be used both internally and externally to emit the next particle.