Packagecv.orion.filters
Classpublic class TargetsGravityFilter
ImplementsIFilter

The TargetsGravityFilter causes particles to attract to multiple targets. The targets added won't be moved by Orion, so when a particle hits, it will bounce off of them without pushing the target away.

Using the TargetsGravityFilter, you could easily setup a plantery system and actually have planets orbit around each other.


Example
There are two ways to apply the filter. The first way it so set it via the config object. The second way is to add it to the effectFilters array itself.
  import cv.Orion;
  import cv.orion.filters.TargetsGravityFilter;
  
  var tgf:TargetsGravityFilter = new TargetsGravityFilter();
  tgf.addTarget(mc1, 1000, 20);
  tgf.addTarget(mc2, 2000, 30);
  tgf.addTarget(mc3, 4000, 40);
  
  // First method
  var e:Orion = new Orion(linkageClass, null, {effectFilters:[tgf]});
  
  // Second method
  var e2:Orion = new Orion(linkageClass);
  e2.effectFilters.push(tgf);
  



Public Methods
 MethodDefined by
  
addTarget(target:*, mass:Number = 1000, radius:Number = 0):void
Adds a target for the particles to have a gravity attraction to.
TargetsGravityFilter
  
applyFilter(particle:ParticleVO, target:Orion):void
Applies the specified filter to a particular particle.
TargetsGravityFilter
  
clearTargets():void
Removes all targets from the gravity system, resetting it.
TargetsGravityFilter
  
removeTarget(target:* = null):void
Removes a target from the gravity system.
TargetsGravityFilter
Protected Methods
 MethodDefined by
  
abs(value:Number):Number
TargetsGravityFilter
Method detail
abs()method
protected function abs(value:Number):NumberParameters
value:Number

Returns
Number
addTarget()method 
public function addTarget(target:*, mass:Number = 1000, radius:Number = 0):void

Adds a target for the particles to have a gravity attraction to.

Parameters
target:* — The target to be added.
 
mass:Number (default = 1000) — The mass given to the target. The higher the number, the stronger the gravitational force is.
 
radius:Number (default = 0) — The radius of the target.
applyFilter()method 
public function applyFilter(particle:ParticleVO, target:Orion):void

Applies the specified filter to a particular particle.

Parameters
particle:ParticleVO — The individual particle.
 
target:Orion — The emitter associated with the particle.
clearTargets()method 
public function clearTargets():void

Removes all targets from the gravity system, resetting it.

removeTarget()method 
public function removeTarget(target:* = null):void

Removes a target from the gravity system.

Parameters
target:* (default = null) — The target that was added previously.