Quantcast
Pulsing background? - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-08-20, 09:14 PM   #1
thatrickguy
A Murloc Raider
Join Date: Sep 2020
Posts: 5
Pulsing background?

Trying to make the background of my frame pulsing red, but it takes a couple of big steps from black to bright red, but then never comes back down to black. I can see the value of r climb from 0 to 1 and back down to 0, but the frame color never changes after it hits red. Thoughts?

Code:
local seconds = 0.5
local total = 0

local r = 0
local rud = 0.2

SPHowFrame:SetScript("OnUpdate", function(self, elapsed)
	total = total + elapsed
	if total > seconds then
      local r = getRedColor()
      print (r)
      self.texture = nil
      self.texture = self:CreateTexture(nil,"BACKGROUND")
      self.texture:SetColorTexture(r, 0, 0)
      self.texture:SetAllPoints(self)
      self.texture = t
      total = 0
	end
end)


function getRedColor()
   r = r + rud
   if r > 1 then
      rud = rud * -1
      r=1
   end 
   if r < 0 then 
      rud = rud * -1
      r=0
   end 
   
   return r
end

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

WoWInterface » Developer Discussions » Graphics Help » Pulsing background?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off