Particles

EntityVisualceramic.Particles (Class)

A visual container that manages a particle emitter with convenient automatic emission modes.

Particles extends Visual to provide a high-level wrapper around ParticleEmitter, adding features like automatic continuous emission and timed burst intervals. This makes it easier to create self-contained particle effects that can be added to the scene and configured with minimal code.

The class is generic, allowing use of custom ParticleEmitter subclasses for specialized particle behaviors.

Key features:

  • Automatic continuous emission with autoEmit
  • Automatic burst intervals with autoExplodeInterval
  • Forwards all emitter properties with emitter* prefix
  • Lifecycle management - destroying particles destroys the emitter
// Create auto-emitting smoke
var smoke = new Particles();
smoke.autoEmit = true;
smoke.emitterInterval = 0.05;
smoke.emitterLifespan(0.5, 1.0);
smoke.emitterSpeedStart(50, 100);
smoke.emitterAlphaEnd(0);
scene.add(smoke);

// Create periodic explosions
var explosions = new Particles();
explosions.autoExplodeInterval = 2.0; // Every 2 seconds
explosions.autoExplodeQuantity = 50;
explosions.emitterSpeedStart(100, 300);
scene.add(explosions);

// Use custom emitter
var custom = new Particles(new MyCustomEmitter());
See: ParticleEmitter The underlying emitter being managed, ParticleItem Individual particle data

Instance Members

emitter: ceramic.Particles.T

The particle emitter managed by this visual.

Can be accessed directly for advanced configuration or to call methods like explode() and emitParticle(). Most common properties are also exposed with emitter* prefix.


autoEmit: Bool

Whether to automatically emit particles continuously.

When set to true, starts continuous emission using emitterInterval. When set to false, stops emission (existing particles continue).

Default: false

particles.emitterInterval = 0.1; // Configure interval first
particles.autoEmit = true; // Start emitting

autoExplodeInterval: Float

Interval in seconds between automatic burst emissions.

When set to a positive value, triggers burst emissions of autoExplodeQuantity particles at regular intervals. Set to -1 to disable automatic bursts.

Default: -1 (disabled)

// Burst 30 particles every 1.5 seconds
particles.autoExplodeQuantity = 30;
particles.autoExplodeInterval = 1.5;

autoExplodeQuantity: Int

Number of particles to emit in each automatic burst.

Used with autoExplodeInterval to create periodic bursts. Only takes effect when autoExplodeInterval is positive.

Default: 64

See: autoExplodeInterval

emitterPaused: Bool

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


emitterInterval: Float

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


emitterLaunchMode: Anonymous

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


emitterVisualScaleActive: Bool

Apply particle scale to underlying visual or not.


emitterKeepScaleRatio: Bool

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


emitterVisualColorActive: Bool

Apply particle color to underlying visual or not.


emitterVisualAlphaActive: Bool

Apply particle alpha to underlying visual or not.


emitterVisualPositionActive: Bool

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


emitterVisualRotationActive: Bool

Apply particle angle to underlying visual rotation or not.


emitterWidth: Float

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


emitterHeight: Float

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


emitterX: Float

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


emitterY: Float

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


emitterVelocityActive: Bool

Enable or disable the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterMaxVelocityX: Float

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


emitterMaxVelocityY: Float

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


emitterVelocityStartMinX: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityStartMinY: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityStartMaxX: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityStartMaxY: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityEndMinX: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityEndMinY: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityEndMaxX: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterVelocityEndMaxY: Float

Sets the velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.


emitterSpeedStartMin: Float

Set the speed range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.


emitterSpeedStartMax: Float

Set the speed range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.


emitterSpeedEndMin: Float

Set the speed range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.


emitterSpeedEndMax: Float

Set the speed range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.


emitterMaxAngularVelocity: Float

Use in conjunction with angularAcceleration for fluid spin speed control.


emitterAngularAccelerationActive: Bool

Enable or disable the angular acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularAccelerationStartMin: Float

Set the angular acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularAccelerationStartMax: Float

Set the angular acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularDragActive: Bool

Enable or disable the angular drag range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularDragStartMin: Float

Set the angular drag range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularDragStartMax: Float

Set the angular drag range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularVelocityActive: Bool

Enable or disable the angular velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularVelocityStartMin: Float

The angular velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularVelocityStartMax: Float

The angular velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularVelocityEndMin: Float

The angular velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngularVelocityEndMax: Float

The angular velocity range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAngleActive: Bool

Enable or disable the angle range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.


emitterAngleStartMin: Float

The angle range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.


emitterAngleStartMax: Float

The angle range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.


emitterAngleEndMin: Float

The angle range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.


emitterAngleEndMax: Float

The angle range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.


emitterIgnoreAngularVelocity: Bool

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


emitterLaunchAngleActive: Bool

Enable or disable the angle range at which particles will be launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Ignored unless launchMode is set to CIRCLE.


emitterLaunchAngleMin: Float

The angle range at which particles will be launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Ignored unless launchMode is set to CIRCLE.


emitterLaunchAngleMax: Float

The angle range at which particles will be launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Ignored unless launchMode is set to CIRCLE.


emitterLifespanActive: Bool

Enable or disable the life, or duration, range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterLifespanMin: Float

The life, or duration, range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterLifespanMax: Float

The life, or duration, range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleActive: Bool

Enable or disable scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleStartMinX: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleStartMinY: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleStartMaxX: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleStartMaxY: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleEndMinX: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleEndMinY: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleEndMaxX: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterScaleEndMaxY: Float

Sets scale range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAlphaActive: Bool

Enable or disable alpha range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAlphaStartMin: Float

Sets alpha range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAlphaStartMax: Float

Sets alpha range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAlphaEndMin: Float

Sets alpha range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAlphaEndMax: Float

Sets alpha range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterColorActive: Bool

Enable or disable color range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterColorStartMin: Color

Sets color range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterColorStartMax: Color

Sets color range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterColorEndMin: Color

Sets color range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterColorEndMax: Color

Sets color range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragActive: Bool

Enable or disable X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragStartMinX: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragStartMinY: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragStartMaxX: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragStartMaxY: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragEndMinX: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragEndMinY: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragEndMaxX: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterDragEndMaxY: Float

Sets X and Y drag component of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.


emitterAccelerationActive: Bool

Enable or disable the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationStartMinX: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationStartMinY: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationStartMaxX: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationStartMaxY: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationEndMinX: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationEndMinY: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationEndMaxX: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterAccelerationEndMaxY: Float

Sets the acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Set acceleration y-values to give particles gravity.


emitterSize(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

Name Type
width Float
height Float

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

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

Name Type
x Float
y Float

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

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

Name Type
maxVelocityX Float
maxVelocityY Float

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

Sets the velocity starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.

Name Type Default
startMinX Float
startMinY Float
startMaxX Float (optional)
startMaxY Float (optional)

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

Sets the velocity ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with SQUARE.

Name Type Default
endMinX Float
endMinY Float
endMaxX Float (optional)
endMaxY Float (optional)

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

Set the speed starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.

Name Type Default
startMin Float
startMax Float (optional)

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

Set the speed ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Only used with CIRCLE.

Name Type Default
endMin Float
endMax Float (optional)

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

Set the angular acceleration range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type
startMin Float
startMax Float

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

Set the angular drag range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type
startMin Float
startMax Float

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

The angular velocity starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMin Float
startMax Float (optional)

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

The angular velocity ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMin Float
endMax Float (optional)

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

The angle starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

Name Type Default
startMin Float
startMax Float (optional)

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

The angle ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. angleEndMin and angleEndMax are ignored unless ignoreAngularVelocity is set to true.

Name Type Default
endMin Float
endMax Float (optional)

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

The angle range at which particles will be launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end. Ignored unless launchMode is set to CIRCLE.

Name Type
min Float
max Float

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

The life, or duration, range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type
min Float
max Float

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

Sets scale starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMinX Float
startMinY Float
startMaxX Float (optional)
startMaxY Float (optional)

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

Sets scale ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMinX Float
endMinY Float
endMaxX Float (optional)
endMaxY Float (optional)

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

Sets acceleration starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMinX Float
startMinY Float
startMaxX Float (optional)
startMaxY Float (optional)

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

Sets acceleration ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMinX Float
endMinY Float
endMaxX Float (optional)
endMaxY Float (optional)

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

Sets drag starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMinX Float
startMinY Float
startMaxX Float (optional)
startMaxY Float (optional)

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

Sets drag ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMinX Float
endMinY Float
endMaxX Float (optional)
endMaxY Float (optional)

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

Sets color starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMin Color
startMax Color (optional)

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

Sets color ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMin Color
endMax Color (optional)

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

Sets alpha starting range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
startMin Float
startMax Float (optional)

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

Sets alpha ending range of particles launched from this #if cs (cast emitter:ParticleEmitter) #else emitter #end.

Name Type Default
endMin Float
endMax Float (optional)

new(?emitter: ceramic.Particles.T): Void

Creates a new Particles visual with an optional custom emitter.

Name Type Default Description
emitter ceramic.Particles.T (optional) Optional custom ParticleEmitter instance or subclass. If not provided, creates a standard ParticleEmitter.

Private Members

init(): Void

Initializes the particles system.

Sets up lifecycle binding so that destroying the emitter also destroys this visual container.


clearExplodeInterval(): Void

Timer cleanup function for auto-explode intervals.


computeAutoExplode(): Void

Updates the automatic explosion timer based on current settings.

Clears any existing timer and creates a new one if both interval and quantity are positive.


doAutoExplode(): Void

Executes an automatic burst emission.

Called by the interval timer to emit the configured quantity of particles.

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()