Display a color from a position on a gradient
Using the Kinect, I'm taking height measurements of both hands from a table, and displaying a color on the screen that's determined by the proportion of the heights. For example, if handProportion = .5, the screen would be green. At any other proportion, the screen is red. However, I need green to transition smoothly into red.
My first instinct i开发者_StackOverflow中文版s color bitshifting, but that sounds complicated. How can I write a function that displays a color from a gradient based on a position value in that gradient?
Thank you!
It seems like you need to interpolate between two colors given a ratio: Color Interpolation Between 3 Colors in .NET
精彩评论