Add a Tween HSL type

Hello, I’d like to request a tween type that goes to from one HSL specified colour to another HSL colour. For example, tweening from pure red (HSL(0, 100, 50)) to green (HSL(120, 100, 50)) “around the outside of the colour wheel” rather than the current (and only possible) way of changing the tint (a direct line between colours).
So in the example given, using the color tint tween, the rgb values currently go from red (255, 0, 0) to green (0, 255, 0) by taking the (red) 255 to 0 and the (green) 0 to 255, but this means the mid-point is (127, 127, 0) - a sort of half-yellow-brown-dull-colour. Instead, with HSL tweening, the mid-point would be HSL(60, 100, 50) - pure yellow (255, 255, 0).
This would be useful too to tween from B&W to colour, such as making an object (etc.) gain colour on mouse-over etc.
The complication of “a complete circle” or the direction of the hue travel can be inferred, I think, too: for example, from blue (hue 240) to green (120) would go via cyan (180), but if the destination (green) were given as 480 (so “over the top of the wheel” to 360 + 120) this would naturally tween from blue via red to green. - Sort of like how 9AM goes to 3PM - 15:00 over the top, rather than back to 3AM - 03:00.
The excellent ColorConversion library already has conversions to/from RGB and HSL, but the resulting current tween is simply between RGB values so although this library is fantastic, it doesn’t work here because the tween only sees and lerps between the RGB values.

1 Like

You can already accomplish this by installing the “Color conversions” extension, which provides some expressions like HslToRgb. You can simply replace the H with a variable name, and then tween that variable.

1 Like