View Single Post
01-21-14, 05:29 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Duugu View Post
Thank you. But ... hm ... it's about rotating textures. I'm a bit lost. :/ Could you please be more specific? Which part of it?
Lua Code:
  1. local rotateme = function(texture,width,height,scale,anchorframe,framelevel,texr,texg,texb,alpha,duration,side,blendmode,point,pointx,pointy)
  2.  
  3.     local h = CreateFrame("Frame",nil,anchorframe)
  4.     h:SetHeight(height)
  5.     h:SetWidth(width)            
  6.     h:SetPoint(point,pointx,pointy)
  7.     h:SetScale(scale)
  8.     h:SetFrameLevel(framelevel)
  9.  
  10.     local t = h:CreateTexture()
  11.     t:SetAllPoints(h)
  12.     t:SetTexture("Interface\\AddOns\\yourTextures\\"..texture)
  13.     t:SetBlendMode(blendmode)
  14.     t:SetVertexColor(texr,texg,texb,alpha)
  15.     h.t = t
  16.    
  17.     local ag = h:CreateAnimationGroup()
  18.     h.ag = ag
  19.    
  20.     local a1 = h.ag:CreateAnimation("Rotation")
  21.     a1:SetDegrees(6)
  22.     a1:SetDuration(1)
  23.     h.ag.a1 = a1
  24.    
  25.     h.ag:SetLooping("REPEAT")  --repeat this OVER AND OVER?!
  26.  
  27.     return h
  28.  
  29.   end
  30.  
  31.   local f = rotateme(...)
  32.   f.ag:Play()
  33.  
  34.   --adjust values
  35.   --f.ag.a1:SetDegrees(20)
  36.   --f.a1:SetDuration(10)
  37.   --f.ag:SetLooping("REPEAT")

If i get this right this means you can rotate frames instead of textures with animationgroups, means you don't have to rotate your textures one by one, just rotate the frame and tada. I havn't tested this tho.
  Reply With Quote