( color1: RGBColorType, color2: RGBColorType, t: number, // 0 to 1 )
| 12 | |
| 13 | // Interpolate between two RGB colors |
| 14 | export function interpolateColor( |
| 15 | color1: RGBColorType, |
| 16 | color2: RGBColorType, |
| 17 | t: number, // 0 to 1 |
| 18 | ): RGBColorType { |
| 19 | return { |
| 20 | r: Math.round(color1.r + (color2.r - color1.r) * t), |
| 21 | g: Math.round(color1.g + (color2.g - color1.g) * t), |
| 22 | b: Math.round(color1.b + (color2.b - color1.b) * t), |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | // Convert RGB object to rgb() color string for Text component |
| 27 | export function toRGBColor(color: RGBColorType): RGBColorString { |
no outgoing calls
no test coverage detected