Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.35k stars 350 forks source link

Creating a tween and playing backwards not working? #440

Closed brunomikoski closed 4 years ago

brunomikoski commented 4 years ago

I'm trying to create a tween, complete it and play it backwards right away, but it isn't working, any idea of why?

Tween tween = targetWindow.transform.DOScale(toScale, duration).SetEase(ease).SetAutoKill(false);
tween.Complete();
tween.PlayBackwards();
yield return tween.WaitForCompletion();

DOTween version: 1.2.335

brunomikoski commented 4 years ago

Okay, actually this was working properly what doesn't work properly is the tween.WaitForCompletion() so I had to do it like this:

Tween tween = targetWindow.transform.DOScale(toScale, duration).Pause().SetEase(ease).SetAutoKill(false);
tween.Complete();
tween.PlayBackwards();
yield return new WaitForSeconds(duration);
Demigiant commented 4 years ago

Hi, if you play the tween backwards the tween won't complete, but rewind. You should:

yield return tween.WaitForRewind();

:)

brunomikoski commented 4 years ago

Hi, if you play the tween backwards the tween won't complete, but rewind. You should:

yield return tween.WaitForRewind();

:)

hahah that explains a lot! <3 Thanks a lot @Demigiant