Thread: Animation Help
View Single Post
04-09-12, 09:57 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I know the animation system, I don't know if there are any guides for it but I could provide you with an example. I honestly couldn't tell you how I picked it up myself.

I believe the animations you're talking about are contained in ActionBarFrame.xml, specifically under "ActionBarButtonSpellActivationAlert".

The "ants" used for the proc animation is actually just a texture that's displayed one section at a time sort of like a flip-book.

First you should look at AnimationGroups (specifically CreateAnimation) and the Animation widget.

I'll try and provide a basic example here..
Lua Code:
  1. local f = CreateFrame("Frame", nil, UIParent)
  2. f:SetWidth(32)
  3. f:SetHeight(32)
  4. f:SetPoint("CENTER")
  5.  
  6. local tx = f:CreateTexture(nil, "BACKGROUND")
  7. tx:SetAllPoints()
  8. tx:SetTexture("interface/icons/inv_mushroom_11")
  9.  
  10. f.anigroup = f:CreateAnimationGroup() -- Create our animation group
  11.  
  12. f.spin = f.anigroup:CreateAnimation("Rotation") -- Rotation animation
  13. f.spin:SetOrder(1) -- Play it first, only matters with multiple animations
  14. f.spin:SetDuration(0.8) -- Spin for 0.8 seconds
  15. f.spin:SetDegrees(720) -- Total amount of rotation in degrees
  16.  
  17. f.scale = f.anigroup:CreateAnimation("Scale") -- Scale animation
  18. f.scale:SetOrder(1) -- Play it at the same time
  19. f.scale:SetDuration(1) -- Take 1 second
  20. f.scale:SetScale(5,5) -- Scale width and height to 500%
  21.  
  22. f.fade = f.anigroup:CreateAnimation("Alpha") -- Alpha animation
  23. f.fade:SetOrder(2) -- Play after the first group
  24. f.fade:SetDuration(0.5) -- Take 0.5 seconds
  25. f.fade:SetChange(-1) -- Reduce alpha by a factor of 1 (like f:SetAlpha(f:GetAlpha-1))
  26. f.fade:SetEndDelay(0.5) -- Wait 0.5 seconds after finishing before continuing
  27.  
  28. f.anigroup:SetLooping("BOUNCE") -- Repeat forward and backwards
  29. f.anigroup:Play() -- Start our animation group

Last edited by semlar : 04-09-12 at 10:04 PM.
  Reply With Quote