Lua Code:
local progress = {}
local function CreateSmoothProgress(control, value)
progress[control] = value;
end
local function SmoothProgress()
local increment = 0.2
for control, value in pairs(progress) do
local ctrlMin, ctrlMax = control:GetMinMax();
if ( value < control:GetValue() ) then
control:SetValue(control:GetValue() - increment);
else
control:SetValue(control:GetValue() + increment);
end
end
end
EVENT_MANAGER:RegisterForUpdate("SmoothProgress", 0, SmoothProgress)
As an alternative to using the animation system I wrote this. It's fairly smooth but if you change the incremental value (i.e. 0.2) to something closer to 1 then it jumps past the end of the statusbar (the leadingedge) and makes a shadow in front of it. Not sure how to combat that. Ideas?