animationsystem

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • animationsystem

      Source Code: Animationsystm.LUA

      1. --[[ animTable = { --Note that only consistent data should be in here. These tables are meant to be shared across "sessions" of animations. Put changing data in the frame.
      2. totalTime = number, --Time to complete the animation in seconds.
      3. updateFunc = function, --The function called to do the actual change. Takes self, elapsed fraction. Usually frame.SetPoint, frame.SetAlpha, ect.
      4. getPosFunc = function, --The function returning the data being passed into updateFunc. For example. might return .18 if updateFunc is frame.SetAlpha.
      5. ]]
      6. local AnimatingFrames = {};
      7. local AnimUpdateFrame = CreateFrame("Frame");
      8. local function Animation_UpdateFrame(self, animElapsed, animTable)
      9. local totalTime = animTable.totalTime
      10. if ( animElapsed and (animElapsed < totalTime)) then --Should be animating
      11. local elapsedFraction = self.animReverse and (1-animElapsed/totalTime) or (animElapsed/totalTime);
      12. animTable.updateFunc(self, animTable.getPosFunc(self, elapsedFraction));
      13. else --Just finished animating
      14. animTable.updateFunc(self, animTable.getPosFunc(self, self.animReverse and 0 or 1));
      15. self.animating = false;
      16. AnimatingFrames[self][animTable.updateFunc] = 0; --We use 0 instead of nil'ing out because we don't want to mess with 'next' (used in pairs)
      17. if ( self.animPostFunc ) then
      18. self.animPostFunc(self);
      19. end
      20. end
      21. end
      22. local totalElapsed = 0;
      23. local function Animation_OnUpdate(self, elapsed)
      24. totalElapsed = totalElapsed + elapsed;
      25. local isAnyFrameAnimating = false;
      26. for frame, frameTable in pairs(AnimatingFrames) do
      27. for frameTable, animTable in pairs(frameTable) do
      28. if ( animTable ~= 0 ) then
      29. Animation_UpdateFrame(frame, totalElapsed - frame.animStartTime, animTable);
      30. isAnyFrameAnimating = true;
      31. end
      32. end
      33. end
      34. if ( not isAnyFrameAnimating ) then
      35. table.wipe(AnimatingFrames);
      36. AnimUpdateFrame:SetScript("OnUpdate", nil);
      37. end
      38. end
      39. function SetUpAnimation(frame, animTable, postFunc, reverse)
      40. if ( type(animTable.updateFunc) == "string" ) then
      41. animTable.updateFunc = frame[animTable.updateFunc];
      42. end
      43. if ( not AnimatingFrames[frame] ) then
      44. AnimatingFrames[frame] = {};
      45. end
      46. AnimatingFrames[frame][animTable.updateFunc] = animTable;
      47. frame.animStartTime = totalElapsed;
      48. frame.animReverse = reverse;
      49. frame.animPostFunc = postFunc;
      50. frame.animating = true;
      51. animTable.updateFunc(frame, animTable.getPosFunc(frame, frame.animReverse and 1 or 0));
      52. AnimUpdateFrame:SetScript("OnUpdate", Animation_OnUpdate);
      53. end
      Display All
      Is there a way to convert this to ascemu?
    • Nupper wrote:

      Zyres wrote:

      github.com/tomrus88/BlizzardIn…meXML/AnimationSystem.lua

      It is interface related (clientside) and not serverside.
      So, no you should put it into your client interface.
      i was told it needs to be core side.
      hmmm... don't know why/how it should be handled core side. In fact it is part of a project for client interface modification for 5.4.7 clients. the lua function calling functions from a customized frame xml (clientside) so I wonder why it should be implemented serverside? The girl/guy whom told you that it needs to be core side, should be able to tell you "why" and "how". For me (after a short look) it is just clientside call to the clientinterface.