diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation.cs index 6e1590697..210e3828d 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using Windows.UI.Composition; using Windows.UI.Xaml; using Windows.UI.Xaml.Media.Animation; @@ -103,6 +104,26 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations typeof(Animation), new PropertyMetadata(RepeatOption.Once)); + /// + /// Gets or sets the delay behavior for the animation. The default value is set to . + /// This value is applicable when the current animation is used as either an implicit composition animation, or an explicit composition animation. + /// If the current animation is instead running on the XAML layer (if used through ), it will be ignored. + /// + public AnimationDelayBehavior DelayBehavior + { + get => (AnimationDelayBehavior)GetValue(DelayBehaviorProperty); + set => SetValue(DelayBehaviorProperty, value); + } + + /// + /// Identifies the dependency property. + /// + public static readonly DependencyProperty DelayBehaviorProperty = DependencyProperty.Register( + nameof(DelayBehavior), + typeof(AnimationDelayBehavior), + typeof(Animation), + new PropertyMetadata(AnimationDelayBehavior.SetInitialValueBeforeDelay)); + /// public abstract AnimationBuilder AppendToBuilder(AnimationBuilder builder, TimeSpan? delayHint, TimeSpan? durationHint, EasingType? easingTypeHint, EasingMode? easingModeHint); } diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs index ad90e43cb..c2e933be8 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/Animation{TValue,TKeyFrame}.cs @@ -104,6 +104,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations delay: Delay ?? delayHint ?? DefaultDelay, duration: Duration ?? durationHint ?? DefaultDuration, repeatOption: Repeat, + delayBehavior: DelayBehavior, build: static (b, s) => s.This.AppendToBuilder(b, s.EasingTypeHint, s.EasingModeHint)); } diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs index 5f070e6eb..bd77f2a49 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/CustomAnimation{TValue,TKeyFrame}.cs @@ -42,6 +42,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations state: (this, easingTypeHint, easingModeHint), delay: Delay ?? delayHint ?? DefaultDelay, duration: Duration ?? durationHint ?? DefaultDuration, + delayBehavior: DelayBehavior, layer: Layer, build: static (b, s) => s.This.AppendToBuilder(b, s.EasingTypeHint, s.EasingModeHint)); } diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs index f98baa39f..3f9ffc479 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Abstract/ImplicitAnimation{TValue,TKeyFrame}.cs @@ -29,7 +29,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations ExplicitTarget, Delay ?? DefaultDelay, Duration ?? DefaultDuration, - Repeat); + Repeat, + DelayBehavior); var (to, from) = GetParsedValues(); diff --git a/Microsoft.Toolkit.Uwp.UI.Media/Animations/Abstract/EffectAnimation{TEffect,TValue,TKeyFrame}.cs b/Microsoft.Toolkit.Uwp.UI.Media/Animations/Abstract/EffectAnimation{TEffect,TValue,TKeyFrame}.cs index faaa78dd1..7b9e34811 100644 --- a/Microsoft.Toolkit.Uwp.UI.Media/Animations/Abstract/EffectAnimation{TEffect,TValue,TKeyFrame}.cs +++ b/Microsoft.Toolkit.Uwp.UI.Media/Animations/Abstract/EffectAnimation{TEffect,TValue,TKeyFrame}.cs @@ -70,7 +70,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations explicitTarget, Delay ?? delayHint ?? DefaultDelay, Duration ?? durationHint ?? DefaultDuration, - Repeat); + Repeat, + DelayBehavior); AppendToBuilder(keyFrameBuilder, easingTypeHint, easingModeHint);