mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-24 04:50:49 +00:00
Use ClassicAPI animation groups for fades and pulses
Replace hand-rolled OnUpdate alpha loops with engine animation groups: unit frame aggro/combat glow, tracking icon pulse, new-mail blink, castbar fade-out, autohide, XP/rep bar fade, info box timeout and the unlock-mode scale label. Timing no longer depends on framerate, and the always-running glow driver and tracking OnUpdate are gone. The XP bar tracks hover through OnEnter/OnLeave instead of MouseIsOver, so a fade can't restart under the cursor.
This commit is contained in:
+12
-9
@@ -36,7 +36,7 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb.bar:SetValue(1)
|
||||
end
|
||||
if cb.bar.spark then cb.bar.spark:Hide() end
|
||||
cb.fadeout = 1
|
||||
if cb:GetAlpha() > 0 and not cb.fade:IsPlaying() then cb.fade:Play() end
|
||||
end
|
||||
|
||||
-- "Spellname (N)" label for an active tradeskill merge — N is the number
|
||||
@@ -94,8 +94,8 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb.activeName = name
|
||||
cb.isTradeskill = isTradeskill
|
||||
cb.delay = (delayMs or 0) / 1000
|
||||
cb.fade:Stop()
|
||||
cb:SetAlpha(1)
|
||||
cb.fadeout = nil
|
||||
|
||||
-- Shield an uninterruptible cast. Not on the player's own bar: the flag is
|
||||
-- measured against the reader's own interrupts and silences, so on your own
|
||||
@@ -248,8 +248,14 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb.bar.spark:SetPoint("BOTTOM", cb.bar, "BOTTOMLEFT", 0, 0)
|
||||
cb.bar.spark:Hide()
|
||||
|
||||
-- OnUpdate animates the bar fill and fades it out on completion. All
|
||||
-- state transitions (cast start/stop/interrupt, channel start/stop,
|
||||
-- Fade-out after a cast ends. The bar stays at alpha 0 while idle.
|
||||
cb.fade = cb:CreateAnimationGroup()
|
||||
local fade = cb.fade:CreateAnimation("Alpha")
|
||||
fade:SetChange(-1)
|
||||
fade:SetDuration(.4)
|
||||
cb.fade:SetScript("OnFinished", function() cb:SetAlpha(0) end)
|
||||
|
||||
-- OnUpdate animates the bar fill. All state transitions (cast start/stop/interrupt, channel start/stop,
|
||||
-- pushback) come from the event handler below — we never poll C_Spell
|
||||
-- here.
|
||||
cb:SetScript("OnUpdate", function()
|
||||
@@ -257,15 +263,12 @@ pfUI:RegisterModule("castbar", function ()
|
||||
this.tick = GetTime() + 0.020 -- ~50 FPS
|
||||
|
||||
if this.drag and this.drag:IsShown() then
|
||||
this.fade:Stop()
|
||||
this:SetAlpha(1)
|
||||
return
|
||||
end
|
||||
|
||||
if this.fadeout and this:GetAlpha() > 0 then
|
||||
this:SetAlpha(this:GetAlpha() - 0.05)
|
||||
if this:GetAlpha() <= 0 then this.fadeout = nil end
|
||||
return
|
||||
end
|
||||
if this.fade:IsPlaying() then return end
|
||||
|
||||
if not this.endTime then
|
||||
if this:GetAlpha() ~= 0 then this:SetAlpha(0) end
|
||||
|
||||
Reference in New Issue
Block a user