View Single Post
09-04-14, 10:22 AM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I've implemented the 'ants' animation and the glow via single textures in http://www.wowinterface.com/download...4-BABBars.html as using an animation was not possible.

Don't know if it helps, but it looks like this: (the textures are attached to this post)

Lua Code:
  1. --adding textures for ants/glow
  2. local tGlow = _G[Button:GetName().."Glow"] or Button:CreateTexture(Button:GetName().."Glow","OVERLAY")
  3. tGlow:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertGlow.tga")
  4. tGlow:ClearAllPoints()
  5. tGlow:SetPoint("TOPLEFT", Button, "TOPLEFT")
  6. tGlow:SetPoint("BOTTOMRIGHT", Button, "BOTTOMRIGHT")
  7. tGlow:SetDrawLayer("OVERLAY", 2)
  8. tGlow:Hide()
  9.  
  10. local tAnts = _G[Button:GetName().."Ants"] or Button:CreateTexture(Button:GetName().."Ants","OVERLAY")
  11. tAnts:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertAnts1.tga")
  12. tAnts:ClearAllPoints()
  13. tAnts:SetPoint("TOPLEFT", Button, "TOPLEFT")
  14. tAnts:SetPoint("BOTTOMRIGHT", Button, "BOTTOMRIGHT")
  15. tAnts:SetDrawLayer("OVERLAY", 2)
  16. tAnts:Hide()
  17.  
  18.  
  19. --updating the ants if _G[Button:GetName().."Ants"] is visible
  20. do
  21.     local f = CreateFrame("Frame", "BABMain", UIParent)
  22.     f:SetScript("OnUpdate", function(...)
  23.       for btni, btnv in pairs(Buttons) do
  24.         if _G[btnv:GetName().."Ants"] then
  25.             local tAnts = _G[btnv:GetName().."Ants"]
  26.             if tAnts:IsVisible() then
  27.                 if not tAnts.Step then
  28.                     tAnts.Step = 1
  29.                     tAnts.StepTime = GetTime()
  30.                 end
  31.                 if GetTime() - tAnts.StepTime > 0.025 then
  32.                      tAnts.Step = tAnts.Step + 1
  33.                      if tAnts.Step > 22 then
  34.                          tAnts.Step = 1
  35.                      end
  36.                      tAnts:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertAnts"..tAnts.Step..".tga")
  37.                      tAnts.StepTime = GetTime()
  38.                 end
  39.             end
  40.         end            
  41.       end
  42.     end)
  43. end
Attached Files
File Type: zip IconAlertAnts.zip (103.7 KB, 162 views)

Last edited by Duugu : 09-04-14 at 10:25 AM.
  Reply With Quote