0

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.
Ben
  • 15,938
  • 19
  • 92
  • 138

2 Answers2

1

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);
}
Lotan
  • 4,078
  • 1
  • 12
  • 30
1

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

Vivien Lynn
  • 345
  • 4
  • 14