Interpolate between two unpremultiplied colors. @param other color to interpolate to @param t interpolation ratio 0..1, 0 == fully this, 1 == fully other @return interpolated color, unpremultiplied
(Color4f other, float t)
| 71 | * @return interpolated color, unpremultiplied |
| 72 | */ |
| 73 | public Color4f makeLerp(Color4f other, float t) { |
| 74 | if (t <= 0) return this; |
| 75 | if (t >= 1) return other; |
| 76 | Color4f c1 = this.premultiply(); |
| 77 | Color4f c2 = other.premultiply(); |
| 78 | return new Color4f(c1._r + (c2._r - c1._r) * t, |
| 79 | c1._g + (c2._g - c1._g) * t, |
| 80 | c1._b + (c2._b - c1._b) * t, |
| 81 | c1._a + (c2._a - c1._a) * t).unpremultiply(); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Interpolate between two premultiplied colors. |
no test coverage detected