Lerp in UMG (instead of animations)

Hey, I’ve been using animations for my buttons, however I’ve noticed that I can’t use variables for values like I can in Blueprints, and therefore can’t have animations which change colour based on the values a user sets in another widget (like I can with global variables attached to component nodes). I’ve been using multiple images to get around this by just setting their render opacity in the animations, however this is clearly not the best approach. I then started wondering if I could use animations instead of timelines, where the value of something in an animation could be brought into the Blueprints and used to set a value in another node, but I could not find a way of doing this.

I’m mainly wondering how I would be able to lerp values in UMG Blueprints. Normally this would be done with a timeline, but there aren’t timelines in UMG, so I’m stuck. I’m asking this mainly because I want to animate the letter spacing of text in a button, but can’t do so in an animation, and it seems I can only do so with some kind of lerp thing in the Blueprints.

I have seen posts where people lerp values using Delta Time from the Tick node, but I’ve never been able to get this to work.

Any help will be greatly appreciated.

If the anim length is not equal to 1s, you can translate the range required. Besides that, you can have an actor play the Timeline instead and feed the widget the alpha curve.

Widget animations can actually produce events while the animation is playing, similar to the TL’s Event Track. Double click the key:

…to get a sequencer widget event at the specified time:


Perhaps all you need is a Repeater, the other event above. It spits out an update every frame.

Thanks for the reply, however when trying both of these, it just snaps to the end and start of the animation instead of animating. In terms of the lerp, my animation length is 0.25, and these are the Blueprints. It snaps to the colours instead of lerping (as if I’m just setting them and not lerping).

It doesn’t seem to lerp properly, where it stays at A, or goes a bit to B.

As for the Trigger in the animation, that does the same thing. I must be doing something wrong. I also tried using the Repeater but can’t for the life of me figure out how it works.

Except this doesn’t seem to get back to the start when Unhovering.

Here’s the Animation also:

Am I missing something obvious here?

To make it work with Tick, you’d need to get closer to this pseudoscript:

The working script for the Repeater could look like this:

Which produces this behaviour…

…which you can feed any values now.

Double click to create an event with the correct signature, you can then cut / paste it to another graph if that’s more convenient.

If the animation duration is not 1s, you need to translate it into the 0-1 range Lerp can use as alpha.

1 Like

Works great, thank you so much!

1 Like