I have a long thin shape (rope, bar). The color of the shape changes smoothly from red (RGB=255 0 0) at one end to yellow (RGB=255 255 0) at the other. I need an equation that will allow me to adjust the G value from 0 to 255 in a way that I can choose where on the shape it has the value 127.5 (equal parts red and yellow, RGB = 255 128 0), if the 127.5 is rounded.(adsbygoogle = window.adsbygoogle || []).push({});

The linear equationy= 255x+ 0 places that point at the midpoint (0.5) of the shape. The rounded values at 0.1 intervals are:

I would like an equation that will enable me to place theG=127.5 value anywhere on that shape from 0.0 to 1.0. I'm not sure if a quadratic equation is the best choice or some type of exponential. For the quadratic, I would have three points ((0.0), (k,127.5), (1,255)) and could solve 3 equations in 3 unknowns.

Is there a better way?

Thanks

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# B Color shading

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**