wobin@1: local AddonName, AfterDark = ... wobin@1: wobin@1: local TOAST = "Interface\\AddOns\\AfterDark\\Images\\Toast" wobin@1: local JAM = "Interface\\AddOns\\AfterDark\\Images\\ToastTopping" wobin@1: wobin@1: function AfterDark:SliceBread(frame) wobin@1: frame.toast = frame:CreateTexture(nil, "BACKGROUND") wobin@1: frame.toast:SetAllPoints(frame) wobin@1: frame.toast:SetTexture(TOAST) wobin@1: wobin@1: frame.shade = frame:CreateTexture(nil, "BACKGROUND") wobin@1: frame.shade:SetAllPoints(frame) wobin@1: frame.shade:SetTexture(JAM) wobin@1: frame.shade:SetBlendMode("ADD") wobin@1: frame.shade:SetAlpha(1 - AfterDark.db.profile.Darkness) wobin@1: frame.tumbler = frame:CreateAnimationGroup() wobin@1: frame.tumbler.parent = frame wobin@1: frame.tumbler:SetLooping("NONE") wobin@1: wobin@1: frame.spin = frame.tumbler:CreateAnimation("Rotation") wobin@1: frame.spin:SetDegrees(math.random(1,2) == 1 and 360 or -360) wobin@1: frame.spin:SetOrigin("CENTER", 0,0) wobin@1: frame.spin:SetStartDelay(math.random(3, AfterDark.db.profile.Speed)) wobin@1: frame.spin:SetDuration(3) wobin@1: wobin@1: frame.IsToast = true wobin@1: wobin@1: frame.Respeed = function(self) wobin@1: frame.spin:SetStartDelay(math.random(3,AfterDark.db.profile.Speed)) wobin@1: end wobin@1: wobin@1: frame.Start = function(self) wobin@1: self.mover:Play() wobin@1: self.tumbler:Play() wobin@1: self:Show() wobin@1: end wobin@1: wobin@1: frame.Finish = function(self) wobin@1: self:StopAnimating() wobin@1: self:Hide() wobin@1: end wobin@1: end