The animation system rotates the entire UI object, not really something you want for a statusbar. What I've seen done is create a rotating texcoord set that adjusts its size to match whatever height adjustments you make to the bar.
Lua Code:
local HalfSQRT2,LLAngle,LRAngle,UAngle=(2^0.5)/2,0.75*math.pi,0.25*math.pi,1.5*math.pi;
local function Vector(x,y,angle,dist) return x+math.cos(angle)*dist,y+math.sin(angle)*dist; end
local function CalcTexCoord(angle,percent)
local LLx,LLy=Vector(0.5,0.5,LLAngle+angle,HalfSQRT2);
local LRx,LRy=Vector(0.5,0.5,LRAngle+angle,HalfSQRT2);
local ULx,ULy=Vector(LLx,LLy,UAngle+angle,percent);
local URx,URy=Vector(LRx,LRy,UAngle+angle,percent);
return ULx,ULy,LLx,LLy,URx,URy,LRx,LRy;
end
local ManaFrame=CreateFrame("Frame",nil,UIParent);-- Container for mana orb texture
ManaFrame:SetPoint("CENTER");
ManaFrame:SetSize(256,256);
local ManaOrb=ManaFrame:CreateTexture(nil,"ARTWORK");
ManaOrb:SetTexture("Interface\\AddOns\\YourAddOn\\PathToFile");-- Set to whatever your texture is
ManaOrb:SetPoint("BOTTOM");-- Attach to bottom of frame
ManaOrb:SetSize(ManaFrame:GetSize());-- Init to frame size
ManaFrame.PercentValue=1;-- Init
ManaFrame:SetScript("OnUpdate",function(self) HealthOrb:SetTexCoord(CalcTexCoord((GetTime()%2)*math.pi,self.PercentValue)); end);
ManaFrame.Unit="player";
ManaFrame:RegisterUnitEvent("UNIT_DISPLAYPOWER",ManaFrame.Unit);
ManaFrame:RegisterUnitEvent("UNIT_POWER_UPDATE",ManaFrame.Unit);
ManaFrame:RegisterUnitEvent("UNIT_MAXPOWER",ManaFrame.Unit);
ManaFrame:SetScript("OnEvent",function(self,event,...)
if select(2,UnitPowerType(self.Unit))=="MANA" then
local percent=UnitPower(self.Unit)/UnitPowerMax(self.Unit);
ManaOrb:SetHeight(self:GetHeight()*percent);-- Adjust texture height
ManaOrb.PercentValue=percent;-- Texcoord updates from OnUpdate script
self:Show();
else self:Hide(); end
end);