1 package flare.animate.interpolate
4 * Interpolator for arbitrary <code>Object</code> values. Simply swaps the
5 * initial value for the end value for interpolation fractions greater
6 * than or equal to 0.5.
8 public class ObjectInterpolator extends Interpolator
10 private var _start:Object;
11 private var _end:Object;
14 * Creates a new ObjectInterpolator.
15 * @param target the object whose property is being interpolated
16 * @param property the property to interpolate
17 * @param start the starting object value to interpolate from
18 * @param end the target object value to interpolate to
20 public function ObjectInterpolator(target:Object, property:String,
21 start:Object, end:Object)
23 super(target, property, start, end);
27 * Initializes this interpolator.
28 * @param start the starting value of the interpolation
29 * @param end the target value of the interpolation
31 protected override function init(start:Object, end:Object) : void
38 * Calculate and set an interpolated property value. This method sets
39 * the target object's property to the starting value if the
40 * interpolation fraction is less than 0.5 and to the ending value if
41 * the fraction is greather than or equal to 0.5.
42 * @param f the interpolation fraction (typically between 0 and 1)
44 public override function interpolate(f:Number) : void
46 _prop.setValue(_target, f < 0.5 ? _start : _end);
49 } // end of class ObjectInterpolator