Browse Source

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

Make RenderDemo & ControlCatalog's TabItems opacity transition faster.
pull/1793/head
Jumar Macato 8 years ago
parent
commit
a91cb08248
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 2
      samples/ControlCatalog/SideBar.xaml
  2. 2
      samples/RenderDemo/SideBar.xaml
  3. 4
      src/Avalonia.Animation/AnimationInstance`1.cs
  4. 4
      src/Avalonia.Animation/Animator`1.cs
  5. 9
      src/Avalonia.Animation/TransitionInstance.cs
  6. 2
      src/Avalonia.Animation/Transition`1.cs

2
samples/ControlCatalog/SideBar.xaml

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

2
samples/RenderDemo/SideBar.xaml

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

4
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
/// for keyframe animations.
/// </summary>
internal class AnimationsEngine<T> : SingleSubscriberObservableBase<T>
internal class AnimationInstance<T> : SingleSubscriberObservableBase<T>
{
private T _lastInterpValue;
private T _firstKFValue;
@ -37,7 +37,7 @@ namespace Avalonia.Animation
private Func<double, T, T> _interpolator;
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)
throw new InvalidOperationException("Speed ratio cannot be negative or zero.");

4
src/Avalonia.Animation/Animator`1.cs

@ -103,8 +103,8 @@ namespace Avalonia.Animation
/// </summary>
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>

9
src/Avalonia.Animation/TransitionsEngine.cs → src/Avalonia.Animation/TransitionInstance.cs

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

2
src/Avalonia.Animation/Transition`1.cs

@ -51,7 +51,7 @@ namespace Avalonia.Animation
/// <inheritdocs/>
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);
}

Loading…
Cancel
Save