Hello there. I'm trying to copy the same animation as the buffs when are about to expire.
This is my attempt:
Lua Code:
local f = CreateFrame('Button', 'MyButtonName', UIParent)
f:SetPoint('CENTER')
f:SetSize(128, 128)
local tex = f:CreateTexture(nil, "BACKGROUND")
tex:SetAllPoints()
tex:SetTexture(1, 1, 1, 0.5)
f.flasher = f:CreateAnimationGroup()
f.flasher:SetLooping("BOUNCE")
f.flasher:SetScript(
"OnFinished",
function(self, requested)
if requested then
self:Hide()
end
end
)
local fadeIn = f.flasher:CreateAnimation("Alpha")
fadeIn:SetDuration(0.5)
fadeIn:SetChange(0.5)
fadeIn:SetOrder(1)
local fadeOut = f.flasher:CreateAnimation("Alpha")
fadeOut:SetDuration(0.5)
fadeOut:SetChange(-0.5)
fadeOut:SetOrder(2)
fadeOut:SetEndDelay(1)
f.flasher:Play()
The animation from "fadeIn" to "fadeOut" works well, but the transition from "fadeOut" to "fadeIn" seems too sharp.
Any suggestions?