Setting in and out easing separately

1.4k Views Asked by At

When using LeanTween for Unity to move a GameObject, is it possible to set the in and out parts of the easing separately?

What I would like to do is:

  1. Start off slow.
  2. Gradually increase speed from slow to fast.
  3. Stop abruptly with no ease at the end.
2

There are 2 best solutions below

0
Lotan On BEST ANSWER

Maybe you should make your own animation curve on LeanTween.

Just create a AnimationCurve to edit in the editor:

public AnimationCurve animCurve;
 
void Start(){
    LeanTween.scale(gameObject, Vector3.zero, 1f).setEase(animCurve);
}
0
Vivien Lynn On

What you describe sounds like Ease-in-sine, like so:

LeanTween.move(this.gameObject, new Vector2(0f, 5f), 2f).setEaseInSine();

This moves the gameobject the way you describe it: Slowly starting, accelerating and abruptly stopping.

When typing ".setEase", your IDE should suggest you ways to complete the code (See Screenshot). There you will find many different presets of easing-curves. Like only easing in, only easing out, or both combined. If you are not sure what easing to use, you can look at a collection of some of the most used easing-curves here: https://easings.net/en

Like @Lotan already suggested, creating your own animation curves would give you the ability to fully customize the easing behavior.

enter image description here