UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

36 lines (29 loc) 964 B
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ var HSVToRGB = require('./HSVToRGB'); /** * Get HSV color wheel values in an array which will be 360 elements in size. * * @function Phaser.Display.Color.HSVColorWheel * @since 3.0.0 * * @param {number} [s=1] - The saturation, in the range 0 - 1. * @param {number} [v=1] - The value, in the range 0 - 1. * * @return {array} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. */ var HSVColorWheel = function (s, v) { if (s === undefined) { s = 1; } if (v === undefined) { v = 1; } var colors = []; for (var c = 0; c <= 359; c++) { colors.push(HSVToRGB(c / 359, s, v)); } return colors; }; module.exports = HSVColorWheel;