66
77var Linear = require ( '../../math/interpolation/LinearInterpolation' ) ;
88
9+ /**
10+ * Interpolates color values
11+ *
12+ * @namespace Phaser.Display.Color.Interpolate
13+ * @since 3.0.0
14+ */
15+
16+ /**
17+ * Interpolates between the two given color ranges over the length supplied.
18+ *
19+ * @function Phaser.Display.Color.Interpolate.RGBWithRGB
20+ * @since 3.0.0
21+ *
22+ * @param {number } r1 - Red value.
23+ * @param {number } g1 - Blue value.
24+ * @param {number } b1 - Green value.
25+ * @param {number } r2 - Red value.
26+ * @param {number } g2 - Blue value.
27+ * @param {number } b2 - Green value.
28+ * @param {number } [length=100] - Distance to interpolate over.
29+ * @param {number } [index=0] - Index to start from.
30+ *
31+ * @return {ColorObject } An object containing the interpolated color values.
32+ */
933var RGBWithRGB = function ( r1 , g1 , b1 , r2 , g2 , b2 , length , index )
1034{
1135 if ( length === undefined ) { length = 100 ; }
@@ -20,6 +44,19 @@ var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index)
2044 } ;
2145} ;
2246
47+ /**
48+ * Interpolates between the two given color objects over the length supplied.
49+ *
50+ * @function Phaser.Display.Color.Interpolate.ColorWithColor
51+ * @since 3.0.0
52+ *
53+ * @param {Phaser.Display.Color } color1 - The first Color object.
54+ * @param {Phaser.Display.Color } color2 - The second Color object.
55+ * @param {number } [length=100] - Distance to interpolate over.
56+ * @param {number } [index=0] - Index to start from.
57+ *
58+ * @return {ColorObject } An object containing the interpolated color values.
59+ */
2360var ColorWithColor = function ( color1 , color2 , length , index )
2461{
2562 if ( length === undefined ) { length = 100 ; }
@@ -28,6 +65,21 @@ var ColorWithColor = function (color1, color2, length, index)
2865 return RGBWithRGB ( color1 . r , color1 . g , color1 . b , color2 . r , color2 . g , color2 . b , length , index ) ;
2966} ;
3067
68+ /**
69+ * Interpolates between the Color object and color values over the length supplied.
70+ *
71+ * @function Phaser.Display.Color.Interpolate.ColorWithRGB
72+ * @since 3.0.0
73+ *
74+ * @param {Phaser.Display.Color } color1 - The first Color object.
75+ * @param {number } r - Red value.
76+ * @param {number } g - Blue value.
77+ * @param {number } b - Green value.
78+ * @param {number } [length=100] - Distance to interpolate over.
79+ * @param {number } [index=0] - Index to start from.
80+ *
81+ * @return {ColorObject } An object containing the interpolated color values.
82+ */
3183var ColorWithRGB = function ( color , r , g , b , length , index )
3284{
3385 if ( length === undefined ) { length = 100 ; }
0 commit comments