View Single Post
Old 03-21-12, 06:54 PM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,289
Fading the raidframe manager

I fiddled a while since I got it. The following solution uses animationgroups to show/hide the raidframe manager. It will work in combat and does not cause taints.

The raidframe manager will be hidden until you hover the frame in collapsed state.

lua Code:
  1. --fade the raid frame manager
  2.     local crfm = _G["CompactRaidFrameManager"]
  3.     local crfb = _G["CompactRaidFrameManagerToggleButton"]
  4.  
  5.     local ag1, ag2, a1, a2
  6.  
  7.     --fade in anim
  8.     ag1 = crfm:CreateAnimationGroup()
  9.     a1 = ag1:CreateAnimation("Alpha")
  10.     a1:SetDuration(0.4)
  11.     a1:SetSmoothing("OUT")
  12.     a1:SetChange(1)
  13.     ag1.a1 = a1
  14.     crfm.ag1 = ag1
  15.  
  16.     --fade out anim
  17.     ag2 = crfm:CreateAnimationGroup()
  18.     a2 = ag2:CreateAnimation("Alpha")
  19.     a2:SetDuration(0.3)
  20.     a2:SetSmoothing("IN")
  21.     a2:SetChange(-1)
  22.     ag2.a2 = a2
  23.     crfm.ag2 = ag2
  24.  
  25.     crfm.ag1:SetScript("OnFinished", function(ag1)
  26.       local self = ag1:GetParent()
  27.       if not self.ag2:IsPlaying() then
  28.         self:SetAlpha(1)
  29.       end
  30.     end)
  31.  
  32.     crfm.ag2:SetScript("OnFinished", function(ag2)
  33.       local self = ag2:GetParent()
  34.       if not self.ag1:IsPlaying() then
  35.         self:SetAlpha(0)
  36.       end
  37.     end)
  38.  
  39.     crfm:SetAlpha(0)
  40.  
  41.     crfm:SetScript("OnEnter", function(m)
  42.       if m.collapsed and m:GetAlpha() < 0.8 then
  43.         m.ag2:Stop()
  44.         m:SetAlpha(0)
  45.         m.ag1:Play()
  46.       end
  47.     end)
  48.     crfm:SetScript("OnMouseUp", function(self)
  49.       if self.collapsed and not InCombatLockdown() then
  50.         CompactRaidFrameManager_Toggle(self)
  51.       end
  52.     end)
  53.     crfb:SetScript("OnMouseUp", function(self)
  54.       local m = self:GetParent()
  55.       if not m.collapsed then
  56.         m.ag2:Play()
  57.       end
  58.     end)
  59.     crfm:SetScript("OnLeave", function(m)
  60.       if m.collapsed and GetMouseFocus():GetName() ~= "CompactRaidFrameManagerToggleButton" and GetMouseFocus():GetName() ~= "CompactRaidFrameManager" then
  61.         m.ag1:Stop()
  62.         m:SetAlpha(1)
  63.         m.ag2:Play()
  64.       end
  65.     end)
__________________
| Simple is beautiful.
| Blog | Roth UI | Roth UI FAQ | GoogleCode | Zork | Guild | zorker.de

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 03-21-12 at 06:58 PM.
zork is offline   Reply With Quote