# Opposite tween to lerp

0 favourites
• 5 posts
From the Asset Store
Calculate parabolic trajectories and tween objects over them.
• Hi there,

I use lerp A LOT when I'm making stuff. Mostly in this form:

Every tick - set box.X to lerp(box.X, 50, 0.1) etc.

The only issue is, this eases into the final position. I'd like something eases out of the first position and hit's the final position a bit harder.

Is this possible in a similar way to Lerp? I know Cosp eases out of first and into second, but this isn't what I need (though super handy for other things).

Thanks!

• There have been other topics on this and there isn't such a function, but you can do it with a speed variable.

Global number speed=0

Every tick

Box X <50

--- box: set X to min(50, box.x+speed)

Box X > 50

--- box: set X to max(50, box.x-speed)

• Fantastic, thanks for that, I'll give that a go.

How exactly does the the min/max thing work?

The manual's a little vague on it. What exactly are those actions doing?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• They're kind of like clamp. Min will only keep the lowest value, and max will keep the highest. I used it here to stop the value from passing 50 from either direction.

Min(a,b)

If a<b then it will be a

If a>b then it will be b

Max(a,b)

If a<b then it will be b

If a>b then it will be a

• Ah cool, makes sense,