diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Blur.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Blur.cs
deleted file mode 100644
index 3a56da53c15..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Blur.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Performs an blur animation using composition.
- ///
- ///
- /// Microsoft.Xaml.Interactivity.Behavior{Windows.UI.Xaml.UIElement}
- ///
- public class Blur : CompositionBehaviorBase
- {
- ///
- /// The Blur value of the associated object
- ///
- public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(Blur), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// Gets or sets the Blur.
- ///
- ///
- /// The Blur.
- ///
- public double Value
- {
- get { return (double)GetValue(ValueProperty); }
- set { SetValue(ValueProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject?.Blur(duration: Duration, delay: Delay, value: (float)Value, easingType: EasingType, easingMode: EasingMode)?.Start();
- }
- }
-}
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.cs
deleted file mode 100644
index 3dd912d33a7..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Toolkit.Uwp.UI.Behaviors;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Media.Animation;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// A base class for all behaviors using composition.It contains some of the common properties to set on a visual.
- ///
- /// The type of the associated object.
- ///
- public abstract class CompositionBehaviorBase : BehaviorBase
- where T : UIElement
- {
- ///
- /// Called when the associated object has been loaded.
- ///
- protected override void OnAssociatedObjectLoaded()
- {
- base.OnAssociatedObjectLoaded();
-
- if (AutomaticallyStart)
- {
- StartAnimation();
- }
- }
-
- ///
- /// The duration of the animation.
- ///
- public static readonly DependencyProperty DurationProperty = DependencyProperty.Register(nameof(Duration), typeof(double), typeof(CompositionBehaviorBase), new PropertyMetadata(1d, PropertyChangedCallback));
-
- ///
- /// The delay of the animation.
- ///
- public static readonly DependencyProperty DelayProperty = DependencyProperty.Register(nameof(Delay), typeof(double), typeof(CompositionBehaviorBase), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The property sets if the animation should automatically start.
- ///
- public static readonly DependencyProperty AutomaticallyStartProperty = DependencyProperty.Register(nameof(AutomaticallyStart), typeof(bool), typeof(CompositionBehaviorBase), new PropertyMetadata(true, PropertyChangedCallback));
-
- ///
- /// The used to generate the easing function of the animation.
- ///
- public static readonly DependencyProperty EasingTypeProperty = DependencyProperty.Register(nameof(EasingType), typeof(EasingType), typeof(CompositionBehaviorBase), new PropertyMetadata(EasingType.Default, PropertyChangedCallback));
-
- ///
- /// The used to generate the easing function of the animation.
- ///
- public static readonly DependencyProperty EasingModeProperty = DependencyProperty.Register(nameof(EasingMode), typeof(EasingMode), typeof(CompositionBehaviorBase), new PropertyMetadata(EasingMode.EaseOut, PropertyChangedCallback));
-
- ///
- /// Gets or sets a value indicating whether [automatically start] on the animation is set.
- ///
- ///
- /// true if [automatically start]; otherwise, false.
- ///
- public bool AutomaticallyStart
- {
- get { return (bool)GetValue(AutomaticallyStartProperty); }
- set { SetValue(AutomaticallyStartProperty, value); }
- }
-
- ///
- /// Gets or sets the delay.
- ///
- ///
- /// The delay.
- ///
- public double Delay
- {
- get { return (double)GetValue(DelayProperty); }
- set { SetValue(DelayProperty, value); }
- }
-
- ///
- /// Gets or sets the duration.
- ///
- ///
- /// The duration.
- ///
- public double Duration
- {
- get { return (double)GetValue(DurationProperty); }
- set { SetValue(DurationProperty, value); }
- }
-
- ///
- /// Gets or sets the used to generate the easing function of the animation.
- ///
- ///
- /// The easing function
- ///
- public EasingType EasingType
- {
- get { return (EasingType)GetValue(EasingTypeProperty); }
- set { SetValue(EasingTypeProperty, value); }
- }
-
- ///
- /// Gets or sets the used to generate the easing function of the animation.
- ///
- ///
- /// The easing mode
- ///
- public EasingMode EasingMode
- {
- get { return (EasingMode)GetValue(EasingModeProperty); }
- set { SetValue(EasingModeProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public abstract void StartAnimation();
-
- ///
- /// If any of the properties are changed then the animation is automatically started depending on the AutomaticallyStart property.
- ///
- /// The dependency object.
- /// The instance containing the event data.
- protected static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
- {
- var behavior = dependencyObject as CompositionBehaviorBase;
- if (behavior == null)
- {
- return;
- }
-
- if (behavior.AutomaticallyStart)
- {
- behavior.StartAnimation();
- }
- }
- }
-}
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.nongeneric.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.nongeneric.cs
deleted file mode 100644
index c68a8180bac..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/CompositionBehaviorBase.nongeneric.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Non-generic convenience implementation to provide backwards compatibility.
- ///
- ///
- public abstract class CompositionBehaviorBase : CompositionBehaviorBase
- {
- }
-}
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Fade.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Fade.cs
deleted file mode 100644
index fe9d4bab165..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Fade.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Performs an fade animation using composition.
- ///
- ///
- /// Microsoft.Xaml.Interactivity.Behavior{Windows.UI.Xaml.UIElement}
- ///
- public class Fade : CompositionBehaviorBase
- {
- ///
- /// The Opacity value of the associated object
- ///
- public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(Fade), new PropertyMetadata(1d, PropertyChangedCallback));
-
- ///
- /// Gets or sets the Opacity.
- ///
- ///
- /// The Opacity.
- ///
- public double Value
- {
- get { return (double)GetValue(ValueProperty); }
- set { SetValue(ValueProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject.Fade((float)Value, Duration, Delay, EasingType, EasingMode)?.Start();
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Light.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Light.cs
deleted file mode 100644
index 556972c1dae..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Light.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using Windows.UI;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Media;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Applies a basic point light to a UIElement. You control the intensity by setting the distance of the light.
- ///
- ///
- [Obsolete("The Light effect will be removed in a future major release. Please use XamlLight instead")]
-
- public class Light : CompositionBehaviorBase
- {
- ///
- /// The Blur value of the associated object
- ///
- public static readonly DependencyProperty DistanceProperty = DependencyProperty.Register(nameof(Distance), typeof(double), typeof(Light), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The Color of the spotlight no the associated object.
- ///
- public static readonly DependencyProperty ColorProperty = DependencyProperty.Register("Color", typeof(Brush), typeof(Light), new PropertyMetadata(new SolidColorBrush(Colors.White)));
-
- ///
- /// Gets or sets the Blur.
- ///
- ///
- /// The Blur.
- ///
- public double Distance
- {
- get { return (double)GetValue(DistanceProperty); }
- set { SetValue(DistanceProperty, value); }
- }
-
- ///
- /// Gets or sets the color of the spotlight.
- ///
- public Brush Color
- {
- get { return (Brush)GetValue(ColorProperty); }
- set { SetValue(ColorProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject?.Light(
- duration: Duration,
- delay: Delay,
- easingType: EasingType,
- easingMode: EasingMode,
- distance: (float)Distance,
- color: ((SolidColorBrush)Color).Color)?.Start();
- }
- }
-}
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Offset.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Offset.cs
deleted file mode 100644
index 16e1e7d7c47..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Offset.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Performs an offset animation using composition.
- ///
- ///
- ///
- /// Microsoft.Xaml.Interactivity.Behavior{Windows.UI.Xaml.UIElement}
- ///
- public class Offset : CompositionBehaviorBase
- {
- ///
- /// The Offset on the x axis of the associated object
- ///
- public static readonly DependencyProperty OffsetXProperty = DependencyProperty.Register(nameof(OffsetX), typeof(double), typeof(Offset), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The Offset on the y axis of the associated object
- ///
- public static readonly DependencyProperty OffsetYProperty = DependencyProperty.Register(nameof(OffsetY), typeof(double), typeof(Offset), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// Gets or sets the Offset x.
- ///
- ///
- /// The Offset x.
- ///
- public double OffsetX
- {
- get { return (double)GetValue(OffsetXProperty); }
- set { SetValue(OffsetXProperty, value); }
- }
-
- ///
- /// Gets or sets the Offset y.
- ///
- ///
- /// The Offset y.
- ///
- public double OffsetY
- {
- get { return (double)GetValue(OffsetYProperty); }
- set { SetValue(OffsetYProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject.Offset(
- duration: Duration,
- delay: Delay,
- easingType: EasingType,
- easingMode: EasingMode,
- offsetX: (float)OffsetX,
- offsetY: (float)OffsetY)?.Start();
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Rotate.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Rotate.cs
deleted file mode 100644
index d1117c791c0..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Rotate.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Performs a rotation animation using composition.
- ///
- public class Rotate : CompositionBehaviorBase
- {
- ///
- /// The rotation of the associated object in degrees
- ///
- public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(Rotate), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The center (x axis) of rotation for associated object
- ///
- public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(nameof(CenterX), typeof(double), typeof(Rotate), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The center (y axis) of rotation for associated object
- ///
- public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(nameof(CenterY), typeof(double), typeof(Rotate), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// Gets or sets the center point (x axis) of the associated object.
- ///
- ///
- /// The center point (x axis) of the associated object.
- ///
- public double CenterX
- {
- get { return (double)GetValue(CenterXProperty); }
- set { SetValue(CenterXProperty, value); }
- }
-
- ///
- /// Gets or sets the center point (y axis) of the associated object.
- ///
- ///
- /// The center point (y axis) of the associated object.
- ///
- public double CenterY
- {
- get { return (double)GetValue(CenterYProperty); }
- set { SetValue(CenterYProperty, value); }
- }
-
- ///
- /// Gets or sets the Rotation in degrees.
- ///
- ///
- /// The Rotation of the associated object in degrees.
- ///
- public double Value
- {
- get { return (double)GetValue(ValueProperty); }
- set { SetValue(ValueProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject.Rotate(
- duration: Duration,
- delay: Delay,
- easingType: EasingType,
- easingMode: EasingMode,
- value: (float)Value,
- centerX: (float)CenterX,
- centerY: (float)CenterY)?
- .Start();
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Saturation.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Saturation.cs
deleted file mode 100644
index 61e0050fcb0..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Saturation.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// A behavior to allow Saturation changes to a UI Element.
- ///
- public class Saturation : CompositionBehaviorBase
- {
- ///
- /// The Saturation value of the associated object
- ///
- public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(Saturation), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The _framework element
- ///
- private FrameworkElement _frameworkElement;
-
- ///
- /// Gets or sets the Saturation.
- ///
- ///
- /// The Saturation.
- ///
- public double Value
- {
- get { return (double)GetValue(ValueProperty); }
- set { SetValue(ValueProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- _frameworkElement?.Saturation(
- duration: Duration,
- delay: Delay,
- easingType: EasingType,
- easingMode: EasingMode,
- value: (float)Value)?.StartAsync();
- }
-
- ///
- /// Called after the behavior is attached to the .
- ///
- ///
- /// Override this to hook up functionality to the
- ///
- protected override void OnAttached()
- {
- base.OnAttached();
- _frameworkElement = AssociatedObject as FrameworkElement;
- }
- }
-}
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Scale.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Scale.cs
deleted file mode 100644
index dc56e81a0e9..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Scale.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Windows.UI.Xaml;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
-{
- ///
- /// Performs a scale animation using composition.
- ///
- public class Scale : CompositionBehaviorBase
- {
- ///
- /// The scale (x axis) of the associated object
- ///
- public static readonly DependencyProperty ScaleXProperty = DependencyProperty.Register(nameof(ScaleX), typeof(double), typeof(Scale), new PropertyMetadata(1d, PropertyChangedCallback));
-
- ///
- /// The scale (y axis) of the associated object
- ///
- public static readonly DependencyProperty ScaleYProperty = DependencyProperty.Register(nameof(ScaleY), typeof(double), typeof(Scale), new PropertyMetadata(1d, PropertyChangedCallback));
-
- ///
- /// The center (x axis) of scale for associated object
- ///
- public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(nameof(CenterX), typeof(double), typeof(Scale), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// The center (y axis) of scale for associated object
- ///
- public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(nameof(CenterY), typeof(double), typeof(Scale), new PropertyMetadata(0d, PropertyChangedCallback));
-
- ///
- /// Gets or sets the scale on the x axis.
- ///
- ///
- /// The scale on the x axis.
- ///
- public double ScaleX
- {
- get { return (double)GetValue(ScaleXProperty); }
- set { SetValue(ScaleXProperty, value); }
- }
-
- ///
- /// Gets or sets the scale on the y axis.
- ///
- ///
- /// The scale on the y axis.
- ///
- public double ScaleY
- {
- get { return (double)GetValue(ScaleYProperty); }
- set { SetValue(ScaleYProperty, value); }
- }
-
- ///
- /// Gets or sets the scale (x axis) of the associated object.
- ///
- ///
- /// The scale (x axis) of the associated object.
- ///
- public double CenterX
- {
- get { return (double)GetValue(CenterXProperty); }
- set { SetValue(CenterXProperty, value); }
- }
-
- ///
- /// Gets or sets the scale (y axis) of the associated object.
- ///
- ///
- /// The scale (y axis) of the associated object.
- ///
- public double CenterY
- {
- get { return (double)GetValue(CenterYProperty); }
- set { SetValue(CenterYProperty, value); }
- }
-
- ///
- /// Starts the animation.
- ///
- public override void StartAnimation()
- {
- AssociatedObject.Scale(
- duration: Duration,
- delay: Delay,
- easingType: EasingType,
- easingMode: EasingMode,
- centerX: (float)CenterX,
- centerY: (float)CenterY,
- scaleX: (float)ScaleX,
- scaleY: (float)ScaleY)?
- .Start();
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/AnimationEffect.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Effects/AnimationEffect.cs
deleted file mode 100644
index 724e1e35fec..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/AnimationEffect.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Numerics;
-using Windows.UI.Composition;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Hosting;
-using Windows.UI.Xaml.Media.Animation;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
-{
- ///
- /// An abstract class that provides the mechanism to create
- /// an effect using composition.
- ///
- public abstract class AnimationEffect
- {
- private static string[] _effectProperties;
-
- ///
- /// Gets the name of the effect.
- ///
- ///
- /// The name of the effect.
- ///
- public abstract string EffectName { get; }
-
- ///
- /// Gets or sets the compositor.
- ///
- ///
- /// The compositor.
- ///
- public Compositor Compositor { get; set; }
-
- ///
- /// Gets or sets the effect brush.
- ///
- ///
- /// The effect brush.
- ///
- public CompositionEffectBrush EffectBrush { get; set; }
-
- ///
- /// Applies the effect.
- ///
- /// An array of strings of the effect properties to change.
- public abstract string[] ApplyEffect();
-
- ///
- /// An animation which will apply the derived effect.
- ///
- /// The animation set.
- /// The value.
- /// The duration in milliseconds.
- /// The delay in milliseconds.
- /// The easing function to use
- /// The easing mode to use
- /// An animation set with the effect added to it.
- public AnimationSet EffectAnimation(
- AnimationSet animationSet,
- double value = 0d,
- double duration = 500d,
- double delay = 0d,
- EasingType easingType = EasingType.Default,
- EasingMode easingMode = EasingMode.EaseOut)
- {
- if (animationSet == null)
- {
- return null;
- }
-
- var visual = animationSet.Visual;
- var associatedObject = animationSet.Element as FrameworkElement;
-
- if (associatedObject == null)
- {
- return animationSet;
- }
-
- Compositor = visual?.Compositor;
-
- if (Compositor == null)
- {
- return null;
- }
-
- // check to see if the visual already has an effect applied.
- var spriteVisual = ElementCompositionPreview.GetElementChildVisual(associatedObject) as SpriteVisual;
- EffectBrush = spriteVisual?.Brush as CompositionEffectBrush;
-
- if (EffectBrush == null || EffectBrush?.Comment != EffectName)
- {
- _effectProperties = ApplyEffect();
- EffectBrush.Comment = EffectName;
-
- var sprite = Compositor.CreateSpriteVisual();
- sprite.Brush = EffectBrush;
- ElementCompositionPreview.SetElementChildVisual(associatedObject, sprite);
-
- sprite.Size = new Vector2((float)associatedObject.ActualWidth, (float)associatedObject.ActualHeight);
-
- associatedObject.SizeChanged +=
- (s, e) =>
- {
- sprite.Size = new Vector2(
- (float)associatedObject.ActualWidth,
- (float)associatedObject.ActualHeight);
- };
- }
-
- if (duration <= 0)
- {
- foreach (var effectProperty in _effectProperties)
- {
- animationSet.AddEffectDirectPropertyChange(EffectBrush, (float)value, effectProperty);
- }
- }
- else
- {
- foreach (var effectProperty in _effectProperties)
- {
- var animation = Compositor.CreateScalarKeyFrameAnimation();
- animation.InsertKeyFrame(1f, (float)value, AnimationExtensions.GetCompositionEasingFunction(easingType, Compositor, easingMode));
-
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- animation.DelayTime = TimeSpan.FromMilliseconds(delay);
-
- animationSet.AddCompositionEffectAnimation(EffectBrush, animation, effectProperty);
- }
- }
-
- // Saturation starts from 1 to 0, instead of 0 to 1 so this makes sure the
- // the brush isn't removed from the UI element incorrectly. Completing on
- // Saturation as it's reusing the same sprite visual. Removing the Sprite removes the effect.
- if (EffectName != "Saturation" && value == 0)
- {
- animationSet.Completed += AnimationSet_Completed;
- }
-
- return animationSet;
- }
-
- ///
- /// Handles the Completed event of the AnimationSet control.
- /// When an animation is completed the brush is removed from the sprite.
- ///
- /// The source of the event.
- /// The instance containing the event data.
- private void AnimationSet_Completed(object sender, EventArgs e)
- {
- var animationSet = sender as AnimationSet;
-
- if (animationSet != null)
- {
- animationSet.Completed -= AnimationSet_Completed;
-
- var spriteVisual = ElementCompositionPreview.GetElementChildVisual(animationSet.Element) as SpriteVisual;
- var brush = spriteVisual?.Brush as CompositionEffectBrush;
-
- if (brush != null && brush.Comment == EffectName)
- {
- spriteVisual.Brush = null;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Blur.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Blur.cs
deleted file mode 100644
index aa60fd5e059..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Blur.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Graphics.Canvas.Effects;
-using Windows.UI.Composition;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
-{
- ///
- /// An animation effect that applies blur.
- ///
- ///
- public class Blur : AnimationEffect
- {
- ///
- /// Gets the name of the effect.
- ///
- ///
- /// The name of the effect.
- ///
- public override string EffectName { get; } = "Blur";
-
- ///
- /// Applies the effect.
- ///
- ///
- /// An array of strings of the effect properties to change.
- ///
- public override string[] ApplyEffect()
- {
- var gaussianBlur = new GaussianBlurEffect
- {
- Name = EffectName,
- BlurAmount = 0f,
- Optimization = EffectOptimization.Balanced,
- BorderMode = EffectBorderMode.Hard,
- Source = new CompositionEffectSourceParameter("source")
- };
-
- var propertyToChange = $"{EffectName}.BlurAmount";
- var propertiesToAnimate = new[] { propertyToChange };
-
- EffectBrush = Compositor.CreateEffectFactory(gaussianBlur, propertiesToAnimate).CreateBrush();
- EffectBrush.SetSourceParameter("source", Compositor.CreateBackdropBrush());
-
- return propertiesToAnimate;
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Saturation.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Saturation.cs
deleted file mode 100644
index 30289f925a3..00000000000
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Effects/Saturation.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Graphics.Canvas.Effects;
-using Windows.UI.Composition;
-
-namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
-{
- ///
- /// An animation effect that applies saturation.
- ///
- ///
- public class Saturation : AnimationEffect
- {
- ///
- /// Gets the name of the effect.
- ///
- ///
- /// The name of the effect.
- ///
- public override string EffectName { get; } = "Saturation";
-
- ///
- /// Applies the effect.
- ///
- ///
- /// An array of strings of the effect properties to change.
- ///
- public override string[] ApplyEffect()
- {
- var saturationEffect = new SaturationEffect
- {
- Saturation = 1f,
- Name = EffectName,
- Source = new CompositionEffectSourceParameter("source")
- };
-
- var propertyToChange = $"{EffectName}.Saturation";
- var propertiesToAnimate = new[] { propertyToChange };
-
- EffectBrush = Compositor.CreateEffectFactory(saturationEffect, propertiesToAnimate).CreateBrush();
- EffectBrush.SetSourceParameter("source", Compositor.CreateBackdropBrush());
-
- return propertiesToAnimate;
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj b/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj
index 77c82601938..3bc4c0b8b6c 100644
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj
+++ b/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj
@@ -18,22 +18,6 @@
9.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/AnimationSet.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/AnimationSet.cs
index c2cefeb6a6e..44a211cb0f0 100644
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/AnimationSet.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/AnimationSet.cs
@@ -32,16 +32,9 @@ public sealed class AnimationSet : DependencyObjectCollection
public event EventHandler? Started;
///
- /// Raised whenever the current animation ends.
+ /// Raised whenever the current animation completes.
///
- public event EventHandler? Ended;
-
- ///
- /// An interface representing a node in an instance.
- ///
- public interface INode
- {
- }
+ public event EventHandler? Completed;
///
/// Gets or sets a value indicating whether top level animation nodes in this collection are invoked
@@ -73,7 +66,7 @@ public async void Start()
// Here we're using an async void method on purpose, in order to be able to await
// the completion of the animation and rethrow exceptions. We can't just use the
// synchronous AnimationBuilder.Start method here, as we also need to await for the
- // animation to complete in either case in order to raise the Ended event when that
+ // animation to complete in either case in order to raise the Completed event when that
// happens. So we add an async state machine here to work around this.
await StartAsync();
}
@@ -124,7 +117,7 @@ public async Task StartAsync(UIElement element, CancellationToken token)
if (IsSequential)
{
- foreach (INode node in this)
+ foreach (object node in this)
{
if (node is ITimeline timeline)
{
@@ -151,6 +144,10 @@ public async Task StartAsync(UIElement element, CancellationToken token)
break;
}
}
+ else
+ {
+ ThrowArgumentException();
+ }
// This should in theory only be necessary in the timeline branch, but doing this check
// after running activities too help guard against 3rd party activities that might not
@@ -165,7 +162,7 @@ public async Task StartAsync(UIElement element, CancellationToken token)
{
var builder = AnimationBuilder.Create();
- foreach (INode node in this)
+ foreach (object node in this)
{
switch (node)
{
@@ -175,13 +172,18 @@ public async Task StartAsync(UIElement element, CancellationToken token)
case IActivity activity:
_ = activity.InvokeAsync(element, token);
break;
+ default:
+ ThrowArgumentException();
+ break;
}
}
await builder.StartAsync(element, token);
}
- Ended?.Invoke(this, EventArgs.Empty);
+ Completed?.Invoke(this, EventArgs.Empty);
+
+ static void ThrowArgumentException() => throw new ArgumentException($"An animation set can only contain nodes implementing either ITimeline or IActivity");
}
///
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/IActivity.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/IActivity.cs
index 7baa9a47d77..9237b843c85 100644
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/IActivity.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/IActivity.cs
@@ -11,7 +11,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
///
/// An interface representing a XAML model for a custom activity or action within an .
///
- public interface IActivity : AnimationSet.INode
+ public interface IActivity
{
///
/// Invokes the current activity.
diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/ITimeline.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/ITimeline.cs
index 78635101acd..6f3ad7d93d7 100644
--- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/ITimeline.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Interfaces/ITimeline.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
///
/// An interface representing a XAML model for a custom animation.
///
- public interface ITimeline : AnimationSet.INode
+ public interface ITimeline
{
///
/// Appens the current animation to a target instance.
diff --git a/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationEndBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationCompletedTriggerBehavior.cs
similarity index 84%
rename from Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationEndBehavior.cs
rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationCompletedTriggerBehavior.cs
index eb0a6442bd9..86848be62f2 100644
--- a/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationEndBehavior.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationCompletedTriggerBehavior.cs
@@ -10,9 +10,9 @@
namespace Microsoft.Toolkit.Uwp.UI.Behaviors
{
///
- /// A custom that fires whenever a linked ends.
+ /// A custom that fires whenever a linked completes.
///
- public sealed class AnimationEndBehavior : Trigger
+ public sealed class AnimationCompletedTriggerBehavior : Trigger
{
///
/// The current instance in use.
@@ -48,14 +48,14 @@ private void SetResolvedCollection(AnimationSet? animationCollection)
if (this.animationCollection is not null)
{
- this.animationCollection.Ended -= AnimationCollection_Ended;
+ this.animationCollection.Completed -= AnimationCollection_Completed;
}
this.animationCollection = animationCollection;
if (animationCollection is not null)
{
- animationCollection.Ended += AnimationCollection_Ended;
+ animationCollection.Completed += AnimationCollection_Completed;
}
}
@@ -64,7 +64,7 @@ private void SetResolvedCollection(AnimationSet? animationCollection)
///
/// The source instance.
/// The arguments for the event (unused).
- private void AnimationCollection_Ended(object sender, System.EventArgs e)
+ private void AnimationCollection_Completed(object sender, System.EventArgs e)
{
Interaction.ExecuteActions(sender, Actions, e);
}
diff --git a/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartedTriggerBehavior.cs
similarity index 96%
rename from Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartBehavior.cs
rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartedTriggerBehavior.cs
index 11c87b9cb52..a436fa21738 100644
--- a/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartBehavior.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/AnimationStartedTriggerBehavior.cs
@@ -12,7 +12,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Behaviors
///
/// A custom that fires whenever a linked starts.
///
- public sealed class AnimationStartBehavior : Trigger
+ public sealed class AnimationStartedTriggerBehavior : Trigger
{
///
/// The current instance in use.