Package tripleplay.particle
Class Emitter
java.lang.Object
tripleplay.particle.Emitter
Emits and updates particles according to a particle system configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe effectors used by this emitter.The generator that adds new particles to this emitter.final List<Initializer>
The initializers used by this emitter.final Layer
The layer to which this emitter is attached.final react.Signal<Emitter>
A signal emitted when this emitter has no live particles and no generator.final react.Signal<Emitter>
A signal emitted when the generator for this emitter is exhausted. -
Constructor Summary
ConstructorsConstructorDescriptionEmitter
(ParticleBatch batch, react.Signal<Clock> paint, int maxParticles, Tile tile) Creates an emitter that usesbatch
to render its particles. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParticles
(int count) Adds the specified number of particles.void
Configures this emitter to destroy its layer when it runs out of particles.
-
Field Details
-
layer
The layer to which this emitter is attached. -
generator
The generator that adds new particles to this emitter. -
initters
The initializers used by this emitter. -
effectors
The effectors used by this emitter. -
onExhausted
A signal emitted when the generator for this emitter is exhausted. -
onEmpty
A signal emitted when this emitter has no live particles and no generator.
-
-
Constructor Details
-
Emitter
Creates an emitter that usesbatch
to render its particles. When this emitter's layer is added to the scene graph, it will connect itself topaint
to drive the particle animations, and when its layer is removed, it will disconnect frompaint
.- Parameters:
batch
- the particle batch to use when rendering our particles.paint
- the paint signal which will drive this emitter.maxParticles
- the maximum number of active particles.tile
- the texture to use when rendering particles.
-
-
Method Details
-
addParticles
public void addParticles(int count) Adds the specified number of particles. One usually does not call this manually, but rather configuresgenerator
with a generator that adds particles as desired. -
destroyOnEmpty
public void destroyOnEmpty()Configures this emitter to destroy its layer when it runs out of particles.
-