Option #1
Code:
local f,delay=CreateFrame("frame"),10
f.OnUpdate = function(self,elapsed)
self.lastupdate = (self.lastupdate or 0)+elapsed
if self.lastupdate >= delay then -- 10 seconds passed
self.lastupdate=0
-- do something
f:Hide() -- comment out if you want a repeating timer
end
end
f:SetScript("OnUpdate",f.OnUpdate)
Option #2
Code:
local f,delay=CreateFrame("frame"),10
f.OnFinished = function(self,requested)
-- 10 seconds passed, do stuff
-- f.ag:Play() -- uncomment if you want a repeating timer
end
f.ag = f:CreateAnimationGroup()
f.ag.timer = f.ag:CreateAnimation("Animation")
f.ag.timer:SetScript("OnFinished",f.OnFinished)
f.ag.timer:SetDuration(delay)
f.ag:SetLooping("NONE")
f.ag:Play()