Jelajahi Sumber

Remove the 2nd Observable.Tick and merge the transitions and animations timer.

Jumar Macato 7 tahun lalu
induk
melakukan
5d1b33f41a

+ 0 - 2
src/Avalonia.Animation/Keyframes/KeyFrames.cs

@@ -47,8 +47,6 @@ namespace Avalonia.Animation.Keyframes
                 });
         }
 
-
-
         /// <summary>
         /// Get the nearest pair of cue-time ordered keyframes 
         /// according to the given time parameter.  

+ 4 - 2
src/Avalonia.Animation/Timing.cs

@@ -33,7 +33,9 @@ namespace Avalonia.Animation
         /// </summary>
         static Timing()
         {
-            AnimationTimer = Observable.Interval(Tick, AvaloniaScheduler.Instance)
+            var globalTimer = Observable.Interval(Tick, AvaloniaScheduler.Instance);
+            
+            AnimationTimer = globalTimer
                 .Select(_ =>
                 {
                     switch (_globalState)
@@ -49,7 +51,7 @@ namespace Avalonia.Animation
                 .Publish()
                 .RefCount();
 
-            TransitionsTimer = Observable.Interval(Tick, AvaloniaScheduler.Instance)
+            TransitionsTimer = globalTimer
                                .Select(p => _transitionsFrameCount += 1)
                                .Publish()
                                .RefCount();