Lerp

Any way I could get linear interpolation in the application? It’s very usefull.

What do you call linear interpolation and why it is useful ( In which context would you use it? ) :slight_smile:

Making a smooth motion of an object to a position:

lerp(b.X,a.X+sin(b.timer+(b.indexOf/b.Count)*360)*100,1-0.07^dt)
lerp(b.y,a.y+cos(b.timer+(b.indexOf/b.Count)*360)*100,1-0.07^dt)
That’s an example of balls rotating in a circle, having spawned at some position and slowly making their way to the designated position.

So in fact :

lerp(a,b,x) = a*(1-x)+b*x

I believe this idea came from Construct, that’s the only software where I could find such a function :slight_smile:

Interesting, what are the balls in this formula? And the target position? a or b ?

This was in mmf too, but it went by the name smooth or something. Also it’s in some programming languages as well.
processingjs.org/reference/lerp_/

b is the balls, a is the target they are set to rotate around.