| Package | org.flintparticles.common.actions |
| Interface | public interface Action extends Behaviour |
| Implementors | ActionBase |
An Action is a class that is used to continuously modify an aspect of a particle by updating the particle every frame. Actions may, for example, move the particle or modify its velocity.
Actions are directly associated with emitters and act on all particles created or added to that emitter. Actions are applied to all particles created by an emitter by using the emitter's addAction method. Actions are removed from the emitter by using the emitter's removeAction method.
The key method in the Action interface is the update method. This is called every frame, for every particle and is where the action modifies the particle's properties.
See also
| Method | Defined By | ||
|---|---|---|---|
![]() | addedToEmitter(emitter:Emitter):void
The addedToEmitter method is called by the emitter when the Behaviour is
added to it. | Behaviour | |
![]() | removedFromEmitter(emitter:Emitter):void
The removedFromEmitter method is called by the emitter when the Behaviour
is removed from it. | Behaviour | |
The update method is used by the emitter to apply the action
to every particle. | Action | ||
| update | () | method |
public function update(emitter:Emitter, particle:Particle, time:Number):voidThe update method is used by the emitter to apply the action to every particle. It is the key feature of the actions and is used to update the state of every particle every frame. This method is called within the emitter's update loop for every particle and need not be called by the user.
Because the method is called for every particle, every frame it is a key area for optimization of the code. When creating a custom action it is usually worth making this method as efficient as possible.
Parameters
emitter:Emitter — The Emitter that created the particle.
| |
particle:Particle — The particle to be updated.
| |
time:Number — The duration of the frame - used for time based updates.
|