View Single Post
Old 02-05-10, 12:01 PM   #11
Hati-EK
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 20
http://www.wowwiki.com/API_UIFrameFlash

UIFrameFlash(frame, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime)

if you call it more than once(while it's active) - you'll need something that blocks this calls: (atleast for UIFrameFadeIn it makes it nearly go to infinite time - if called unnecessary times (even if you use :GetAlpha()) - you would need something like spareTime=totaltime-(GetAlpha()/totaltime))

(Note this is for UIFrameFadeIn, and not UIFrameFlash)
Code:
local fade_in = {}
local fade_out= {}

--improved UIFrameFadeIn(frame,time,startAlpha,endAlpha,~type)
function lib:UIFrameFadeIn(frame,t,startAlpha,endAlpha,typ)
	local now=GetTime()
	local fname = frame:GetName()
	if typ=='in' then
		local IsInTable,num = self:inTable(fname,fade_in)
		if not IsInTable then
			UIFrameFadeIn(frame,t,startAlpha,endAlpha)
			--tinsert(frame,{icon_name,endTime})
			tinsert(fade_in,{fname,GetTime()+t})
		else
			if now>fade_in[num][2] then
				tremove(fade_in,num)
			end
		end
	elseif typ=='out' then
		local IsInTable,num = self:inTable(fname,fade_out)
		if not IsInTable then
			UIFrameFadeIn(frame,t,startAlpha,endAlpha)
			tinsert(fade_out,{fname,GetTime()+t})
		else
			if now>fade_in[num][2] then
				tremove(fade_out,num)
			end
		end
	end
end
source: LibCooldownIcons-1.0
(Note inTable returns boolean,index of value in table(numeric))

dunno if you can 'calculate' the Pulse-time or want to fix it to some number

Last edited by Hati-EK : 02-05-10 at 07:03 PM.
Hati-EK is offline   Reply With Quote