I thought I can use timeline to do this,but it cant.
can someone tell me how to animate the orange progressbar percent ?
(the orange bar will increase or decrease when select different item)
Unfortunately there is no “easy” way to do this as UMG animations require fixed values in their animations. What you can do is the following:
Have a CurrentValue float, a TargetValue float and a AdjustSpeed float.
Whenever you modify the value, modify the TargetValue
In your widget’s Tick event, first check if the CurrentValue and TargetValue are different (use NearlyEqual when comparing floats)
If they are, interpolate the CurrentValue toward the TargetValue (Use InterpTo or InterpToConst). Use the AdjustSpeed as the Speed input.
Set the new value to your progress bar’s value
You can optimize this a bit by enabling the tick on your widget when the value changes and disabling it when it reaches the target. This approach has the advantage that even if the value changes mid-transition it will still work correctly.