annotate Toast.lua @ 5:fe8a1ba781bd v0.1-Beta

Added tag v1.0-Release for changeset e52cea93e1c6
author wobin
date Sun, 20 Dec 2009 21:59:15 +1100
parents f601b8507480
children
rev   line source
wobin@1 1 local AddonName, AfterDark = ...
wobin@1 2
wobin@1 3 local TOAST = "Interface\\AddOns\\AfterDark\\Images\\Toast"
wobin@1 4 local JAM = "Interface\\AddOns\\AfterDark\\Images\\ToastTopping"
wobin@1 5
wobin@1 6 function AfterDark:SliceBread(frame)
wobin@1 7 frame.toast = frame:CreateTexture(nil, "BACKGROUND")
wobin@1 8 frame.toast:SetAllPoints(frame)
wobin@1 9 frame.toast:SetTexture(TOAST)
wobin@1 10
wobin@1 11 frame.shade = frame:CreateTexture(nil, "BACKGROUND")
wobin@1 12 frame.shade:SetAllPoints(frame)
wobin@1 13 frame.shade:SetTexture(JAM)
wobin@1 14 frame.shade:SetBlendMode("ADD")
wobin@1 15 frame.shade:SetAlpha(1 - AfterDark.db.profile.Darkness)
wobin@1 16 frame.tumbler = frame:CreateAnimationGroup()
wobin@1 17 frame.tumbler.parent = frame
wobin@1 18 frame.tumbler:SetLooping("NONE")
wobin@1 19
wobin@1 20 frame.spin = frame.tumbler:CreateAnimation("Rotation")
wobin@1 21 frame.spin:SetDegrees(math.random(1,2) == 1 and 360 or -360)
wobin@1 22 frame.spin:SetOrigin("CENTER", 0,0)
wobin@1 23 frame.spin:SetStartDelay(math.random(3, AfterDark.db.profile.Speed))
wobin@1 24 frame.spin:SetDuration(3)
wobin@1 25
wobin@1 26 frame.IsToast = true
wobin@1 27
wobin@1 28 frame.Respeed = function(self)
wobin@1 29 frame.spin:SetStartDelay(math.random(3,AfterDark.db.profile.Speed))
wobin@1 30 end
wobin@1 31
wobin@1 32 frame.Start = function(self)
wobin@1 33 self.mover:Play()
wobin@1 34 self.tumbler:Play()
wobin@1 35 self:Show()
wobin@1 36 end
wobin@1 37
wobin@1 38 frame.Finish = function(self)
wobin@1 39 self:StopAnimating()
wobin@1 40 self:Hide()
wobin@1 41 end
wobin@1 42 end