开发者

Display a color from a position on a gradient

开发者 https://www.devze.com 2023-04-02 11:41 出处:网络
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 =

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号