Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-26-12, 11:44 AM   #8
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
Remade the code here:

OnLoad:
Code:
local open = false;
local active = false;
local xOffset = 100;
local yOffset = 0;
local animDuration = 2;
local point, relTo, relPt, xOff, yOff;

self.animGroup = self:CreateAnimationGroup("SlidingFrame");
self.animOpen = self.animGroup:CreateAnimation("Translation");
self.animOpen:SetDuration(animDuration);
self.animOpen:SetOrder(1);
self.animOpen:SetOffset(-xOffset,yOffset);
self.animOpen:SetScript("OnFinished",function()
  self.animGroup:Pause();
  active = false;
end)
self.animClose = self.animGroup:CreateAnimation("Translation");
self.animClose:SetDuration(animDuration);
self.animClose:SetOrder(2);
self.animClose:SetOffset(xOffset,yOffset);
self.animClose:SetScript("OnFinished",function() active = false; end)
self:SetScript("OnMouseDown",function(self)
if active==false then 
  if open==false then
    active = true;
    open = true;
    self.animGroup:Play();
  else
    active = true;
    open = false;
    self.animGroup:Play();
  end
end
end)
This manner prevents the frame from having to be positioned at all, and can tell if it's currently opening/closing to prevent errors.

Hope this works!
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Sliding Panel


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