
Attention: Maths ahead! Non-geeks may prefer to avoid the equations, and just look at the pretty colors instead.
Previously, on Jacek Writes: our hero introduced the topic of smoothly blending between two colors algorithmically.
Last time, I defined an equation for blending linearly between two color vectors a and b as time, t, increases from 0 to 1:
line(t, a, b) = a + t * (b - a)
After a little algebra, we can rewrite that function as:
line(t, a, b) = (1-t)(a) + bt
Linear blending looks just fine for blending between two colors, as demonstrated above. Starting from the left, we progress from red to blue, passing through magenta and purples. Looks pretty good, right?


Recent Comments