* @function LevelRenderer.Tool.Color.prototype.alpha * @description 设置颜色透明度 * @param {string} color - 颜色。 * @param {number} a - 透明度,区间[0,1]。 * @returns {string} rgba颜色值
(color, a)
| 827 | * @returns {string} rgba颜色值 |
| 828 | */ |
| 829 | alpha(color, a) { |
| 830 | if (!this.isCalculableColor(color)) { |
| 831 | return color; |
| 832 | } |
| 833 | if (a === null) { |
| 834 | a = 1; |
| 835 | } |
| 836 | var data = this.getData(this.toRGBA(color)); |
| 837 | data[3] = this.adjust(Number(a).toFixed(4), [0, 1]); |
| 838 | |
| 839 | return this.toColor(data, 'rgba'); |
| 840 | } |
| 841 | |
| 842 | /** |
| 843 | * @function LevelRenderer.Tool.Color.prototype.map |
no test coverage detected