1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 01:36:05 +08:00

[BUGFIX] Fixed bug with ElapsedPercentage returning NaN if the tween was never played

This commit is contained in:
Demigiant 2018-06-25 17:12:26 +02:00
parent 0d0eea2ead
commit af8fd4db95
43 changed files with 6 additions and 8 deletions

View File

@ -15,14 +15,11 @@ public class TempTests : BrainBase
IEnumerator Start() IEnumerator Start()
{ {
Tween t = target.DOMoveX(2, 4).Pause();
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);
Sequence s = DOTween.Sequence() Debug.Log(t.Duration());
.OnStart(() => Debug.Log("START")) Debug.Log(t.ElapsedPercentage());
.Append(target.DOMoveX(2, 1).OnStart(() => Debug.Log("Append X")))
.SetDelay(1)
.Join(target.DOMoveY(2, 1).OnStart(() => Debug.Log("Join y")))
.SetDelay(2)
.OnComplete(()=> Debug.Log("COMPLETE"));
} }
} }

View File

@ -32,7 +32,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.1.747"; public static readonly string Version = "1.1.750";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -460,6 +460,7 @@ namespace DG.Tweening
} }
if (includeLoops) { if (includeLoops) {
if (t.fullDuration <= 0) return 0;
int loopsToCount = t.position >= t.duration ? t.completedLoops - 1 : t.completedLoops; int loopsToCount = t.position >= t.duration ? t.completedLoops - 1 : t.completedLoops;
return ((loopsToCount * t.duration) + t.position) / t.fullDuration; return ((loopsToCount * t.duration) + t.position) / t.fullDuration;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.