View Single Post
Unread 02-05-10, 09:27 AM   #14
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,391
Check blackbox (http://wow.curseforge.com/addons/blackboxlua/)

You may want to look at the animation system.

Blizzard uses this kind of stuff for the Glyph window.

http://wowprogramming.com/utils/xmlb...rd_GlyphUI.lua

Look out for "PulseGlow".

The cool stuff is that you can "PLAY" and "STOP" those animations as you wish.

I cannot recommend onUpdate stuff anymore, the animations are much more valuable imo since they eat nearly no cpu usage instead of those nasty onupdates.

I'm using the animation system for rFrameRotater. Since you can "LOOP" animations it will start and never stop. (If you say so.)

Very simple rotate-function that I'm using to rotate stuff.
Code:
  function a:rotateme(texture,width,height,scale,anchorframe,framelevel,texr,texg,texb,alpha,duration,side,blendmode,point,pointx,pointy)

    local h = CreateFrame("Frame",nil,anchorframe)
    h:SetHeight(height)
    h:SetWidth(width)             
    h:SetPoint(point,pointx,pointy)
    h:SetScale(scale)
    h:SetFrameLevel(framelevel)
  
    local t = h:CreateTexture()
    t:SetAllPoints(h)
    t:SetTexture("Interface\\AddOns\\rFramerotater\\media\\"..texture)
    t:SetBlendMode(blendmode)
    t:SetVertexColor(texr,texg,texb,alpha)
    h.t = t
    
    local ag = h:CreateAnimationGroup()
    h.ag = ag
    
    local a1 = h.ag:CreateAnimation("Rotation")
    if side == 0 then
      a1:SetDegrees(360)
    else
      a1:SetDegrees(-360)
    end
    a1:SetDuration(duration)
    h.ag.a1 = a1
    
    h.ag:Play()
    h.ag:SetLooping("REPEAT")  

  end

So sth. like this could be it, don't know the exact syntax

http://wowprogramming.com/docs/widgets/Alpha/SetChange

Code:
    local h = CreateFrame("Frame",nil,UIParent)
    h:SetHeight(100)
    h:SetWidth(100)             
    h:SetPoint("CENTER",0,0)
    h:SetScale(1)
    h:SetFrameLevel(1)
  
    local t = h:CreateTexture()
    t:SetAllPoints(h)
    t:SetTexture(1,1,1,1)
    h.t = t

    local ag = h:CreateAnimationGroup()
    h.ag = ag
    
    local a1 = h.ag:CreateAnimation("Alpha")
    --go from 1 to 0
    a1:SetChange(-1)
    a1:SetDuration(5)

    local a2 = h.ag:CreateAnimation("Alpha")
    --go from 0 to 1
    a2:SetChange(1)
    a2:SetDuration(5)

    h.ag.a1 = a1
    h.ag.a2 = a2
    
    h.ag:Play()
    h.ag:SetLooping("REPEAT")
how can this lua code stuff be done?

With the animation system you can do this in just one animationgroup.

- move (translate)
- rotate
- scale
- change alpha

You can even add a path the frame will move on.
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 02-05-10 at 10:00 AM.
zork is offline   Reply With Quote