The minDif() function is going to be used in the script to calculate the number of fade steps. The script would have been marginally easier to write if a fix number of steps was chosen. I chose to dynamically calculate the number of steps because a 'small fade', say from dark-red to maroon, would not look good as a long fade. Likewise, a 'big fade' (from white to black for example) would not look good as a short fade.

This method requires a little more work than setting a fixed number of steps to fade, but the result is worth the effort. As it is, the code could to be improved even further: the code could require that the fade be at least 50 steps if possible. This would prevent short fades in situations where two of the three colours have large differences, but the fade is short because the third colour is only changing a few steps.

Close Window