??? 06/08/10 23:11 Read: times |
#176535 - Already been told Responding to: ???'s previous message |
I have already explained how you interpolate colors.
You perform the work, by computing either a linear interpolation in RGB (less good) or by stepping an angle (and optionally height and radius) in a HSV cone. For each step in the interpolation, you do know what R, G and B you want. So you don't need to play with any 125-step index. You just set your PWM or whatever you are using to generate x% red, y% green and z% blue. If you use HSV, and want to start with red and end up with blue, you then decide in which direction you want to interpolate. Either red -> magenta -> blue. Or red -> yellow -> green -> cyan -> blue. But you will get the color gradients you can see on this page: http://en.wikipedia.org/wiki/HSL_and_HSV The resolution of your analog values (PWM or whatever you use) will decide how smooth you can get the transitions. 5 steps for each primary is too low for smooth transitions. You should look for 32 steps for each primary, giving yu 2^(3*5) = 32768 different combinations. And if you can change the analog values fast enough, you may interpolate between two values by alternating between two neighbour values. |