Packageorg.flintparticles.twoD.actions
Classpublic class MatchVelocity
InheritanceMatchVelocity Inheritance ActionBase

The MatchVelocity action applies an acceleration to each particle to match its velocity to that of its nearest neighbours.



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined by
  
MatchVelocity(maxDistance:Number, acceleration:Number)
The constructor creates a MatchVelocity action for use by an emitter.
MatchVelocity
  
addedToEmitter(emitter:Emitter):void
Instructs the emitter to produce a sorted particle array for optimizing the calculations in the update method of this action.
MatchVelocity
  
Returns a value of 10, so that the MatchVelocity action executes before accelerating actions that act on particles independently of other particles, like Acceleration and GravityWell.
MatchVelocity
 Inherited
This method does nothing.
ActionBase
  
update(emitter:Emitter, particle:Particle, time:Number):void
Checks all particles near the current particle and applies the acceleration to alter the particle's velocity towards their average velocity.
MatchVelocity
Property detail
accelerationproperty
acceleration:Number  [read-write]

The acceleration applied to adjust each particle's velocity to match that of the other particles near it

Implementation
    public function get acceleration():Number
    public function set acceleration(value:Number):void
maxDistanceproperty 
maxDistance:Number  [read-write]

The 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.

Implementation
    public function get maxDistance():Number
    public function set maxDistance(value:Number):void
Constructor detail
MatchVelocity()constructor
public function MatchVelocity(maxDistance:Number, acceleration:Number)

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.

Parameters
maxDistance:Number — 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 — The acceleration applied to adjust each particle's velocity to match that of the other particles near it.

See also

Method detail
addedToEmitter()method
public override function addedToEmitter(emitter:Emitter):void

Instructs 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

getDefaultPriority()method 
public override function getDefaultPriority():Number

Returns a value of 10, so that the MatchVelocity action executes before accelerating actions that act on particles independently of other particles, like Acceleration and GravityWell.

Returns
Number

See also

update()method 
public override function update(emitter:Emitter, particle:Particle, time:Number):void

Checks 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