3using Microsoft.Maui.Controls;
21 if (Duration <= TimeSpan.Zero)
22 throw new ArgumentOutOfRangeException(nameof(Duration),
"Duration must be positive.");
25 this.Easing =
Easing ??
throw new ArgumentNullException(nameof(
Easing));
26 this.Metadata =
Metadata ??
new Dictionary<string, object>();
37 public TimeSpan Duration {
get; }
47 public IReadOnlyDictionary<string, object>
Metadata {
get; }
55 private readonly Func<IAnimationContext, IViewAnimation> factory;
68 this.factory = Factory ??
throw new ArgumentNullException(nameof(Factory));
78 ArgumentNullException.ThrowIfNull(Context);
79 return this.factory(Context);
88 private readonly Func<IAnimationContext, ITransitionAnimation> factory;
101 this.factory = Factory ??
throw new ArgumentNullException(nameof(Factory));
111 ArgumentNullException.ThrowIfNull(Context);
112 return this.factory(Context);
Base class for animation descriptors.
TimeSpan Duration
Gets the default duration.
IReadOnlyDictionary< string, object > Metadata
Gets optional metadata describing the animation.
AnimationKey Key
Gets the descriptor key.
Easing Easing
Gets the default easing.
AnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, IReadOnlyDictionary< string, object >? Metadata)
Initializes a new instance of the AnimationDescriptor class.
Descriptor defining a reusable transition animation profile.
TransitionAnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, Func< IAnimationContext, ITransitionAnimation > Factory, IReadOnlyDictionary< string, object >? Metadata=null)
Initializes a new instance of the TransitionAnimationDescriptor class.
ITransitionAnimation CreateExecutor(IAnimationContext Context)
Creates an executor for the given context.
Descriptor defining a reusable view animation profile.
IViewAnimation CreateExecutor(IAnimationContext Context)
Creates an executor for the given context.
ViewAnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, Func< IAnimationContext, IViewAnimation > Factory, IReadOnlyDictionary< string, object >? Metadata=null)
Initializes a new instance of the ViewAnimationDescriptor class.
Represents contextual information required when executing an animation.
Defines a transition animation executor.
Defines a view-based animation executor.
AnimationCompositionMode
Defines how composite animations should execute child animations.
Represents a strongly typed key used for identifying animations.