Browse Source

Remove CustomAnimatorBase

pull/20613/head
Julien Lebosquain 2 days ago
parent
commit
946c69dbd2
No known key found for this signature in database GPG Key ID: 1833CAD10ACC46FD
  1. 13
      src/Avalonia.Base/Animation/Animation.AnimatorRegistry.cs
  2. 30
      src/Avalonia.Base/Animation/ICustomAnimator.cs

13
src/Avalonia.Base/Animation/Animation.AnimatorRegistry.cs

@ -7,17 +7,6 @@ namespace Avalonia.Animation;
partial class Animation
{
/// <summary>
/// Sets the value of the Animator attached property for a setter.
/// </summary>
/// <param name="setter">The animation setter.</param>
/// <param name="value">The property animator value.</param>
[Obsolete("CustomAnimatorBase will be removed before 11.0, use InterpolatingAnimator<T>", true)]
public static void SetAnimator(IAnimationSetter setter, CustomAnimatorBase value)
{
s_animators[setter] = (value.WrapperType, value.CreateWrapper);
}
/// <summary>
/// Sets the value of the Animator attached property for a setter.
/// </summary>
@ -92,4 +81,4 @@ partial class Animation
return null;
}
}
}

30
src/Avalonia.Base/Animation/ICustomAnimator.cs

@ -2,34 +2,6 @@ using System;
using Avalonia.Animation.Animators;
namespace Avalonia.Animation;
[Obsolete("This class will be removed before 11.0, use InterpolatingAnimator<T>", true)]
public abstract class CustomAnimatorBase
{
internal abstract IAnimator CreateWrapper();
internal abstract Type WrapperType { get; }
}
[Obsolete("This class will be removed before 11.0, use InterpolatingAnimator<T>", true)]
public abstract class CustomAnimatorBase<T> : CustomAnimatorBase
{
public abstract T Interpolate(double progress, T oldValue, T newValue);
internal override Type WrapperType => typeof(AnimatorWrapper);
internal override IAnimator CreateWrapper() => new AnimatorWrapper(this);
internal class AnimatorWrapper : Animator<T>
{
private readonly CustomAnimatorBase<T> _parent;
public AnimatorWrapper(CustomAnimatorBase<T> parent)
{
_parent = parent;
}
public override T Interpolate(double progress, T oldValue, T newValue) => _parent.Interpolate(progress, oldValue, newValue);
}
}
public interface ICustomAnimator
{
internal IAnimator CreateWrapper();
@ -55,4 +27,4 @@ public abstract class InterpolatingAnimator<T> : ICustomAnimator
public override T Interpolate(double progress, T oldValue, T newValue) => _parent.Interpolate(progress, oldValue, newValue);
}
}
}

Loading…
Cancel
Save