浏览代码

Fix naming on Animations & Transitions to better reflect their purpose.

Make RenderDemo & ControlCatalog's TabItems opacity transition faster.
Jumar Macato 7 年之前
父节点
当前提交
a91cb08248

+ 1 - 1
samples/ControlCatalog/SideBar.xaml

@@ -36,7 +36,7 @@
     <Setter Property="Opacity" Value="0.5"/>
     <Setter Property="Opacity" Value="0.5"/>
     <Setter Property="Transitions">
     <Setter Property="Transitions">
       <Transitions>
       <Transitions>
-        <DoubleTransition Property="Opacity" Duration="0:0:0.5"/>
+        <DoubleTransition Property="Opacity" Duration="0:0:0.2"/>
       </Transitions>
       </Transitions>
     </Setter>
     </Setter>
   </Style>
   </Style>

+ 1 - 1
samples/RenderDemo/SideBar.xaml

@@ -37,7 +37,7 @@
     <Setter Property="Opacity" Value="0.5"/>
     <Setter Property="Opacity" Value="0.5"/>
     <Setter Property="Transitions">
     <Setter Property="Transitions">
       <Transitions>
       <Transitions>
-        <DoubleTransition Property="Opacity" Duration="0:0:0.5"/>
+        <DoubleTransition Property="Opacity" Duration="0:0:0.2"/>
       </Transitions>
       </Transitions>
     </Setter>
     </Setter>
   </Style>
   </Style>

+ 2 - 2
src/Avalonia.Animation/AnimationsEngine`1.cs → src/Avalonia.Animation/AnimationInstance`1.cs

@@ -11,7 +11,7 @@ namespace Avalonia.Animation
     /// Handles interpolatoin and time-related functions 
     /// Handles interpolatoin and time-related functions 
     /// for keyframe animations.
     /// for keyframe animations.
     /// </summary>
     /// </summary>
-    internal class AnimationsEngine<T> : SingleSubscriberObservableBase<T>
+    internal class AnimationInstance<T> : SingleSubscriberObservableBase<T>
     {
     {
         private T _lastInterpValue;
         private T _lastInterpValue;
         private T _firstKFValue;
         private T _firstKFValue;
@@ -37,7 +37,7 @@ namespace Avalonia.Animation
         private Func<double, T, T> _interpolator;
         private Func<double, T, T> _interpolator;
         private IDisposable _timerSubscription;
         private IDisposable _timerSubscription;
 
 
-        public AnimationsEngine(Animation animation, Animatable control, Animator<T> animator, Action OnComplete, Func<double, T, T> Interpolator)
+        public AnimationInstance(Animation animation, Animatable control, Animator<T> animator, Action OnComplete, Func<double, T, T> Interpolator)
         {
         {
             if (animation.SpeedRatio <= 0)
             if (animation.SpeedRatio <= 0)
                 throw new InvalidOperationException("Speed ratio cannot be negative or zero.");
                 throw new InvalidOperationException("Speed ratio cannot be negative or zero.");

+ 2 - 2
src/Avalonia.Animation/Animator`1.cs

@@ -103,8 +103,8 @@ namespace Avalonia.Animation
         /// </summary>
         /// </summary>
         private IDisposable RunKeyFrames(Animation animation, Animatable control, Action onComplete)
         private IDisposable RunKeyFrames(Animation animation, Animatable control, Action onComplete)
         {
         {
-            var stateMachine = new AnimationsEngine<T>(animation, control, this, onComplete, DoInterpolation);
-            return control.Bind<T>((AvaloniaProperty<T>)Property, stateMachine, BindingPriority.Animation);
+            var instance = new AnimationInstance<T>(animation, control, this, onComplete, DoInterpolation);
+            return control.Bind<T>((AvaloniaProperty<T>)Property, instance, BindingPriority.Animation);
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 4 - 5
src/Avalonia.Animation/TransitionsEngine.cs → src/Avalonia.Animation/TransitionInstance.cs

@@ -13,13 +13,13 @@ namespace Avalonia.Animation
     /// <summary>
     /// <summary>
     /// Handles the timing and lifetime of a <see cref="Transition{T}"/>.
     /// Handles the timing and lifetime of a <see cref="Transition{T}"/>.
     /// </summary>
     /// </summary>
-    public class TransitionsEngine : SingleSubscriberObservableBase<double>
+    internal class TransitionIteration : SingleSubscriberObservableBase<double>
     {
     {
         private IDisposable timerSubscription;
         private IDisposable timerSubscription;
         private TimeSpan startTime;
         private TimeSpan startTime;
         private TimeSpan duration;
         private TimeSpan duration;
 
 
-        public TransitionsEngine(TimeSpan Duration)
+        public TransitionIteration(TimeSpan Duration)
         {
         {
             duration = Duration;
             duration = Duration;
         }
         }
@@ -46,9 +46,8 @@ namespace Avalonia.Animation
         protected override void Subscribed()
         protected override void Subscribed()
         {
         {
             startTime = Timing.GetTickCount();
             startTime = Timing.GetTickCount();
-            timerSubscription = Timing
-                                .AnimationsTimer
-                                .Subscribe(t => TimerTick(t));
+            timerSubscription = Timing.AnimationsTimer
+                                      .Subscribe(t => TimerTick(t));
             PublishNext(0.0d);
             PublishNext(0.0d);
         }
         }
     }
     }

+ 1 - 1
src/Avalonia.Animation/Transition`1.cs

@@ -51,7 +51,7 @@ namespace Avalonia.Animation
         /// <inheritdocs/>
         /// <inheritdocs/>
         public virtual IDisposable Apply(Animatable control, object oldValue, object newValue)
         public virtual IDisposable Apply(Animatable control, object oldValue, object newValue)
         {
         {
-            var transition = DoTransition(new TransitionsEngine(Duration), (T)oldValue, (T)newValue);
+            var transition = DoTransition(new TransitionIteration(Duration), (T)oldValue, (T)newValue);
             return control.Bind<T>((AvaloniaProperty<T>)Property, transition, Data.BindingPriority.Animation);
             return control.Bind<T>((AvaloniaProperty<T>)Property, transition, Data.BindingPriority.Animation);
         }
         }