Cosine interpolation cosp(a, b, x) maybe

Theres also:

qarp(a, b, c, x)

cubic(a, b, c, d, x)

They are aggressively more complicated however.

Rex has several behaviors that are simpler to implement, moveto, spline, etc.

I've tried both qarp and cubic, but not getting the desired effect.

When mouse left is down, i want the object to accelerate smoothly from 0 to a certain speed based on the distance to the mouse, then when mouse is up I want it to decelerate to zero speed.

using lerp(self.x,mouse.x,0.1) has the desired effect for slowing the object down as it is getting closer to Mouse.X. But the start of the movement is sudden (max speed from start), getting slower and slower as it approach Mouse.X. I don't know how I can smooth out the start of the movement.

I'm basically looking for a curve like this. I know how to do it based on time (but that's not what I'm after), but I don't know how to do it based on distance.

The max speed of the object should be somewhere in the middle.

When i click. I want object to accellerate to a "Max speed" determined by the object current distance to mouse. Max speed should automatically get slower as the object approaches destination (Mouse)

I'm just guessing here.

lerp(a, b, x*m)

X has to be the max speed. (m) The modifier has to be a value, that is pretty close to zero, when the object starts to move and closer to 1 when it's approaching max speed.

a = current position, (not starting position as the mouse can move around)

b = target position, (the current position of the mouse)

x = maximum speed. (the maximum speed)

m = modifier (a value that smoothly scales from 0-1 based on distance where further is closer to 0 and closer is closer to 1)

maybe I'm doing it all wrong, and some math genius here can help me out?

lerp(self.X,mouse.X,0.1) has the desired effect except that the start of movement is snappy not accelerating.

I want the object to smoothly catch up to the mouse current position.