spark.effects.interpolation

# HSBInterpolator - AS3 Flex

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

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

The HSBInterpolator class provides Hue, Saturation, and Brightness (HSB) color interpolation between RGB `uint` start and end values. Interpolation is done by treating the start and end values as integers with RGB color channel information in the least-significant 3 bytes, converting these to HSB values, and interpolating linearly for each of the h (hue), s (saturation), and b (brightness) parameters.

Because this interpolator may perform more calculations than a typical interpolator that is simply interpolating a given type, specifically to convert the RGB start and end values, this interpolator provides the option of supplying start and end values to the constructor. If you specify the start and end RGB values, then the conversions of these values is calculated once, and does not need to be done at every future call to the `interpolate()` method during the animation.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | HSBInterpolator(startRGB:uint, endRGB:uint) Constructor. | HSBInterpolator
|  | decrement(baseValue:Object, decrementValue:Object):Object Returns the result of the two RGB values added together as HSB colors. | HSBInterpolator
|  | getInstance():HSBInterpolator [static] Returns the singleton of this class. | HSBInterpolator
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | increment(baseValue:Object, incrementValue:Object):Object Returns the result of the two RGB values added together as HSB colors. | HSBInterpolator
|  | interpolate(fraction:Number, startValue:Object, endValue:Object):Object The interpolation for the HSBInterpolator class takes the form of parametric calculations on each of the three values h (hue), s (saturation), and b (brightness) of HSB colors derived from the start and end RGB colors. | HSBInterpolator
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Constructor Detail

### HSBInterpolator

()
Constructor

`public function HSBInterpolator(startRGB:uint, endRGB:uint)`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Constructor. The optional parameters for `startRGB` and `endRGB` help to optimize runtime performance by performing RGB to HSB conversions at construction time, instead of dynamically with every call to the `interpolate()` method.

Parameters

| `startRGB:uint` (default = `NaN`)`` — The starting color, as an unsigned integer RGB value.
| `endRGB:uint` (default = `NaN`)`` — The ending color, as an unsigned integer RGB value.

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

Returns the result of the two RGB values added together as HSB colors. Each value is converted to an HSB color first, and then each component (hue, saturation, and brightness) is treated individually. The saturation and brightness components are clamped to lie between 0 and 1, and the hue degrees are modulated by 360 to lie between 0 and 360.

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():HSBInterpolator`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Returns the singleton of this class.

Note that the singleton of the HSBInterpolator class might be less useful than separate instances of the class because separate instances can take advantage of precalculating the RGB to HSB conversions for the start and end colors.

Returns

| `HSBInterpolator` — The singleton of the HSBInterpolator 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

Returns the result of the two RGB values added together as HSB colors. Each value is converted to an HSB color first, and then each component (hue, saturation, and brightness) will be treated individually. The saturation and brightness components are clamped to lie between 0 and 1, and the hue degrees are modulated by 360 to lie between 0 and 360.

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

The interpolation for the HSBInterpolator class takes the form of parametric calculations on each of the three values h (hue), s (saturation), and b (brightness) of HSB colors derived from the start and end RGB colors.

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.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00