Graduated transition from Green - Yellow - Red
Posted
by
GoldBishop
on Programmers
See other posts from Programmers
or by GoldBishop
Published on 2012-11-21T16:21:42Z
Indexed on
2012/11/21
17:15 UTC
Read the original article
Hit count: 346
I have am having algorithm mental block in designing a way to transition from Green to Red, as smoothly as possible with a, potentially, unknown length of time to transition.
For testing purposes, i will be using 300 as my model timespan but the methodology algorithm design needs to be flexible enough to account for larger or even smaller timespans.
Figured using RGB would probably be the best to transition with, but open to other color creation types, assuming its native to .Net (VB/C#).
Currently i have:
t = 300
x = t/2
z = 0
low = Green (0, 255, 0)
mid = Yellow (255, 255, 0)
high = Red (255, 0, 0)
Lastly, sort of an optional piece, is to account for the possibility of the low
, mid
, and high
color's to be flexible as well. I assume that there would need to be a check to make sure that someone isnt putting in low = (255,0,0)
, mid=(254,0,0)
, and high=(253,0,0)
. Outside of this anomaly, which i will handle myself based on the best approach to evaluate a color.
Question:
- What would be the best approach to do the transition from
low
tomid
and then frommid
tohigh
? - What would be some potential pitfalls of implementing this type of design, if any?
© Programmers or respective owner