Advertisement
Demigiant

DOTween Custom Ease Function

Oct 28th, 2021
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. // Must return a value between 0 and 1
  2. // time: the current elapsed time since the tween started
  3. // duration: the total duration of the tween
  4. // overshootOrAmplitude: ignore this
  5. // period: ignore this
  6. public float CustomLinearEase(float time, float duration, float overshootOrAmplitude, float period)
  7. {
  8.     return time / duration;
  9. }
  10.  
  11. void CreateTweenWithCustomEase(Transform t)
  12. {
  13.     // This will create a tween with a linear ease
  14.     t.DOMoveX(1, 2).SetEase(CustomLinearEase);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement