Phaser.Display.Color.Interpolate
Scope: static
Source: src/display/color/Interpolate.js#L11
Since: 3.0.0
Static functions
ColorWithColor
<static> ColorWithColor(color1, color2, [length], [index], [hsv], [hsvSign])
Description:
Interpolates between the two given color objects over the length supplied.
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| color1 | Phaser.Display.Color | No | The first Color object. | |
| color2 | Phaser.Display.Color | No | The second Color object. | |
| length | number | Yes | 100 | Distance to interpolate over. |
| index | number | Yes | 0 | Index to start from. |
| hsv | boolean | Yes | false | Whether to interpolate in HSV. |
| hsvSign | number | Yes | 0 | Preferred direction for HSV interpolation. 0 is nearest, negative always decreases hue, positive always increases hue. |
Returns: Phaser.Types.Display.ColorObject - An object containing the interpolated color values.
Source: src/display/color/Interpolate.js#L102
Since: 3.0.0
ColorWithRGB
<static> ColorWithRGB(color, r, g, b, [length], [index])
Description:
Interpolates between the Color object and color values over the length supplied.
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| color | Phaser.Display.Color | No | The Color object. | |
| r | number | No | Red value. | |
| g | number | No | Green value. | |
| b | number | No | Blue value. | |
| length | number | Yes | 100 | Distance to interpolate over. |
| index | number | Yes | 0 | Index to start from. |
Returns: Phaser.Types.Display.ColorObject - An object containing the interpolated color values.
Source: src/display/color/Interpolate.js#L132
Since: 3.0.0
HSVWithHSV
<static> HSVWithHSV(h1, s1, v1, h2, s2, v2, [length], [index], [sign])
Description:
Interpolates between the two given HSV color ranges over the length supplied. The sign parameter controls the direction of hue interpolation: 0 finds the nearest path, a positive value always increases hue, and a negative value always decreases hue.
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| h1 | number | No | Hue of the first color (0 to 1). | |
| s1 | number | No | Saturation of the first color (0 to 1). | |
| v1 | number | No | Value (brightness) of the first color (0 to 1). | |
| h2 | number | No | Hue of the second color (0 to 1). | |
| s2 | number | No | Saturation of the second color (0 to 1). | |
| v2 | number | No | Value (brightness) of the second color (0 to 1). | |
| length | number | Yes | 100 | Distance to interpolate over. |
| index | number | Yes | 0 | Index to start from. |
| sign | number | Yes | 0 | Hue interpolation direction. 0 = nearest, positive = always increase, negative = always decrease. |
Returns: Phaser.Types.Display.ColorObject - An object containing the interpolated color values.
Source: src/display/color/Interpolate.js#L55
Since: 4.0.0
RGBWithRGB
<static> RGBWithRGB(r1, g1, b1, r2, g2, b2, [length], [index])
Description:
Interpolates between the two given RGB color values over the length supplied.
Parameters:
| name | type | optional | default | description |
|---|---|---|---|---|
| r1 | number | No | Red value. | |
| g1 | number | No | Green value. | |
| b1 | number | No | Blue value. | |
| r2 | number | No | Red value. | |
| g2 | number | No | Green value. | |
| b2 | number | No | Blue value. | |
| length | number | Yes | 100 | Distance to interpolate over. |
| index | number | Yes | 0 | Index to start from. |
Returns: Phaser.Types.Display.ColorObject - An object containing the interpolated color values.
Source: src/display/color/Interpolate.js#L17
Since: 3.0.0