How to Blend float?

Hi guys I’m not sure if this is possible or not, if it is how would i go about doing it?

Float is currently set to 100 and when I Set the float to 200 i want to it count up so 101,102,103 you get the point, until it gets to 200, and if my current float is set to 400, i want it to count down instead.

is there any easy way of doing this?
p.s. also I’m using blueprint only.

There are mutlitple ways:

  1. Use a Timeline
  2. Use curves
  3. Use Lerp

However the choice depends on exactly what you want to achieve and how much flexibility you need.

Here is a rough technique:

  • Create a float variable in your blueprint, named ‘TargetValue’.
  • Within your Tick() function, update Currentvalue. Whether you increment or decrement depends on your present ‘CurrentValue’ and ‘TargetValue’. The count-up speed can be controlled by multiplying the count rate with delta seconds. If the CurrentValue == TargetValue, you dont need to update anything.
  • When you need to set a new value for your variable, set it to TargetValue instead, and let the Tick() function take care of the actual updation.

Don’t check directly CurrentValue == TargetValue because of float precision error!