Magnificent, isn't?
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.opacity = -0.5
f.flasher:SetLooping("BOUNCE")
f.flasher:SetScript(
"OnFinished",
function(self, requested)
if requested then
self:Hide()
end
end
)
f.flasher:SetScript(
"OnLoop",
function()
f.flasher.opacity = (f.flasher.opacity == -0.5) and 0.5 or -0.5
end
)
local fade = f.flasher:CreateAnimation("Alpha")
fade:SetDuration(0.5)
fade:SetChange(f.flasher.opacity)
fade:SetOrder(1)
f.flasher:Play()