View Single Post
08-04-14, 08:21 AM   #17
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
You can try something like this, drycoded so I'm not sure about the texture coordinates
Lua Code:
  1. local fill = bar:GetStatusBarTexture()
  2. local animatedTexture = bar:CreateTexture(nil, 'ARTWORK', nil, 2)
  3. animatedTexture:SetAllPoints(fill)
  4. animatedTexture:SetTexture('texturepath')
  5.  
  6. local timeSince, textureOffset = 0, 0
  7. bar:SetScript('OnUpdate', function(self, elapsed)
  8.   timeSince = timeSince + elapsed
  9.   if timeSince >= 0.03 then -- speed at which it updates
  10.     local value = self:GetValue()
  11.     local minValue, maxValue = self:GetMinMaxValues()
  12.     local diff = maxValue - minValue
  13.     if diff > 0 then -- cut off horizontally to match the bar fill value, and rotate vertically however you want
  14.       animatedTexture:SetTexCoord(0, (value - minValue) / diff, textureOffset, textureOffset + 1)
  15.     end
  16.     textureOffset = textureOffset + 0.02 -- how far to animate the texture each update
  17.     if textureOffset > 1 then textureOffset = textureOffset - 1 end
  18.     timeSince = 0
  19.   end
  20. end)

Last edited by semlar : 08-23-14 at 12:44 AM.
  Reply With Quote