How to create smooth transition between two values

I want to achieve a smooth transition between two values, but it seems very complicated to me.
Something like that in the image, help me, please.

from pos1 to pos2, for example move a camera(or object) so that it’s smooth?

    target =  own.scene.objects[own['target_hook']] 
    factor = 0.1 #0.01-1.0
    
    #pos1 - pos2
    pdif = own.worldPosition - target.worldPosition
    #calculated pdif * speed
    pos_dif = pdif * factor
    
    #if pos is not the new calculated position
    if own.worldPosition != target.worldPosition:
        
        #added every frame so it moves to the right position
        own.worldPosition -= pos_dif 

a cam demo setup:(upbge)
smooth camera movement.blend (526.5 KB)

I already know this method, but it is not what I need. this method creates a transition curve as in the image:

curve

I want to smooth the transition in and out (start slowly, accelerate and end slowly again), as in this other image:

curve 2

these are curve formulas, what i recommend is starting with a linear transition, and apply a multiplier based on the timer percent (fac = current/end). things like sine can be used to modify fac to push the current value up or down.


This function seems made fore it, but might be overkill for your purposes?

Tada! Here is a .blend gift, hope you can use it! Ø__^

Smoothstep_Func_01.blend (531.8 KB)

2 Likes

Perfect, thank’s!!!