Class ViewportAnimation
Animates viewport transitions (pan and zoom).
public class ViewportAnimation : ICategorizedAnimation, IAnimation
- Inheritance
-
ViewportAnimation
- Implements
- Inherited Members
Constructors
ViewportAnimation(ViewportState, double, double, double, double, Func<double, double>?, Action?)
Creates a new viewport animation.
public ViewportAnimation(ViewportState viewport, double targetZoom, double targetOffsetX, double targetOffsetY, double duration = 0.3, Func<double, double>? easing = null, Action? onComplete = null)
Parameters
viewportViewportStateThe viewport to animate.
targetZoomdoubleTarget zoom level.
targetOffsetXdoubleTarget X offset.
targetOffsetYdoubleTarget Y offset.
durationdoubleAnimation duration in seconds.
easingFunc<double, double>Easing function (defaults to EaseOutCubic).
onCompleteActionCallback when animation completes.
Properties
AffectedNodeIds
Gets the IDs of nodes affected by this animation (if applicable).
public IReadOnlyCollection<string> AffectedNodeIds { get; }
Property Value
Category
Gets the category of this animation.
public AnimationCategory Category { get; }
Property Value
IsComplete
Gets whether the animation has completed.
public bool IsComplete { get; }
Property Value
Methods
Cancel()
Called when the animation completes or is cancelled.
public void Cancel()
CenterOn(ViewportState, Point, double, Func<double, double>?, Action?)
Creates a viewport animation to center on a canvas point.
public static ViewportAnimation CenterOn(ViewportState viewport, Point canvasPoint, double duration = 0.3, Func<double, double>? easing = null, Action? onComplete = null)
Parameters
viewportViewportStatecanvasPointPointdurationdoubleeasingFunc<double, double>onCompleteAction
Returns
FitToBounds(ViewportState, Rect, double, double, Func<double, double>?, Action?, double, double)
Creates a viewport animation to fit bounds in view.
public static ViewportAnimation FitToBounds(ViewportState viewport, Rect bounds, double padding = 50, double duration = 0.3, Func<double, double>? easing = null, Action? onComplete = null, double minZoom = 0.1, double maxZoom = 2)
Parameters
viewportViewportStateThe viewport to animate.
boundsRectThe bounds to fit.
paddingdoublePadding around the bounds.
durationdoubleAnimation duration in seconds.
easingFunc<double, double>Easing function.
onCompleteActionCallback when animation completes.
minZoomdoubleMinimum zoom level (default: 0.1).
maxZoomdoubleMaximum zoom level (default: 2.0).
Returns
Update(double)
Updates the animation with the elapsed time since the last frame.
public void Update(double deltaTime)
Parameters
deltaTimedoubleTime elapsed since last update in seconds.
ZoomTo(ViewportState, double, Point?, double, Func<double, double>?, Action?)
Creates a viewport animation to zoom to a level at a specific screen point.
public static ViewportAnimation ZoomTo(ViewportState viewport, double targetZoom, Point? zoomCenter = null, double duration = 0.2, Func<double, double>? easing = null, Action? onComplete = null)
Parameters
viewportViewportStateThe viewport to animate.
targetZoomdoubleTarget zoom level (will be clamped by viewport's SetZoomDirect).
zoomCenterPoint?Screen point to zoom towards.
durationdoubleAnimation duration in seconds.
easingFunc<double, double>Easing function.
onCompleteActionCallback when animation completes.