Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-01-22, 02:02 PM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Fading animation

Hello there. I'm trying to copy the same animation as the buffs when are about to expire.
This is my attempt:

Lua Code:
  1. local f = CreateFrame('Button', 'MyButtonName', UIParent)
  2. f:SetPoint('CENTER')
  3. f:SetSize(128, 128)
  4.  
  5. local tex = f:CreateTexture(nil, "BACKGROUND")
  6. tex:SetAllPoints()
  7. tex:SetTexture(1, 1, 1, 0.5)
  8.  
  9. f.flasher = f:CreateAnimationGroup()
  10.  
  11. f.flasher:SetLooping("BOUNCE")
  12.  
  13. f.flasher:SetScript(
  14.     "OnFinished",
  15.     function(self, requested)
  16.         if requested then
  17.             self:Hide()
  18.         end
  19.     end
  20. )
  21.  
  22. local fadeIn = f.flasher:CreateAnimation("Alpha")
  23. fadeIn:SetDuration(0.5)
  24. fadeIn:SetChange(0.5)
  25. fadeIn:SetOrder(1)
  26.  
  27. local fadeOut = f.flasher:CreateAnimation("Alpha")
  28. fadeOut:SetDuration(0.5)
  29. fadeOut:SetChange(-0.5)
  30. fadeOut:SetOrder(2)
  31. fadeOut:SetEndDelay(1)
  32.  
  33. f.flasher:Play()

The animation from "fadeIn" to "fadeOut" works well, but the transition from "fadeOut" to "fadeIn" seems too sharp.

Any suggestions?

Last edited by Benalish : 03-01-22 at 03:40 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Fading animation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off