15 private object? _target;
16 private float _elapsedSeconds;
24 float durationSeconds,
38 public Guid
Id {
get; } = Guid.NewGuid();
52 internal object Target => _target
53 ??
throw new InvalidOperationException(
"The effect has not been started.");
55 internal abstract EffectChannel Channel {
get; }
57 internal abstract bool SupportsTarget(
object target);
66 ?? throw new InvalidOperationException(
67 $
"{GetType().Name} cannot operate on target type {Target.GetType().Name}.");
72 throw new InvalidOperationException(
"An effect instance can only be started once.");
91 internal bool AdvanceInternal(
float deltaSeconds)
96 _elapsedSeconds = Math.Min(
98 _elapsedSeconds + Math.Max(0f, deltaSeconds));
116 public void Cancel() => _owner?.Cancel(
this);
118 internal void CancelInternal(
bool restoreState)
131 private void CompleteInternal()
168internal enum EffectChannel
virtual void OnCompleted()
Runs the effect-specific completion behavior.
float DurationSeconds
Gets the requested effect duration in seconds.
void RestoreOriginalState()
Restores the target state captured when the effect started.
DisplayEffect(float durationSeconds, EasingKind easing=EasingKind.Linear)
Initializes a new instance of the DisplayEffect class.
Action< DisplayEffect >? Cancelled
Occurs when the effect is cancelled or replaced.
TTarget GetTarget< TTarget >()
Gets the effect target as the requested reference type.
void Cancel()
Cancels the effect and restores the presentation state that existed when it began.
EffectStatus Status
Gets the current lifecycle state.
void ApplyProgress(float progress)
Applies the eased effect progress to the target.
EasingKind Easing
Gets the easing curve used to transform normalized progress.
virtual void OnStarting()
Captures or prepares target state before the effect starts.
float Progress
Gets the normalized, uneased progress in the range 0 through 1.
Action< DisplayEffect >? Completed
Occurs when the effect reaches its requested duration.
Guid Id
Gets the effect's unique identifier.
Owns and advances display effects for one RenderSurfaceHost.
EffectStatus
Describes the current lifecycle state of a display effect.
@ Completed
The effect reached its requested duration.
EasingKind
Enumeration of all supported easing functions for animation and movement interpolation....