Fading to color

Convergence towards a color

The main idea is that all the pixels must converge towards the selected color. Thus, for each channel (one by primary color: red, green, blue), we must make so that the value increases or decreases up to the end value.

Here an example of color convergence, using a step equal to 20:

According to the value of the step, for each channel, if the value is lower than the end value this one is increased, otherwise it is decreased.

Note that this incremental algoritm, such as the one implemented in my pno code, could be replaced by a linear interpolation between both colors (the same used for alpha blending operation).

For each channel, we compute, for a given alpha value, the new color value by the use of a linear combinaison:

V = (1-)V0 + V1

Here an illustration of such a linear interpolation: