Improved Health Circle?

I am currently using this as my code to do a circle to represent health. However, it is coming out clunky, and unappealing. Does anyone have a better function or idea I can use?

``````
local clamp, cos, sin, deg2rad = math.Clamp, math.cos, math.sin, math.pi/180
function DrawPartialCircle( x, y, radius, linewidth, startangle, endangle, aa )
-- Thanks for getting me started on how to do this python1320 <3
aa = aa or 1;
startangle = clamp( startangle or 0, 0, 360 );
endangle = clamp( endangle or 360, 0, 360 );

if endangle < startangle then
local temp = endangle;
endangle = startangle;
startangle = temp;
end

for i=startangle, endangle, aa do
local _i = i * deg2rad;
surface.DrawTexturedRectRotated(cos( _i ) * (radius - linewidth) + x,sin( _i ) * (radius - linewidth) + y, linewidth, aa*2, -i );
end
end

``````

I would draw it with this.

``````
DrawPartialCircle( 80, ScrH() - 70, 65, 13, 0, math.max( 0, client:Health() ) * 3.6, 1 )

``````

Any tips?

Draw a .png texture of a half circle, and set

render.SetScissorRect over it, and rotate that texture so that it leaves the scissor rectangle thus not drawing the part outside it (or vice versa). You can repeat this effect flipped for the second half of the circle, or make each half represent different things (like one half for health, the other in another color for armor or sprint remaining).

Alright, thanks.