Closed jkbelcher closed 1 year ago
As mentioned also by @jvyduna here, HSV blend could be divided into HSVCW and HSVCCW.
The ColorStops class could contain an additional array of [HSV] blends, specifying the underlying HSV blend between each stop. When a stop is set/modified, the shortest of (HSVCW / HSVCCW) could be chosen and saved in the array for use when blending between each of its adjacent stops. (At this point the array could be booleans but that would not be as future proof.)
When blendMode of "HSV" is set on the gradient, the direction of HSV blend can then vary from one stop to the next, but the direction will be maintained until the destination color is reached.
Cool - I'm going to add the separate HSV modes. The per-color-stop setting is interesting, but I don't think that really solves the discontinuity problem unless we were to add another layer of logic there, in which ColorStop generation is stateful (e.g. sets new per-stop behaviors in some situations but not others).
Particularly, as I brought up on the other thread, there are two very similar situations that could come about:
From the POV of a stateless GradientUtils... both of those situations look the same. The src/destination hue is changing. Only deeper contextual knowledge would make it feel okay in one of those situations to say "okay I'll hue-modulate more than 180 degrees in this scenario, even though normally I never do that" but not in the other.
I should probably go look more deeply again at how Photoshop etc. do gradient generators. Seems like maybe the gradient generation needs wants to be inside the palette swatch settings. Still don't feel that's bulletproof though, I think it's a + that right now different patterns/effects can do different things with the palette colors (e.g. right now it's more a "working set" of colors rather than a pre-generated single gradient).
Noting various cleanups here: https://github.com/heronarts/LX/commit/30ada6045bf165c9c6412cacb81677c908958411
This doesn't fix the jumping, which can still come about in a various ways (oscillating/cycling colors, or transitions between different saved color swatches).
As of this moment, I guess I don't really intend to fix the jumping, but rather suggest that in cases where it's happening, one of these explicit HSV options can now be used to avoid it with a more predictable behavior. We'll see how it plays out.
Another color oddity documented by @jvyduna. To reproduce:
As color1 oscillates the gradient snaps between two shortest HSV2 routes, causing a visual glitch.