Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
AnimationDescriptor.cs
1using System;
3using Microsoft.Maui.Controls;
4
6{
10 public abstract class AnimationDescriptor
11 {
19 protected AnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, IReadOnlyDictionary<string, object>? Metadata)
20 {
21 if (Duration <= TimeSpan.Zero)
22 throw new ArgumentOutOfRangeException(nameof(Duration), "Duration must be positive.");
23 this.Key = Key;
24 this.Duration = Duration;
25 this.Easing = Easing ?? throw new ArgumentNullException(nameof(Easing));
26 this.Metadata = Metadata ?? new Dictionary<string, object>();
27 }
28
32 public AnimationKey Key { get; }
33
37 public TimeSpan Duration { get; }
38
42 public Easing Easing { get; }
43
47 public IReadOnlyDictionary<string, object> Metadata { get; }
48 }
49
54 {
55 private readonly Func<IAnimationContext, IViewAnimation> factory;
56
65 public ViewAnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, Func<IAnimationContext, IViewAnimation> Factory, IReadOnlyDictionary<string, object>? Metadata = null)
66 : base(Key, Duration, Easing, Metadata)
67 {
68 this.factory = Factory ?? throw new ArgumentNullException(nameof(Factory));
69 }
70
77 {
78 ArgumentNullException.ThrowIfNull(Context);
79 return this.factory(Context);
80 }
81 }
82
87 {
88 private readonly Func<IAnimationContext, ITransitionAnimation> factory;
89
98 public TransitionAnimationDescriptor(AnimationKey Key, TimeSpan Duration, Easing Easing, Func<IAnimationContext, ITransitionAnimation> Factory, IReadOnlyDictionary<string, object>? Metadata = null)
99 : base(Key, Duration, Easing, Metadata)
100 {
101 this.factory = Factory ?? throw new ArgumentNullException(nameof(Factory));
102 }
103
110 {
111 ArgumentNullException.ThrowIfNull(Context);
112 return this.factory(Context);
113 }
114 }
115
120 {
124 Sequential,
125
129 Parallel
130 }
131}
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.
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.
Definition: AnimationKey.cs:7