You can use the lerp function. For example, you could have a value named x that is 0, and you could interpolate it to 100 using this:
x = lerp(x, 100, 1)
The first value in the lerp function is the starting value, so I just set it to what x is starting at. The second value in the ending value, so I put it too 100. The last value I believe is the percent of the way you want it to lerp every frame, but I’m not 100 percent sure on that. I do know that increasing it will make your lerp happen faster. In your case, you could do:
extension = lerp(extension, endValue, percentPerFrame)
Obviously but the values you need in, but I think you get the point. I hope this helps!