mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-21 23:26:57 +00:00
zBar: cap stagger window + shorter slide so a full bar assembles quickly
This commit is contained in:
@@ -292,18 +292,35 @@ function MTH_ZBar_AnimateActivate()
|
||||
end
|
||||
local s = MTH_ZBar_GetSaved()
|
||||
local order = s.order or {}
|
||||
-- Collect only the buttons that will actually animate so the stagger is based
|
||||
-- on the visible count, not gaps in the saved order.
|
||||
local shownButtons = {}
|
||||
for i = 1, table.getn(order) do
|
||||
local buttonName = order[i]
|
||||
if type(buttonName) == "string" then
|
||||
local btn = getglobal(buttonName)
|
||||
if btn and btn:IsShown() then
|
||||
btn:SetAlpha(0)
|
||||
-- Staggered springy slide-up so the bar visibly assembles button
|
||||
-- by button instead of a faint collective fade.
|
||||
ZBar_Sauce:SlideIn(btn, "UP", 26, 0.32, "outBack", { delay = (i - 1) * 0.06 })
|
||||
table.insert(shownButtons, btn)
|
||||
end
|
||||
end
|
||||
end
|
||||
local count = table.getn(shownButtons)
|
||||
-- Cap the total stagger window so a full bar assembles just as quickly as a
|
||||
-- short one: the per-button delay shrinks as the button count grows.
|
||||
local step = 0.05
|
||||
if count > 1 then
|
||||
local maxWindow = 0.28
|
||||
if step * (count - 1) > maxWindow then
|
||||
step = maxWindow / (count - 1)
|
||||
end
|
||||
end
|
||||
for i = 1, count do
|
||||
local btn = shownButtons[i]
|
||||
btn:SetAlpha(0)
|
||||
-- Staggered springy slide-up so the bar visibly assembles button by
|
||||
-- button instead of a faint collective fade.
|
||||
ZBar_Sauce:SlideIn(btn, "UP", 26, 0.26, "outBack", { delay = (i - 1) * step })
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the user toggles the Enable checkbox in the options.
|
||||
|
||||
Reference in New Issue
Block a user