So, the custom rotator node is a good idea, AND you can get it to work IF you use a square image.
Start with a basic Angle.
1/360 = ratio.
Multiply by a scalar. this scalar can go from 11 to 350.
Multiply this by -1 to invert it so that the health-bar will grow clockwise.
From this angle you can start creating Custom Rotator nodes to generate the circular motion.
The idea is that you add/subtract different samples of the same texture mixed in with different custom rotators.
Sort of like your code had it, but with a lot less complexity since there is really only the need for the 1 scalar.
The first rotator will take in the angle and subtract -.02 to create the beginning end-cap. It will also need to clamp to a min of -0.5. The clamp is needed for going past 180.
Make a function that takes in UV and clips the value out in a solid black/white mask on a .5 value (shared code above witht he IF statement).
Pass the rotator to this function, plug into the final result and visualize.
You will have a rotating black and white texture line that matches the Angle you input (plus the offset).
Take a Texture Sample of the square file, and subtract from it’s RGBA (because we need the transparency too) the result of the invers (1-) of the rotator.
This will generate the starting point. With the file similar to what you have shown above you should be able to create the initial part that cuts into a solid line.
To this, you need to add in the endcap.
make another custom rotator, this time feed it the multiply-1 directly.
Get the 1- of the node and plug it into the UV of a new texture sample.
Subtract the NON -1 rotator from before. Clamp.
Add the 2 nodes together, and that’s your Hot Start.
To get the bar to grow past 180deg you need to introduce a 3rd sample, repeat the angle process, and clip the various angles based on the angle being above or below 180.
You subtract a “half texture” either the right side or the left side.
Additionally, this whole process has to be repeated to get the inner color to grow/animate as well.
I would create an entirely different texture to “fill” the circle with, and copy/paste the formula, then just overly all of it with an ADD node mask.
Additionally, my idea from before isn’t “trash”, if you just adopt a unit circle and the simple (yet ephemeral) notion that you already know the correct angle based on the value of the health bar size.
It’s literally 180 / the scalar - in the case of half a health bar.
Given that, you can actually calculate the X and the Y with just radius and
Soh cha toa.
I’m not positive which pathway is less complex material instruction wise, but I doubt either way that performance would be impacted by a health-bar…