jobel

You can't do it with just one formula, you need a variable that you change over time to do it.

One you could use is speed. It starts as 0 and it increases over time so you get an easing in effect.

Add 100*dt to speed

rotate self.speed*dt degrees toward target_angle

In the actions above the 100 is the acceleration.

You can also make an easing out effect with it by giving speed an initial speed and using negative acceleration to slow it down.

Set speed to max(self.speed-100*dt, 0)

rotate self.speed*dt degrees toward target_angle

The max() is used above so the speed never becomes negative. The one problem is you need to handle is if the start speed is too low the sprite will stop short. To fix that we can calculate what the speed should start at with:

speed= sqrt(anglediff(self.angle, target_angle)*2*100)

Or instead of 100 use whatever you're using as an acceleration.

Next to do an easing in-out effect (which is basically what the first capx I posted) you can accelerate or deccelerate depending on the stopping distance which can be calculated with:

dist = (speed^2)/(2*acceleration)

So then it can be reduced to two actions as follows:

global number acceleration=100

global number target_angle =270

every tick:

--- set speed to max(0,(((self.speed^2)/(2*acceleration)<anglediff(self.angle, target_angle))?acceleration:-)acceleration)

--- rotate self.speed*dt degrees toward target_angle

You may also want to reset the speed to 0 when the target is reached.

Here's a capx:

https://dl.dropboxusercontent.com/u/542 ... n_out.capx

It differs from the first capx in that it doesn't try to be physically accurate.