Added SDK 0.28.0
Represents how a particle system is synchronized, including emitting new particles.
Note
This is a low-level particle system API.
Summary
The synchronize function will be called via the ParticleSystem sync method, itself called from the ParticleRenderables referencing the system.
This function is required to update the particle system, and emit any new particles for simulation. This method should make use of the beginUpdate, createParticle, endUpdate and tracked-particle methods.
Parameters
Summary
Add a ParticleEmitter to the synchronizer.
Syntax
synchronizer.addEmitter(emitter);
Summary
Remove a ParticleEmitter from the synchronizer.
Syntax
synchronizer.removeEmitter(emitter);
Summary
Reset synchronizer object, removing all its emitters in the process.
Syntax
synchronizer.reset();
Summary
Apply synchronizer specific archetype parameters to this archetype. This is used by the ParticleManager.
Syntax
synchronizer.applyArchetype(archetype);
Summary
The ParticleRenderable to be tracked for formation of particle trails in the system synchronized by this synchronizer.
Note
Read Only
An implementation of the ParticleSynchronizer interface supporting variable or fixed-time step synchronization, with particles emitted by a set of emitter objects supporting a time-ordered event queue for complex emitter effects.
Summary
Create a new default synchronizer object.
Syntax
var synchronizer = DefaultParticleSynchronizer.create({
fixedTimeStep: 1/60,
maxSubSteps: 4,
renderable: null,
trailFollow: 0.5
});
A value specifying how trails form when a renderable has been specified.
A trailFollow of 1, specifies that an exact trail forms, with already emitted particles appearing to be unaffected by movement of the system.
A trailFollow of 0, specifies that no trail should form and already emitted particles will follow the movements of the system exactly.
The default value is 1.
Summary
Enqueue an event object to the synchronizer for processing.
Syntax
synchronizer.enqueue(event);
event
The event to enqueue. An event is an object with the following fields:
- time
- A number specifying the relative time until the event should take place. Example a time of 1 would specify the event should happen in 1 second from the present time.
- fun
A function to be called when the event occurs, this function will be called with the following parameters:
- event
- The event being processed.
- synchronizer
- The synchronizer object the event relates to.
- system
- The ParticleSystem the synchronizer is working with.
- recycle
- A function to be called to recycle an event object when the synchronizer is reset. This will not be called otherwise, and the normal fun function should deal with recycling in ordinary circumstances.
These properties are the same as those parameters supported for a ParticleArchetype using this synchronizer unless otherwise specified.
The fixed time step to be used for updating the system, this value may be set null to move back to a variable time step.
The maximum amount of sub-steps to make when updating the system if using a fixed time step.
The number specifying how trails form, with 1 specifying a standard trail, and 0 specifying that already emitted particles will follow the movements of the system without trails forming. Any value is permitted, though values between 0 and 1 are ‘expected’.