Packagecom.asterisq.constellation.behaviors
Classpublic class VelocityReductionBehavior
InheritanceVelocityReductionBehavior Inheritance Behavior Inheritance flash.events.EventDispatcher

Behavior for slowly reducing node renderer velocity to zero after a delay.

Dispatches an Event.COMPLETE event after the delay and the duration when the velocity has been reduced to zero.

If autoStart is set to true, the velocity limit will be reset and the countdown restarted when the node renderers change. This is triggered by the Event.CHANGE event.

If autoStart is set to true and a node renderer is pressed, the velocity limit will be reset. In this case the countdown won't restart until the mouse is released.



Public Properties
 PropertyDefined by
  autoStart : Boolean
Indicates whether the timer should restart automatically when the graph changes.
VelocityReductionBehavior
  constellation : IConstellation
The constellation instance this behavior belongs to.
VelocityReductionBehavior
  delay : Number
The delay, in milliseconds, before starting to reduce the velocity.
VelocityReductionBehavior
  duration : Number
The length of time over which the velocity is reduced to zero.
VelocityReductionBehavior
 Inheritedenabled : Boolean
Indicates whether this behavior is currently enabled.
Behavior
  initialVelocityLimit : Number
The initial velocity limit applied to each node renderer.
VelocityReductionBehavior
 InheritednodeRendererFilterFunction : Function
The function which determines the node renderers affected by this behavior.
Behavior
Public Methods
 MethodDefined by
  
VelocityReductionBehavior(initialVelocityLimit:Number = 20, delay:Number = 5000, duration:Number = 1000, autoStart:Boolean = true, autoPause:Boolean = true)
Creates a new velocity reduction behavior.
VelocityReductionBehavior
 Inherited
Indicates whether this class affects node renderers' acceleration.
Behavior
 Inherited
Determines whether this behavior affects the given node renderer.
Behavior
 Inherited
affectsPosition():Boolean
Indicates whether this class affects node renderers' position.
Behavior
  
affectsVelocity():Boolean
Indicates whether this class affects node renderers' velocity.
VelocityReductionBehavior
 Inherited
fromXML(elem:XML):Behavior
[static] Creates an IBehavior instance and initializes it with the given XML data.
Behavior
  
reset():void
Stops the delay countdown and resets the velocity limit to the initial value.
VelocityReductionBehavior
  
restart():void
Equivalent to a call to reset() followed by start().
VelocityReductionBehavior
  
start():void
Starts the delay countdown timer.
VelocityReductionBehavior
 Inherited
stepEnd():void
Method called at the end of a step.
Behavior
  
stepStart():void
Method called at the beginning of a step.
VelocityReductionBehavior
 Inherited
Modifies the given node renderer's acceleration.
Behavior
 Inherited
Modifies the given node renderer's position.
Behavior
  
Modifies the given node renderer's velocity.
VelocityReductionBehavior
Protected Methods
 MethodDefined by
  
loadValuesFromXML(behaviorElem:XML):void
Updates this behavior with values from the given XML element.
VelocityReductionBehavior
Property detail
autoStartproperty
autoStart:Boolean  [read-write]

Indicates whether the timer should restart automatically when the graph changes. If true, the timer will restart when the Constellation dispatches the "change" event.

Implementation
    public function get autoStart():Boolean
    public function set autoStart(value:Boolean):void
constellationproperty 
constellation:IConstellation  [read-write]

The constellation instance this behavior belongs to.

Implementation
    public function get constellation():IConstellation
    public function set constellation(value:IConstellation):void
delayproperty 
delay:Number  [read-write]

The delay, in milliseconds, before starting to reduce the velocity. If you set the delay while the timer is running, the timer will restart.

Implementation
    public function get delay():Number
    public function set delay(value:Number):void
durationproperty 
duration:Number  [read-write]

The length of time over which the velocity is reduced to zero. If you set the duration while the timer is running, the timer will restart.

Implementation
    public function get duration():Number
    public function set duration(value:Number):void
initialVelocityLimitproperty 
initialVelocityLimit:Number  [read-write]

The initial velocity limit applied to each node renderer.

Implementation
    public function get initialVelocityLimit():Number
    public function set initialVelocityLimit(value:Number):void
Constructor detail
VelocityReductionBehavior()constructor
public function VelocityReductionBehavior(initialVelocityLimit:Number = 20, delay:Number = 5000, duration:Number = 1000, autoStart:Boolean = true, autoPause:Boolean = true)

Creates a new velocity reduction behavior.

Parameters
initialVelocityLimit:Number (default = 20)
 
delay:Number (default = 5000)
 
duration:Number (default = 1000)
 
autoStart:Boolean (default = true)
 
autoPause:Boolean (default = true)
Method detail
affectsVelocity()method
public override function affectsVelocity():Boolean

Indicates whether this class affects node renderers' velocity. This function must return true if this behavior affects velocity.

Returns
Boolean
loadValuesFromXML()method 
protected override function loadValuesFromXML(behaviorElem:XML):void

Updates this behavior with values from the given XML element. This method should be overridden to update this Behavior.

Parameters
behaviorElem:XML
reset()method 
public function reset():void

Stops the delay countdown and resets the velocity limit to the initial value.

restart()method 
public function restart():void

Equivalent to a call to reset() followed by start(). Resets the velocity limit to the initial value and starts the delay countdown.

start()method 
public function start():void

Starts the delay countdown timer.

stepStart()method 
public override function stepStart():void

Method called at the beginning of a step.

updateVelocity()method 
public override function updateVelocity(nodeRenderer:INodeRenderer):INodeRenderer

Modifies the given node renderer's velocity. This method will never be called if affectsVelocity() doesn't return true. This method should be overridden to affect the given node renderer's velocity.

Parameters
nodeRenderer:INodeRenderer

Returns
INodeRenderer