1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 01:06:02 +08:00

[BUGFIX] Fixed bug where calling PlayForward immediately after a PlayBackwards in the same frame gave unexpected results if the tween was already complete

This commit is contained in:
Demigiant 2019-06-11 10:58:19 +02:00
parent 017c577f06
commit 576460f6e9
16 changed files with 15 additions and 11 deletions

View File

@ -11,20 +11,16 @@ using UnityEngine.UI;
public class TempTests : BrainBase public class TempTests : BrainBase
{ {
public bool useFrom = true;
public Transform target; public Transform target;
IEnumerator Start() IEnumerator Start()
{ {
if (!useFrom) { Sequence s = DOTween.Sequence().SetAutoKill(false)
target.DOMoveX(2, 2); .Join(target.DOMoveX(2, 1))
} else { .Append(target.DOMoveY(2, 1));
Vector3 currentPosition = target.position; yield return s.WaitForCompletion(true);
target.DOMoveX(2, 2).From().SetAutoKill(false);//.OnRewind(() => OnResetTransformFrom(transformToAnimate,currentPosition));
}
yield return new WaitForSeconds(3f); s.PlayBackwards();
s.PlayForward();
target.DORewind();
} }
} }

View File

@ -738,6 +738,9 @@ namespace DG.Tweening.Core
if (t.completedLoops == 0 && t.position <= 0) { if (t.completedLoops == 0 && t.position <= 0) {
// Already rewinded, manage OnRewind callback // Already rewinded, manage OnRewind callback
ManageOnRewindCallbackWhenAlreadyRewinded(t, true); ManageOnRewindCallbackWhenAlreadyRewinded(t, true);
t.isBackwards = true;
t.isPlaying = false;
return false;
} }
if (!t.isBackwards) { if (!t.isBackwards) {
t.isBackwards = true; t.isBackwards = true;
@ -749,6 +752,11 @@ namespace DG.Tweening.Core
internal static bool PlayForward(Tween t) internal static bool PlayForward(Tween t)
{ {
if (t.isComplete) {
t.isBackwards = false;
t.isPlaying = false;
return false;
}
if (t.isBackwards) { if (t.isBackwards) {
t.isBackwards = false; t.isBackwards = false;
Play(t); Play(t);

View File

@ -34,7 +34,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.250"; // Last version before modules: 1.1.755 public static readonly string Version = "1.2.251"; // Last version before modules: 1.1.755
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

Binary file not shown.