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!