View Single Post
10-30-10, 06:53 AM   #6
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Lol, yea, magic. Blizzard is full of that.
I was just trying to combine all 3 of those functions into one since I want to be able to use it one day, and 3 functions that looked redundant.

Code:
function FrameFade(frame, mode, dur) -- Possible Params ( StartingAlpha, and EndingAlpha )
	-- If frame is nil false or otherwise. stop
	if ( not frame ) then
		return
	end
	
	-- Define a Default Fade Time
	if ( dur == 0 or not dur ) then
		dur = 0.5
	end
	
	local FadeOpt = {}
	FadeOpt.timeToFade = dur
	if ( mode:lower() == "in" ) then
		FadeOpt.startAlpha = 0
		FadeOpt.mode = "IN"
		FadeOpt.endAlpha = 1.0
	else
		FadeOpt.startAlpha = 1.0
		FadeOpt.mode = "OUT"
		FadeOpt.endAlpha = 0
	end
	
	frame:SetAlpha(FadeOpt.startAlpha);

	frame.fadeInfo = FadeOpt;
	frame:Show();

	local index = 1;
	while FADEFRAMES[index] do
		-- If frame is already set to fade then return
		if ( FADEFRAMES[index] == frame ) then
			return;
		end
		index = index + 1;
	end
	tinsert(FADEFRAMES, frame);
	frameFadeManager:SetScript("OnUpdate", FrameFade_OnUpdate);
end

Last edited by samishii23 : 10-30-10 at 07:22 AM.
  Reply With Quote