Added DelayBehavior option to XAML animation types
This commit is contained in:
Родитель
59d0b1297f
Коммит
d97a7f674b
|
@ -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));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the delay behavior for the animation. The default value is set to <see cref="AnimationDelayBehavior.SetInitialValueBeforeDelay"/>.
|
||||
/// 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 <see cref="CustomAnimation{TValue, TKeyFrame}"/>), it will be ignored.
|
||||
/// </summary>
|
||||
public AnimationDelayBehavior DelayBehavior
|
||||
{
|
||||
get => (AnimationDelayBehavior)GetValue(DelayBehaviorProperty);
|
||||
set => SetValue(DelayBehaviorProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <seealso cref="DelayBehavior"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DelayBehaviorProperty = DependencyProperty.Register(
|
||||
nameof(DelayBehavior),
|
||||
typeof(AnimationDelayBehavior),
|
||||
typeof(Animation),
|
||||
new PropertyMetadata(AnimationDelayBehavior.SetInitialValueBeforeDelay));
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract AnimationBuilder AppendToBuilder(AnimationBuilder builder, TimeSpan? delayHint, TimeSpan? durationHint, EasingType? easingTypeHint, EasingMode? easingModeHint);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
ExplicitTarget,
|
||||
Delay ?? DefaultDelay,
|
||||
Duration ?? DefaultDuration,
|
||||
Repeat);
|
||||
Repeat,
|
||||
DelayBehavior);
|
||||
|
||||
var (to, from) = GetParsedValues();
|
||||
|
||||
|
|
|
@ -70,7 +70,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
|
|||
explicitTarget,
|
||||
Delay ?? delayHint ?? DefaultDelay,
|
||||
Duration ?? durationHint ?? DefaultDuration,
|
||||
Repeat);
|
||||
Repeat,
|
||||
DelayBehavior);
|
||||
|
||||
AppendToBuilder(keyFrameBuilder, easingTypeHint, easingModeHint);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче