Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
NumberInterpolator

Package | spark.effects.interpolation
Class | public class NumberInterpolator
Inheritance | NumberInterpolator Object
Implements | IInterpolator

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

The NumberInterpolator class provides interpolation between start and end values represented as Number instances.

Public Methods

| Method | Defined By
--- | --- | ---
|  | NumberInterpolator() Constructor. | NumberInterpolator
|  | decrement(baseValue:Object, decrementValue:Object):Object Given a base value and a value to subtract from it, return the result of that decrement operation. | NumberInterpolator
|  | getInstance():NumberInterpolator [static] Returns the singleton of this class. | NumberInterpolator
|  | increment(baseValue:Object, incrementValue:Object):Object Given a base value and a value to add to it, return the result of that operation. | NumberInterpolator
|  | interpolate(fraction:Number, startValue:Object, endValue:Object):Object Interpolation for NumberInterpolator consists of a simple parametric calculation between startValue and endValue, using fraction as the fraction of the elapsed time from start to end: return startValue + fraction (endValue - startValue); | NumberInterpolator

Constructor Detail

NumberInterpolator | () | Constructor

`public function NumberInterpolator()`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

Constructor.

Method Detail

decrement | () | method

`public function decrement(baseValue:Object, decrementValue:Object):Object`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

Given a base value and a value to subtract from it, return the result of that decrement operation. For example, if the objects are simple Numbers, the result would be `Number(baseValue) - Number(incrementValue)`. This function is called by the animation system when it needs to dynamically calculate a value given some ending value and a 'by' value that should be subtracted from it. Both of the arguments are of type Object and cannot simply be added together.

Parameters

| `baseValue:Object` — The start value of the interpolation.
| `decrementValue:Object` — The change to apply to the `baseValue`.

Returns

| `Object` — The interpolated value.

getInstance | () | method |

`public static function getInstance():NumberInterpolator`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

Returns the singleton of this class. Since all NumberInterpolators have the same behavior, there is no need for more than one instance.

Returns

| `NumberInterpolator` — The singleton of this class.

increment | () | method |

`public function increment(baseValue:Object, incrementValue:Object):Object`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

Given a base value and a value to add to it, return the result of that operation. For example, if the objects are simple Numbers, the result is a `Number(baseValue) + Number(incrementValue)`. This method is called by the animation system when it needs to dynamically calculate a value given some starting value and a 'by' value that should be added to it. Both of the arguments are of type Object and cannot simply be added together.

Parameters

| `baseValue:Object` — The start value of the interpolation.
| `incrementValue:Object` — The change to apply to the `baseValue`.

Returns

| `Object` — The interpolated value.

interpolate | () | method |

`public function interpolate(fraction:Number, startValue:Object, endValue:Object):Object`

Language Version : | ActionScript 3.0

Product Version : | Flex 4

Runtime Versions : | Flash Player 10, AIR 1.5

Interpolation for NumberInterpolator consists of a simple parametric calculation between `startValue` and `endValue`, using `fraction` as the fraction of the elapsed time from start to end:

    return startValue + fraction (endValue - startValue);

Parameters

| `fraction:Number` — The fraction elapsed of the animation, between 0.0 and 1.0.
| `startValue:Object` — The start value of the interpolation.
| `endValue:Object` — The end value of the interpolation.

Returns

| `Object` — The interpolated value.

Wed Nov 15 2017, 09:50 AM +01:00