Skip to main content
Version: Phaser v4.0.0

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:

nametypeoptionaldefaultdescription
color1Phaser.Display.ColorNoThe first Color object.
color2Phaser.Display.ColorNoThe second Color object.
lengthnumberYes100Distance to interpolate over.
indexnumberYes0Index to start from.
hsvbooleanYesfalseWhether to interpolate in HSV.
hsvSignnumberYes0Preferred 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:

nametypeoptionaldefaultdescription
colorPhaser.Display.ColorNoThe Color object.
rnumberNoRed value.
gnumberNoGreen value.
bnumberNoBlue value.
lengthnumberYes100Distance to interpolate over.
indexnumberYes0Index 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:

nametypeoptionaldefaultdescription
h1numberNoHue of the first color (0 to 1).
s1numberNoSaturation of the first color (0 to 1).
v1numberNoValue (brightness) of the first color (0 to 1).
h2numberNoHue of the second color (0 to 1).
s2numberNoSaturation of the second color (0 to 1).
v2numberNoValue (brightness) of the second color (0 to 1).
lengthnumberYes100Distance to interpolate over.
indexnumberYes0Index to start from.
signnumberYes0Hue 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:

nametypeoptionaldefaultdescription
r1numberNoRed value.
g1numberNoGreen value.
b1numberNoBlue value.
r2numberNoRed value.
g2numberNoGreen value.
b2numberNoBlue value.
lengthnumberYes100Distance to interpolate over.
indexnumberYes0Index 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