Progress Bar as a timer?

Hi!

You can simply add an timer with an interval of 1 second. In the Timer event you increase your timer count by one and set the progress of your progress bar to TimerCount/5 (5 is the duration of your timer). When you want the increase smoothly, simply add an lerp between the new value and the old value to the event tick event of your umg blueprint.

For example:

This should direct you in the right direction (sorry for the bad blueprint, but I had not enough time to test and polish it)

Best whishes

I’m trying to use a progress bar as a timer for 5 seconds. How do I implement the progress bar to smoothly increase over the 5 seconds?

Thanks for your time in advance.

Could you explain the variables and what you set them too? I want to display the timer moving up and after the 5 sec a player receives reward and the timer resets again.

“Duration” is the duration of your timer (in your example 5s, so set the value to 5.0). “New Count”, “Current Count” and “Time” are only helper variables for the smooth animation. If you don’t need the smoothing, you can easily delete all the stuff in the EventTick and the variables “Time” and “CurrentCount”. To fire the event after the timer finishes, you can add any blueprint nodes you need right after the “False” branch of the TimerTick-Event (right behind the “Clear and Invalidate Timer by Handle”-Node). I hope I could help you!

Another option is to use a “Timeline”. blueprint lerp timeline at DuckDuckGo

It has an Update execution pin that can be used to drive a lerp or other function from a curve.

I’d create a Timeline, that has a 5 second Float track with a straight line from 0 to 99

Then use that to update the progress percent of the progress bar directly.

Good luck with you game!

The only problem is, that you can’t use timelines in UMG blueprints because they don’t inherit from UObject. So you have to update the progress bar from an other blueprint (like GameMode or something like that)