diff --git a/build/PackageDiffIgnore.xml b/build/PackageDiffIgnore.xml index 9cdbaee2e1c1..550d433eb896 100644 --- a/build/PackageDiffIgnore.xml +++ b/build/PackageDiffIgnore.xml @@ -3929,7 +3929,10 @@ - + + _owner?.GetTraceProperties(); private void ClearValue() => _owner?.ClearValue(); private void SetValue(object value) => _owner?.SetValue(value); - private bool NeedsRepeat(DateTimeOffset lastBeginTime, int replayCount) => _owner?.NeedsRepeat(lastBeginTime, replayCount) ?? false; + private bool NeedsRepeat(Stopwatch activeDuration, int replayCount) => _owner?.NeedsRepeat(activeDuration, replayCount) ?? false; private object GetValue() => _owner?.GetValue(); public void Begin() @@ -89,7 +90,7 @@ public void Begin() _subscriptions.Clear(); //Dispose all and start a new - _lastBeginTime = DateTimeOffset.Now; + _activeDuration.Restart(); _replayCount = 1; //Start the animation @@ -330,7 +331,7 @@ private void SetAnimatorDuration() private void OnEnd() { // If the animation was GPU based, remove the animated value - if (NeedsRepeat(_lastBeginTime, _replayCount)) + if (NeedsRepeat(_activeDuration, _replayCount)) { Replay(); // replay the animation return; diff --git a/src/Uno.UI/UI/Xaml/Media/Animation/Timeline.cs b/src/Uno.UI/UI/Xaml/Media/Animation/Timeline.cs index 0c22969990d4..2362b9f495e6 100644 --- a/src/Uno.UI/UI/Xaml/Media/Animation/Timeline.cs +++ b/src/Uno.UI/UI/Xaml/Media/Animation/Timeline.cs @@ -7,6 +7,7 @@ using System.Linq; using Windows.UI.Core; using Windows.UI.Xaml.Data; +using System.Diagnostics; namespace Windows.UI.Xaml.Media.Animation { @@ -322,9 +323,9 @@ void ITimeline.Deactivate() /// Checks if the Timeline will repeat. /// /// true, Repeat needed, false otherwise. - protected bool NeedsRepeat(DateTimeOffset lastBeginTime, int replayCount) + private protected bool NeedsRepeat(Stopwatch duration, int replayCount) { - var totalTime = DateTimeOffset.Now - lastBeginTime; + var totalTime = duration.Elapsed; //3 types of repeat behavors, return ((RepeatBehavior.Type == RepeatBehaviorType.Forever) // Forever: Will always repeat the Timeline