Color Interpolation Demo

Drag the green ball below to change the time value `t` between `0` and `1`. Notice how the interpolated color changes based on the value of `t`. See the equations on the right to understand how the color's red, green, and blue components are calculated using linear interpolation of of `t` between a start and end color.

Time `t = 0.00`

Start color:

End color:

Assume these values:

`Red_{s tart} = 255, Green_{s tart} = 128, Blue_{s tart} = 0`

`Red_{end} = 128, Green_{end} = 0, Blue_{end} = 255`

`t_{s tart} = 0, t_{end} = 1`

Simplify interpolated color equation:

`Colo r = Colo r_{s tart} + (Colo r_{end} - Colo r_{s tart}) * ((t - t_{s tart})/(t_{end} - t_{s tart}))`

`Colo r = Colo r_{s tart} + (Colo r_{end} - Colo r_{s tart}) * ((t - 0)/(1 - 0))`

`Colo r = Colo r_{s tart} + (Colo r_{end} - Colo r_{s tart}) * t`

Solve for red, green, blue: