bevy/examples/testbed
ickshonpe 5e3927ba48
UI gradients long hue paths fix (#20010)
# Objective

The false and true arguments for the select statement in `lerp_hue_long`
are misordered, resulting in it taking the wrong hue path:


![oklch-long-wrong-path](https://github.com/user-attachments/assets/68b733ab-be4b-4280-9346-4fdfccdb053a)

## Solution

Swap the arguments around.

Also fixed another case I found during testing. The hue was interpolated
even when it is undefined for one of the endpoints (for example in a
gradient from black to yellow). In those cases it shouldn't interpolate,
instead it should return the hue of the other end point.

## Testing

I added a `linear_gradient` module to the testbed `ui` example, run
with:
```
cargo run --example testbed_ui
```

In the linear gradients screen (press space to switch) it shows a column
of red to yellow linear gradients. The last gradient in the column uses
the OKLCH long path, which should look like this:


![okchlong-red-yellow](https://github.com/user-attachments/assets/23537ff4-f01a-4a03-8473-9df57b2bfaf1)

matching the same gradient in CSS:

https://jsfiddle.net/fevshkdy/14/

if the correct hue path is chosen.
2025-07-07 22:19:24 +00:00
..
2d.rs Rename JustifyText to Justify (#19522) 2025-06-09 19:59:48 +00:00
3d.rs Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
full_ui.rs Newtyped ScrollPosition (#19881) 2025-07-01 17:41:48 +00:00
helpers.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
ui.rs UI gradients long hue paths fix (#20010) 2025-07-07 22:19:24 +00:00