Trim progress bar using alpha

Hi all,

I have a health bar, and I have the alpha setup in a way where when the alpha is lowered, I want it to trim the health bar. So if the scalar value is 0.89 for example, I want it to trim the last segment of the health bar, whose alpha is 0.9.

How would you go about setting this up? This is what I have so far. Also right now it outputs the health bar WITH the alpha, which I also do not want. I just want the flat color health bar with segments that disappear as the alpha is lowered.

I came across a fantastic video on this, does exactly what I need. I colored the alpha wrong but it was no big deal to fix.


Only problem left is that I have some ugly aliasing as a result.