Quantcast
WoWInterface - View Single Post - Pulsing background?
View Single Post
09-08-20, 09:54 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,292
For this example, you're creating a new texture every update. Create it once when you create the frame and adjust that texture.

Lua Code:
  1. local SPHowFrame = CreateFrame("Frame", nil, UIParent)
  2. SPHowFrame:SetSize(50, 50)
  3. SPHowFrame:SetPoint("CENTER")
  4. SPHowFrame.texture = SPHowFrame:CreateTexture()
  5. SPHowFrame.texture:SetAllPoints()
  6. SPHowFrame.texture:SetTexture("Interface/Buttons/WHITE8X8")
  7.  
  8. local seconds = 0.5
  9. local total = 0
  10.  
  11. local r = 0
  12. local rud = 0.2
  13.  
  14. SPHowFrame:SetScript("OnUpdate", function(self, elapsed)
  15.     total = total + elapsed
  16.     if total > seconds then
  17.       local r = getRedColor()
  18.       print (r)
  19.       self.texture:SetColorTexture(r, 0, 0)
  20.       total = 0
  21.     end
  22. end)
  23.  
  24.  
  25. function getRedColor()
  26.    r = r + rud
  27.    if r > 1 then
  28.       rud = rud * -1
  29.       r=1
  30.    end
  31.    if r < 0 then
  32.       rud = rud * -1
  33.       r=0
  34.    end
  35.    
  36.    return r
  37. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-08-20 at 09:57 PM.
  Reply With Quote