1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 01:06:02 +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()
{
Tween t = target.DOMoveX(2, 4).Pause();
yield return new WaitForSeconds(1);
Sequence s = DOTween.Sequence()
.OnStart(() => Debug.Log("START"))
.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"));
Debug.Log(t.Duration());
Debug.Log(t.ElapsedPercentage());
}
}

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.747";
public static readonly string Version = "1.1.750";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.