Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ParticleEmitter

[17:7] extends: FxObj

Wraps FXGL's ParticleEmitter, the configuration object that controls how many particles spawn per tick, their colors, sizes, blend mode, and lifetime. ParticleEmitter does not emit on its own; attach it to a ParticleComponent on an Entity (or register it with a standalone ParticleSystem) and the engine drives emission. Configure with the fluent setters here, then construct a ParticleComponent around it and attach to an Entity.

Methods

  • ParticleEmitter ()

    Creates a new empty ParticleEmitter with default settings.

  • adopt (object Ajo)

    Wraps an existing ParticleEmitter AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a ParticleEmitter.
    • @r A new wrapper.
  • setNumParticles (int Count)

    Sets the number of particles emitted per emission tick.

    • @p Count is the per-tick particle count.
    • @r this object
  • setEmissionRate (double Rate)

    Sets the rate at which emission ticks occur (0.0 to 1.0).

    • @p Rate is the emission rate.
    • @r this object
  • setMaxEmissions (int Max)

    Sets the maximum total emission ticks before the emitter stops. -1 means unlimited.

    • @p Max is the maximum emissions.
    • @r this object
  • setMinSize (double Size)

    Sets the minimum particle size (uniform on both axes).

    • @p Size is the minimum size.
    • @r this object
  • setMaxSize (double Size)

    Sets the maximum particle size.

    • @p Size is the maximum size.
    • @r this object
  • setSize (double Min, double Max)

    Sets both min and max particle sizes at once.

    • @p Min is the minimum size.
    • @p Max is the maximum size.
    • @r this object
  • setStartColor (object ColorObj)

    Sets the start color (particle color at birth). Pass a Color wrapper.

    • @p ColorObj is a Color wrapper.
    • @r this object
  • setEndColor (object ColorObj)

    Sets the end color (particle color at death).

    • @p ColorObj is a Color wrapper.
    • @r this object
  • setColor (object ColorObj)

    Sets a uniform color for both start and end.

    • @p ColorObj is a Color wrapper.
    • @r this object
  • getNumParticles ()

    Returns the current particles-per-tick count.

    • @r An int.
  • getEmissionRate ()

    Returns the current emission rate (0.0 to 1.0).

    • @r A double.
  • getMinSize ()

    Returns the minimum particle size.

    • @r A double.
  • getMaxSize ()

    Returns the maximum particle size.

    • @r A double.
  • isFinished ()

    Returns whether the emitter has reached its max emissions.

    • @r A bool.
  • setBlendMode (string BlendModeName)

    Sets the JavaFX BlendMode for emitted particles.

    • @p BlendModeName is the BlendMode enum name ("ADD", "MULTIPLY", "SCREEN", etc.).
    • @r this object
  • setInterpolator (InterpolatorObj)

    Sets the interpolator (easing curve) used while blending between start and end colors and sizes.

    • @p InterpolatorObj is an AussomJavaObject around an Interpolator (see fxgl.Interpolators).
    • @r this object
  • setSourceImage (object ImageObj)

    Sets the source image used to draw each particle. When null, FXGL falls back to a soft circle.

    • @p ImageObj is a fx.Image wrapper (or null to clear).
    • @r this object
  • setAccelerationFunction (callback Cb)

    Sets the acceleration function called per particle. The callback receives no arguments and returns the constant acceleration as an AussomJavaObject around a Point2D. Build the Point2D via aji.newObj("javafx.geometry.Point2D", Ax, Ay).

    • @p Cb is a callback () -> Point2D (returned via aji).
    • @r this object
  • setVelocityFunction (callback Cb)

    Sets the per-particle velocity function. The callback receives an int (particle index) and returns the initial velocity Point2D.

    • @p Cb is a callback (int) -> Point2D.
    • @r this object
  • setSpawnPointFunction (callback Cb)

    Sets the per-particle spawn-point function. Spawn-point is an offset added to the emitter's origin.

    • @p Cb is a callback (int) -> Point2D.
    • @r this object
  • setScaleOriginFunction (callback Cb)

    Sets the per-particle scale-origin function (pivot for the scaling animation).

    • @p Cb is a callback (int) -> Point2D.
    • @r this object
  • setScaleFunction (callback Cb)

    Sets the per-particle scale function. The returned Point2D is added to the particle's scale each tick.

    • @p Cb is a callback (int) -> Point2D.
    • @r this object
  • setExpireFunction (callback Cb)

    Sets the per-particle expire-after-duration function. The callback returns a JavaFX Duration; build it via aji.invokeStatic("javafx.util.Duration", "seconds", S).

    • @p Cb is a callback (int) -> Duration.
    • @r this object
  • getStartColor ()

    Returns the start-color Paint AJO.

  • getEndColor ()

    Returns the end-color Paint AJO.

  • getBlendMode ()

    Returns the BlendMode enum AJO.

  • getInterpolator ()

    Returns the Interpolator AJO.

  • getMaxEmissions ()

    Returns the max-emissions count (-1 means unlimited).

  • isAllowParticleRotation ()

    Returns true when allow-particle-rotation is enabled.

  • getControl ()

    Returns the per-particle Consumer control callback as a raw AJO (or null when unset).

  • getParametricEquation ()

    Returns the parametric Function<Double, Point2D> AJO (or null).

  • getOnRemoveFunction ()

    Returns the on-remove Consumer AJO (or null).

  • getAccelerationFunction ()

    Returns the acceleration Supplier AJO (or null).

  • setAllowParticleRotation (bool V)

    Enables / disables per-particle rotation tracking the emitter's direction.

  • setControl (callback Cb)

    Registers a per-particle Consumer control callback. The callback receives a Particle AJO each tick and may mutate its position / velocity / etc.

  • setParametricEquation (callback Cb)

    Registers a parametric path function (Double progress 0..1 -> Point2D position) for the emitter. Replaces velocity/scale-driven motion with curve following.

  • setOnRemoveFunction (callback Cb)

    Registers a Consumer invoked when a particle expires and is removed from the system.

  • setEntityScaleFunction (callback Cb)

    Registers a Supplier that produces the per-emission entity-scale offset applied to spawn position.

  • numParticlesProperty ()

    Returns the num-particles IntegerProperty AJO for binding.

  • emissionRateProperty ()

    Returns the emission-rate DoubleProperty AJO for binding.

  • minSizeProperty ()

    Returns the min-size DoubleProperty AJO for binding.

  • maxSizeProperty ()

    Returns the max-size DoubleProperty AJO for binding.

  • startColorProperty ()

    Returns the start-color ObjectProperty AJO.

  • endColorProperty ()

    Returns the end-color ObjectProperty AJO.

  • blendModeProperty ()

    Returns the blend-mode ObjectProperty AJO.

  • interpolatorProperty ()

    Returns the interpolator ObjectProperty AJO.

  • allowParticleRotationProperty ()

    Returns the allow-particle-rotation BooleanProperty AJO.