Scale progress texture to progress amount
attickdoor opened this issue ยท 2 comments
Is your feature request related to a problem? Please describe.
Say I have a bar texture that is a black-to-white, left-to-right gradient. Currently, the texture spans the entire possible progress width. So 15 pixels from the left side will always be very dark, while 15 pixels from the right side will always be very light.
Describe the solution you'd like
I'd like a toggle-able option to map the entire texture to the current state of the progress bar. That way, if the bar is only halfway complete, my hypothetical gradient is still on the pure white end of the gradient halfway through. I haven't taken a deep dive in the code, but I'm assuming that this would require some modifications in RegionTypes/ProgressBar.lua
and code that uses it.
Describe alternatives you've considered
None.
Additional context
This idea actually comes from FFXIV. Here are two screenshots of my HP bar: one at very low health and the other at full. You can see how the texture they're using for HP is always at its brightest at the rightmost edge, and always at its darkest at the leftmost edge. The middle bits vary based on the current progress.
I think that's too niche for anyone on the team to look at. We get a feature request for that maybe once in the last 5 years.
Implementing that is not that complicated, but I'm not even sure we would take that as a PR. At least to me that behaviour looks worse.
Anyway, if you want to take a look at the necessary changes, you'd want to comment out:
self.fg:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_),
and
extraTexture:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_);
And I think that should display what you want.
In fact the effect in the screenshot could be achieved by using a standard bar texture but forcing a Gradient on the texture's colour.
With no other colour-changing settings involved you could achieve this relatively simply with aura_env.region.bar.fg:SetGradient("HORIZONTAL", r1,g1,b1,r2,g2,b2)
in Actions - Init.