Packageflare.animate.interpolate
Classpublic class Interpolator
SubclassesArrayInterpolator, ColorInterpolator, DateInterpolator, MatrixInterpolator, NumberInterpolator, ObjectInterpolator, PointInterpolator, RectangleInterpolator

Base class for value interpolators. This class also provides factory methods for creating concrete interpolator instances -- see the create method for details about interpolator creation.



Protected Properties
 PropertyDefined by
  _prop : Property
The property to interpolate.
Interpolator
  _target : Object
The target object whose property is being interpolated.
Interpolator
Public Methods
 MethodDefined by
  
Interpolator(target:Object, property:String, start:Object, end:Object)
Base constructor for Interpolator instances.
Interpolator
  
addInterpolatorRule(f:Function):void
[static] Adds a rule to the interpolator factory.
Interpolator
  
addInterpolatorType(valueType:String, interpType:String):void
[static] Extends the interpolator factory with a new interpolator type.
Interpolator
  
[static] Clears all interpolator rule functions from the interpolator factory.
Interpolator
  
[static] Clears the lookup table of interpolator types, removing all type to interpolator mappings.
Interpolator
  
create(target:Object, property:String, start:Object, end:Object):Interpolator
[static] Returns a new interpolator instance for the given target object, property name, and interpolation target value.
Interpolator
  
interpolate(f:Number):void
Calculate and set an interpolated property value.
Interpolator
  
reclaim(interp:Interpolator):void
[static] Reclaims an interpolator for later recycling.
Interpolator
  
reset(target:Object, property:String, start:Object, end:Object):void
Re-initializes an exising interpolator instance.
Interpolator
Protected Methods
 MethodDefined by
  
init(start:Object, end:Object):void
Performs initialization of an interpolator, typically by initializing the start and ending values.
Interpolator
Property detail
_propproperty
protected var _prop:Property

The property to interpolate.

_targetproperty 
protected var _target:Object

The target object whose property is being interpolated.

Constructor detail
Interpolator()constructor
public function Interpolator(target:Object, property:String, start:Object, end:Object)

Base constructor for Interpolator instances.

Parameters
target:Object — the object whose property is being interpolated
 
property:String — the property to interpolate
 
start:Object — the target value of the interpolation
 
end:Object
Method detail
addInterpolatorRule()method
public static function addInterpolatorRule(f:Function):void

Adds a rule to the interpolator factory. The input function should take 4 arguments -- a target object, property name string, a starting value, and a target value -- and either return a fully qualified class name for the type of interpolator to use, or null if this rule does not apply.

Parameters
f:Function — the rule function for supplying custom interpolator types based on contextual conditions
addInterpolatorType()method 
public static function addInterpolatorType(valueType:String, interpType:String):void

Extends the interpolator factory with a new interpolator type.

Parameters
valueType:String — the fully qualified class name for the object type to interpolate
 
interpType:String — the fully qualified class name for the interpolator class type
clearInterpolatorRules()method 
public static function clearInterpolatorRules():void

Clears all interpolator rule functions from the interpolator factory.

clearInterpolatorTypes()method 
public static function clearInterpolatorTypes():void

Clears the lookup table of interpolator types, removing all type to interpolator mappings.

create()method 
public static function create(target:Object, property:String, start:Object, end:Object):Interpolator

Returns a new interpolator instance for the given target object, property name, and interpolation target value. This factory method follows these steps to provide an interpolator instance:

  1. The list of installed interpolator rules is consulted, and if a rule returns a non-null class name string, an interpolator of that type will be returned.
  2. If all rules return null values, then the class type of the interpolation value is used to look up the appropriate interpolator type for that value. If a matching interpolator type is found, an interpolator is initialized and returned.
  3. If no matching type is found, a default ObjectInterpolator instance is initialized and returned.

By default, the interpolator factory contains two rules. The first rule returns the class name of ColorInterpolator for any property names containing the string "color" or "Color". The second rule returns the class name of ObjectInterpolator for the property name "shape".

The default value type to interpolator type mappings are:

The interpolator factory can be extended either by adding new interpolation rule functions or by adding new mappings from interpolation value types to custom interpolator classes.

Parameters
target:Object
 
property:String
 
start:Object
 
end:Object

Returns
Interpolator
init()method 
protected function init(start:Object, end:Object):void

Performs initialization of an interpolator, typically by initializing the start and ending values. Subclasses should override this method for custom initialization.

Parameters
start:Object — the target value of the interpolation
 
end:Object
interpolate()method 
public function interpolate(f:Number):void

Calculate and set an interpolated property value. Subclasses should override this method to implement custom interpolation routines.

Parameters
f:Number — the interpolation fraction (typically between 0 and 1)
reclaim()method 
public static function reclaim(interp:Interpolator):void

Reclaims an interpolator for later recycling. The reclaimed interpolator should not be in active use by any other classes.

Parameters
interp:Interpolator — the Interpolator to reclaim
reset()method 
public function reset(target:Object, property:String, start:Object, end:Object):void

Re-initializes an exising interpolator instance.

Parameters
target:Object — the object whose property is being interpolated
 
property:String — the property to interpolate
 
start:Object — the target value of the interpolation
 
end:Object