Advertisement
stoneharry

Untitled

May 16th, 2015
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local function Chain_OnUpdate(self, elapsed)
  2.     if (self.chainPause) then
  3.         return;
  4.     end
  5.    
  6.     local rev = self.chainRev;
  7.     local e = self.chainElapsed + elapsed;
  8.     self.chainElapsed = e;
  9.    
  10.     local points = 3;
  11.     local off = {self.chainY+20, -30, 10};
  12.     local dur = {self.chainY/400, 0.2, 0.3};
  13.    
  14.     local tDur = 0;
  15.     for i = 1, points do
  16.         tDur = tDur + dur[i];
  17.     end
  18.    
  19.     e = math.min(e, tDur);
  20.     if (rev) then
  21.         e = math.max(0, tDur - e);
  22.     end
  23.    
  24.     local aDur = 0;
  25.     local y = -10;
  26.    
  27.     if (e > 0) then
  28.         for i = 1, points do
  29.             if (e < aDur + dur[i]) then
  30.                 y = y + off[i] * ((e - aDur) / dur[i]);
  31.                 pause = false;
  32.                 break;
  33.             else
  34.                 y = y + off[i];
  35.             end
  36.             aDur = aDur + dur[i];
  37.         end
  38.     end
  39.    
  40.     self:SetPoint("BOTTOMLEFT", UIParent, "TOPLEFT", self:GetLeft(), -y);
  41.    
  42.     if ((rev and e == 0) or (not rev and e == tDur)) then
  43.         self.chainRev = not rev;
  44.         self.chainPause = true;
  45.         self.chainElapsed = 0;
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement