An emitter of a single particle group. Part of Particles simulation system.

Constructor

new(p:Particles)

Create a new particle group instance.

Parameters:

p

The parent Particles instance. Group does not automatically adds itself to the Particles.

Variables

@:value(1)animationRepeat:Float = 1

The amount of times the animations will loop during lifetime. Settings it to 0 will stop the animation playback and each particle will have a random frame assigned at emission time.

@:value(Alpha)blendMode:BlendMode = Alpha

Configures blending mode for this group.

colorGradient:Texture

Optional color gradient texture for tinting.

@:value(0)dx:Int = 0

Initial particle X offset.

@:value(0)dy:Int = 0

Initial particle Y offset.

@:value(-0.5)emitAngle:Float = -0.5

Normalized particle emission direction angle.

@:value(0)emitDelay:Float = 0

Fixed delay before particle appears after being emitted.

Usage note for non-relative mode: Particle will use configuration that was happened at time of emission, not when delay timer runs out.

@:value(false)emitDirectionAsAngle:Bool = false

When enabled, particle rotation will match the particle movement direction angle.

@:value(50.)emitDist:Float = 50.

Additional random particle position distance from emission point.

@:value(50.)emitDistY:Float = 50.

Secondary random position distance modifier (used by Box emitMode)

@:value(true)emitLoop:Bool = true

If enabled, group will emit new particles indefinitely maintaining number of particles at ParticleGroup.nparts.

@:value(Point)emitMode:PartEmitMode = Point

The pattern in which particles are emitted. See individual PartEmitMode values for more details.

@:value(0.)emitStartDist:Float = 0.

Initial particle position distance from emission point.

@:value(0)emitSync:Float = 0

Randomized synchronization delay before particle appears after being emitted.

Usage note for non-relative mode: Particle will use configuration that was happened at time of emission, not when delay timer runs out.

@:value(true)enable:Bool = true

Disabling the group immediately removes it from rendering and resets it's state.

@:value(0.2)fadeIn:Float = 0.2

The time in seconds during which particle alpha fades in after being emitted.

@:value(0.8)fadeOut:Float = 0.8

The time in seconds at which particle will start to fade out before dying. Fade out time can be calculated with lifetime - fadeOut.

@:value(1)fadePower:Float = 1

The exponent of the alpha transition speed on fade in and fade out.

@:value(0)frameCount:Int = 0

Total count of frames used by the group.

When 0, amount of frames in a group calculated by frameDivisionX * frameDivisionY.

Otherwise it's min(frameDivisionX * frameDivisionY, frameCount).

@:value(1)frameDivisionX:Int = 1

Horizontal frame divisor.

@:value(1)frameDivisionY:Int = 1

Vertical frame divisor.

@:value(0)gravity:Float = 0

Gravity applied to the particle.

@:value(0)gravityAngle:Float = 0

The gravity angle in radians. 0 points down.

@:value(true)incrX:Bool = true

If enabled, particle will increase on X-axis with sizeIncr.

@:value(true)incrY:Bool = true

If enabled, particle will increase on Y-axis with sizeIncr.

@:value(true)isRelative:Bool = true

When enabled, causes particles to always render relative to the emitter position, moving along with it. Otherwise, once emitted, particles won't follow the emitter, and will render relative to the scene origin.

Non-relative mode is useful for simulating something like a smoke coming from a moving object, while relative mode things like jet flame that have to stick to its emission source.

@:value(1)life:Float = 1

Initial particle lifetime.

@:value(0)lifeRand:Float = 0

Additional random lifetime increase when particle is created.

name:String

The group name.

@:value(100)nparts:Int = 100

Maximum number of particles alive at a time.

@:value(true)rebuildOnChange:Bool = true

Should group rebuild on parameters change.

Note that some parameters take immediate effect on the existing particles, and some would force rebuild regardless of this setting.

Parameters that take immediate effect: speedIncr, gravity, gravityAngle, fadeIn, fadeOut, fadePower, rotAuto, rotInit, incrX, incrY, emitLoop and blendMode

Parameters that will always force rebuild: enable, sortMode, isRelative, texture, frameCount, frameDivisionX, frameDivisionY and nparts

Parameters that newer cause rebuild: blendMode, colorGradient and animationRepeat

@:value(false)rotAuto:Bool = false

If enabled, particles will be automatically rotated in the direction of particle velocity.

@:value(0)rotInit:Float = 0

Initial particle rotation.

@:value(0)rotSpeed:Float = 0

Initial rotation speed of the particle.

@:value(0)rotSpeedRand:Float = 0

Additional random rotation speed when particle is created.

@:value(1)size:Float = 1

Initial particle size.

@:value(0)sizeIncr:Float = 0

If set, particle will change it's size with time.

@:value(0)sizeRand:Float = 0

Additional random size increase when particle is created.

@:value(None)sortMode:PartSortMode = None

Does nothing.

@:value(50.)speed:Float = 50.

Initial particle velocity.

@:value(0)speedIncr:Float = 0

If set, particle velocity will change over time.

@:value(0)speedRand:Float = 0

Additional random velocity increase when particle is created.

texture:Texture

The texture used to render particles.

Methods

load(version:Int, o:Dynamic):Void

Loads the particle group configuration from a given object.

Parameters:

version

The version of Particles that were used to save the configuration.

o

The previously saved configuration data to load.

rebuild():Void

Reset current state of particle group and re-emit all particles.

save():Unknown

Saves the particle group configuration into a Dynamic object.