From 2c9a1fbeb68283a58ec94ab9a6a46bbe06efa4cd Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 31 May 2023 13:08:27 +0100 Subject: [PATCH 1/2] fix issue loading when changing between targetframeworks and targetframework. --- packages/Avalonia/Avalonia.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Avalonia/Avalonia.csproj b/packages/Avalonia/Avalonia.csproj index 8f1b39ae12..a4101afac1 100644 --- a/packages/Avalonia/Avalonia.csproj +++ b/packages/Avalonia/Avalonia.csproj @@ -5,7 +5,7 @@ - + all From abcad6e78ad3ee908ffa1a88202a22f4bf347c41 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 31 May 2023 18:46:00 +0600 Subject: [PATCH 2/2] Added InterpolatingTransitionBase --- .../Animation/InterpolatingTransitionBase.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs diff --git a/src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs b/src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs new file mode 100644 index 0000000000..44e3129b76 --- /dev/null +++ b/src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs @@ -0,0 +1,28 @@ +using System; +using Avalonia.Animation.Animators; + +namespace Avalonia.Animation; + +/// +/// The base class for user-defined transition that are doing simple value interpolation +/// +public abstract class InterpolatingTransitionBase : Transition +{ + class Animator : Animator + { + private readonly InterpolatingTransitionBase _parent; + + public Animator(InterpolatingTransitionBase parent) + { + _parent = parent; + } + + public override T Interpolate(double progress, T oldValue, T newValue) => + _parent.Interpolate(progress, oldValue, newValue); + } + + protected abstract T Interpolate(double progress, T from, T to); + + internal override IObservable DoTransition(IObservable progress, T oldValue, T newValue) => + new AnimatorTransitionObservable(new Animator(this), progress, Easing, oldValue, newValue); +} \ No newline at end of file