| Package | org.flintparticles.twoD.actions |
| Class | public class MatchVelocity |
| Inheritance | MatchVelocity ActionBase Object |
This action has a priority of 10, so that it executes before other actions.
| Property | Defined By | ||
|---|---|---|---|
| acceleration : Number
The acceleration applied to adjust each
particle's velocity to match that of the other particles near it
| MatchVelocity | ||
| maxDistance : Number
The maximum distance, in pixels, over which this action operates. | MatchVelocity | ||
![]() | priority : int
Returns a default priority of 0 for this action. | ActionBase | |
| Method | Defined By | ||
|---|---|---|---|
MatchVelocity(maxDistance:Number = 0, acceleration:Number = 0)
The constructor creates a MatchVelocity action for use by an emitter. | MatchVelocity | ||
addedToEmitter(emitter:Emitter):void [override]
Instructs the emitter to produce a sorted particle array for optimizing
the calculations in the update method of this action. | MatchVelocity | ||
![]() | removedFromEmitter(emitter:Emitter):void
This method does nothing. | ActionBase | |
[override]
Checks all particles near the current particle and applies the
acceleration to alter the particle's velocity
towards their average velocity. | MatchVelocity | ||
| acceleration | property |
acceleration:NumberThe acceleration applied to adjust each particle's velocity to match that of the other particles near it
public function get acceleration():Number public function set acceleration(value:Number):void| maxDistance | property |
maxDistance:NumberThe maximum distance, in pixels, over which this action operates. The particle will match its velocity other particles that are this close or closer to it.
public function get maxDistance():Number public function set maxDistance(value:Number):void| MatchVelocity | () | Constructor |
public function MatchVelocity(maxDistance:Number = 0, acceleration:Number = 0)The constructor creates a MatchVelocity action for use by an emitter. To add a MatchVelocity to all particles created by an emitter, use the emitter's addAction method.
ParametersmaxDistance:Number (default = 0) — The maximum distance, in pixels, over which this
action operates. The particle will match its velocity other particles
that are at most this close to it.
| |
acceleration:Number (default = 0) — The acceleration applied to adjust each
particle's velocity to match that of the other particles near it.
|
See also
| addedToEmitter | () | method |
override public function addedToEmitter(emitter:Emitter):voidInstructs the emitter to produce a sorted particle array for optimizing the calculations in the update method of this action.
Parameters
emitter:Emitter — The emitter this action has been added to.
|
See also
| update | () | method |
override public function update(emitter:Emitter, particle:Particle, time:Number):voidChecks all particles near the current particle and applies the acceleration to alter the particle's velocity towards their average velocity.
This method is called by the emitter and need not be called by the user.
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.
|
See also