From f29d050e73c0144909757c085bf6bcd5a156f7ae Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 15 May 2021 20:53:45 -0400 Subject: [PATCH] Add BoxShadows transition --- .../Transitions/BoxShadowsTransition.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Avalonia.Visuals/Animation/Transitions/BoxShadowsTransition.cs diff --git a/src/Avalonia.Visuals/Animation/Transitions/BoxShadowsTransition.cs b/src/Avalonia.Visuals/Animation/Transitions/BoxShadowsTransition.cs new file mode 100644 index 0000000000..008613fb40 --- /dev/null +++ b/src/Avalonia.Visuals/Animation/Transitions/BoxShadowsTransition.cs @@ -0,0 +1,23 @@ +using System; +using System.Reactive.Linq; + +using Avalonia.Animation.Animators; +using Avalonia.Media; + +namespace Avalonia.Animation +{ + /// + /// Transition class that handles with type. + /// + public class BoxShadowsTransition : Transition + { + private static readonly BoxShadowsAnimator s_animator = new BoxShadowsAnimator(); + + /// + public override IObservable DoTransition(IObservable progress, BoxShadows oldValue, BoxShadows newValue) + { + return progress + .Select(progress => s_animator.Interpolate(Easing.Ease(progress), oldValue, newValue)); + } + } +}