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 bool useFrom = true;
public Transform target;
IEnumerator Start()
{
if (!useFrom) {
target.DOMoveX(2, 2);
} else {
Vector3 currentPosition = target.position;
target.DOMoveX(2, 2).From().SetAutoKill(false);//.OnRewind(() => OnResetTransformFrom(transformToAnimate,currentPosition));
}
Sequence s = DOTween.Sequence().SetAutoKill(false)
.Join(target.DOMoveX(2, 1))
.Append(target.DOMoveY(2, 1));
yield return s.WaitForCompletion(true);
yield return new WaitForSeconds(3f);
target.DORewind();
s.PlayBackwards();
s.PlayForward();
}
}

View File

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

View File

@ -34,7 +34,7 @@ namespace DG.Tweening
public class DOTween
{
/// <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 ////////////////////////////////////

Binary file not shown.