View Single Post
07/03/15, 08:32 PM   #4
Capadillo
Join Date: Feb 2014
Posts: 12
Lua Code:
  1. local progress = {}
  2.  
  3. local function CreateSmoothProgress(control, value)
  4.     progress[control] = value;
  5. end
  6.  
  7. local function SmoothProgress()
  8.     local increment = 0.2
  9.     for control, value in pairs(progress) do
  10.         local ctrlMin, ctrlMax = control:GetMinMax();
  11.         if ( value < control:GetValue() ) then
  12.             control:SetValue(control:GetValue() - increment);
  13.         else
  14.             control:SetValue(control:GetValue() + increment);
  15.         end
  16.     end
  17. end
  18.  
  19. 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?
  Reply With Quote