Increment numbers quickly

Okay, so I’m finding this difficult to explain but you know when you finish a game and it for example shows you what score you got up to. Many games have it so it quickly increments from 0 all the way up to that number in the space of about a second. Does anyone know how I can implement this into my game through c++ code (I have a user widget text block), any help is much appreciated, thank you :slight_smile:

It’s a Lerp where the alpha is just the time you want.



float timeToReachTarget = 2.0f; // 2 seconds to reach the value.

currentWidgetTime  = FMath::Min(currentWidgetTime + deltaTime, timeToReachTarget); // Clamp us to our max time.
currentWidgetValue = FMath::Lerp(StartValue, EndValue, currentWidgetTime / timeToReachTarget);



Ah makes sense now, thank you