You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HSVToRGB function can now take an optional out argument, which is either a HSVColorObject or a Color object, and the results will be set into that object instead of creating a new one.
Copy file name to clipboardExpand all lines: src/display/color/HSVToRGB.js
+44-27Lines changed: 44 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,14 @@ var GetColor = require('./GetColor');
15
15
* @function Phaser.Display.Color.HSVToRGB
16
16
* @since 3.0.0
17
17
*
18
-
* @param {number} h - The hue, in the range 0 - 1.
19
-
* @param {number} s - The saturation, in the range 0 - 1.
20
-
* @param {number} v - The value, in the range 0 - 1.
18
+
* @param {number} h - The hue, in the range 0 - 1. This is the base color.
19
+
* @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white.
20
+
* @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black.
21
+
* @param {(ColorObject|Phaser.Display.Color)} [out] - A Color object to store the results in. If not given a new ColorObject will be created.
21
22
*
22
-
* @return {ColorObject} An object with the red, green and blue values set in the r, g and b properties.
23
+
* @return {(ColorObject|Phaser.Display.Color)} An object with the red, green and blue values set in the r, g and b properties.
23
24
*/
24
-
varHSVToRGB=function(h,s,v)
25
+
varHSVToRGB=function(h,s,v,out)
25
26
{
26
27
if(s===undefined){s=1;}
27
28
if(v===undefined){v=1;}
@@ -35,44 +36,60 @@ var HSVToRGB = function (h, s, v)
0 commit comments