Returns a new color that is p percent between this and the color passed in * @param {Color} c - other color * @param {number} percent * @return {Color}
(c, percent)
| 964 | * @param {number} percent |
| 965 | * @return {Color} */ |
| 966 | lerp(c, percent) |
| 967 | { |
| 968 | ASSERT_COLOR_VALID(c); |
| 969 | ASSERT_NUMBER_VALID(percent); |
| 970 | const p = clamp(percent); |
| 971 | return new Color( |
| 972 | c.r*p + this.r*(1-p), |
| 973 | c.g*p + this.g*(1-p), |
| 974 | c.b*p + this.b*(1-p), |
| 975 | c.a*p + this.a*(1-p)); |
| 976 | } |
| 977 | |
| 978 | /** Sets this color given a hue, saturation, lightness, and alpha |
| 979 | * @param {number} [h] - hue |
no test coverage detected