Advertisement
Guest User

Snowfallkeypress Shine

a guest
May 16th, 2014
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. local animationsCount, animations = 5, {}
  2. local animationNum = 1
  3. local replace = string.gsub
  4. local frame, texture, animationGroup, alpha1, scale1, scale2, rotation2
  5.  
  6. for i = 1, animationsCount do
  7. frame = CreateFrame("Frame")
  8.  
  9. texture = frame:CreateTexture()
  10. texture:SetTexture([[Interface\Cooldown\star4]])
  11. texture:SetAlpha(0)
  12. texture:SetAllPoints()
  13. texture:SetBlendMode("ADD")
  14.  
  15. animationGroup = texture:CreateAnimationGroup()
  16.  
  17. alpha1 = animationGroup:CreateAnimation("Alpha")
  18. alpha1:SetChange(1)
  19. alpha1:SetDuration(0)
  20. alpha1:SetOrder(1)
  21.  
  22. scale1 = animationGroup:CreateAnimation("Scale")
  23. scale1:SetScale(1.5, 1.5)
  24. scale1:SetDuration(0)
  25. scale1:SetOrder(1)
  26.  
  27. scale2 = animationGroup:CreateAnimation("Scale")
  28. scale2:SetScale(0, 0)
  29. scale2:SetDuration(0.3)
  30. scale2:SetOrder(2)
  31.  
  32. rotation2 = animationGroup:CreateAnimation("Rotation")
  33. rotation2:SetDegrees(90)
  34. rotation2:SetDuration(0.3)
  35. rotation2:SetOrder(2)
  36.  
  37. animations[i] = {frame = frame, animationGroup = animationGroup}
  38. end
  39.  
  40. local animate = function(button)
  41. if not button:IsVisible() then return true end
  42. local animation = animations[animationNum]
  43. local frame = animation.frame
  44. local animationGroup = animation.animationGroup
  45. frame:SetFrameStrata(button:GetFrameStrata())
  46. frame:SetFrameLevel(button:GetFrameLevel() + 10)
  47. frame:SetAllPoints(button)
  48. animationGroup:Stop()
  49. animationGroup:Play()
  50. animationNum = (animationNum % animationsCount) + 1
  51. return true
  52. end
  53.  
  54. hooksecurefunc('ActionButton_UpdateHotkeys', function(button, buttonType)
  55. if InCombatLockdown() then return end
  56. if not button.hooked then
  57. local id, actionButtonType, key
  58. if not actionButtonType then
  59. actionButtonType = button:GetAttribute('binding') or string.upper(button:GetName())
  60. actionButtonType = replace(actionButtonType, 'BOTTOMLEFT', '1')
  61. actionButtonType = replace(actionButtonType, 'BOTTOMRIGHT', '2')
  62. actionButtonType = replace(actionButtonType, 'RIGHT', '3')
  63. actionButtonType = replace(actionButtonType, 'LEFT', '4')
  64. actionButtonType = replace(actionButtonType, 'MULTIBAR', 'MULTIACTIONBAR')
  65. end
  66.  
  67. local key = GetBindingKey(actionButtonType)
  68. if key then
  69. button:RegisterForClicks("AnyDown")
  70. SetOverrideBinding(button, true, key, 'CLICK '..button:GetName()..':LeftButton')
  71. end
  72. button.AnimateThis = animate
  73. SecureHandlerWrapScript(button, "OnClick", button, [[ control:CallMethod("AnimateThis", self) ]])
  74. button.hooked = true
  75. end
  76. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement