This is an animated bar model that can be manually colored depending on the user's needs.
How it works is - you create a bar unit and force it to move to the bar owner's position with a timer, and then update its values. The way you can make a hp bar with a color run from green to red, or to make sure that enemies and allies have a different colored bar, create a spell channel bar, and so on.
In order to animate this, you need to use this approach:
JASS:
call SetUnitAnimationByIndex(barUnit, VALUE_BETWEEN_0_AND_100)
The bar is filled when the value is 100 and it's empty when it's 0, so trigger the system in such a way that it display it correctly.
I will probably be uploading a system that does this, however, and that's configurable enough. There are many issues to think of with custom HP/MP bars and I'd want to solve them for majority of users. This bar can also be used for spell channel animation which I think is primarily what people would use it for, after all.
IMPORTANT!!! TO MAKE IT RENDER ON TOP OF EVERYTHING YOU HAVE TO USE SetUnitVertexColor on it at least once! This makes it render in front of everything.
Updated: Now works from left to right (0 to 100)
Updated: Now doesn't clip with anything I think
Also, special thanks to Emm-A- who debugged this to hell and back.
Keywords:
bar, interface, channel