Blending two values over time without a timeline

Usualy I use timelines to blend two values over time. But in this case I need to do this in a widget wich doesn´t support timelines. I tried a while loop wich basically works but fires way to fast. I tried to add a delay after the loop body but this brings me an infinity loop error. What I need is some sort of loop that start on a single pressed event and counts a float from 0 to 1 in an adjustable amount of time. Is this somehow possible without timlines ?

You could try using Timers

Yeah, that would probably work. But the best method I have found is to use a helper actor to pass the timeline info to the widget.

For example, a smoothly transitioning health bar. On every change to the players health, I call a function on the player that runs a timeline lerping between the players current health and previous health, normalizing that value between zero and max health, assigning the result to another variable I call display health. I then cast to my widget and get the progress bar I’m updating and set the value to the display health variable.

The A and B of the Lerp are where you need to put your values. The /3 is the duration in seconds.

Thank You for your suggestions. I went with the Timer. What I wanted to do was to make some sort of custom button color change once it is pressed. I´m working with a Touchscreen and the default action didn´t work that well. The button needed to be pressed for maybe half a second for the “pressed” color change to happen. Now that usually tipping on a screen is way faster it wouldn´t fire in many occasions. As a nice effect I now have a button(image) color change over time effect. The buttons changes color when pressed and fades back in certain amount of time.

This is why I couldn´t use an helper actor. Or it would probabely be to complicated in this case. Also I wanted to avoid using something that runs on ticks all the time. What Benni.Lodge suggested works. I tried it but I prefered timers after all. It was a bit tricky until I figured out that I need a custom event for the timer to work. In case anyone wants to use this kind of fading buttons. Attached is a screenshot that shows my widget.

Cool, I like it! Thanks for sharing your solution. This gives me some ideas for a couple of things I’d like to try.

I have a simple macro node here.
it may help!

](Misc - Elhoussine Mehnik)