Browse Source

dont break api.

pull/5886/head
Dan Walmsley 5 years ago
parent
commit
d084cf8fc7
  1. 2
      src/Avalonia.Animation/AnimationInstance`1.cs
  2. 2
      src/Avalonia.Animation/Animators/Animator`1.cs
  3. 21
      src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs

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

@ -12,7 +12,7 @@ namespace Avalonia.Animation
/// Handles interpolation and time-related functions
/// for keyframe animations.
/// </summary>
internal class AnimationInstance<T> : SingleSubscriberObservableBase<T>
internal class AnimationInstance<T> : SingleSubscriberObservableBase<object>
{
private T _lastInterpValue;
private T _firstKFValue;

2
src/Avalonia.Animation/Animators/Animator`1.cs

@ -116,7 +116,7 @@ namespace Avalonia.Animation.Animators
clock ?? control.Clock ?? Clock.GlobalClock,
onComplete,
InterpolationHandler);
return control.Bind<T>((AvaloniaProperty<T>)Property, instance, BindingPriority.Animation);
return control.Bind(Property, instance, BindingPriority.Animation);
}
/// <summary>

21
src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs

@ -1,4 +1,5 @@
using Avalonia.Media;
using System;
using Avalonia.Media;
using Avalonia.Media.Immutable;
namespace Avalonia.Animation.Animators
@ -6,14 +7,20 @@ namespace Avalonia.Animation.Animators
/// <summary>
/// Animator that handles <see cref="SolidColorBrush"/> values.
/// </summary>
public class SolidColorBrushAnimator : Animator<IBrush>
public class ISolidColorBrushAnimator : Animator<ISolidColorBrush>
{
public override IBrush Interpolate(double progress, IBrush oldValue, IBrush newValue)
public override ISolidColorBrush Interpolate(double progress, ISolidColorBrush oldValue, ISolidColorBrush newValue)
{
if (!(oldValue is ISolidColorBrush oldSCB) || !(newValue is ISolidColorBrush newSCB))
return Brushes.Transparent;
return new ImmutableSolidColorBrush(ColorAnimator.InterpolateCore(progress, oldSCB.Color, newSCB.Color));
return new ImmutableSolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color));
}
}
[Obsolete]
public class SolidColorBrushAnimator : Animator<SolidColorBrush>
{
public override SolidColorBrush Interpolate(double progress, SolidColorBrush oldValue, SolidColorBrush newValue)
{
return new SolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color));
}
}
}

Loading…
Cancel
Save