Zero to one cylindrical wrap

Hi everyone,

The issue I’m having is wrapping a value around 0 to 1.

Say I’m translating the hue from 0 to 0.6, red to blue, I’d like that to translate through the violet part of the spectrum, not green. Essentially, I’d like to find a way create a cylinder out of the HSV spectrum and translate either clockwise or counter clockwise, be the delta in start color to end color greater of less than 0.5, and have the value transition from 0 to 1 and then down, say to 0.8.

So rather than: 0 to .1 to .2 all the way down to .8. I’d like to have 0 to 1 to .9 to .8.

Anybody out there have a solution to this? Let me know if more information would be helpful.

Thanks,

Bryan

I figured it out. Let me share. The HSB value is stored as Vector3(hue, saturation, brightness)

Hsb.x = Mathf.LerpAngle(Hsb.x * 360f, colorHsb.x * 360f, colorSpeedAdj * Time.deltaTime);
Hsb.x /= 360;
if(Hsb.x < 0)
	{
	Hsb.x = 1f - Hsb.x;
	}