Increase as timer decreases

Hello

So I want to make the speed increase as the timer goes down, but I don’t know how to calculate it and code it.
The timer starts at 120
The speed starts at 0

When the timer reach 0
The speed needs to be 2

But the speed needs to increase as the timer goes down.

Example:
Timer=20
Speed=0

Timer=19
Speed=0.2

Timer=0
Speed=20

Thanks

The formula you can use for calculating the current speed based on current value in the timer is:

speed = ((max timer value - current timer value)/max timer value) * max speed value.

Here,

max time value = 12 and max speed value = 2

Now substitute in the equation at timer value 100:

speed = ((120-100)/120) * 2 = 0.33

So your speed at timer value 100 is 0.33

Just to note this is percentage based increase.