ZoomPanelZoomPanelAnimator Field |
Namespace: Ab2d.Controls
By default the ZoomPanelAnimator is set to ZoomPanelQuinticAnimator. This animator provides some animation easing.
To use simple linear animation use the ZoomPanelLinearAnimator class.
It is possible to provide custom animations with deriving a class from BaseZoomPanelAnimator and setting its instance to the ZoomPanelAnimator property.
The classes that derive from BaseZoomPanelAnimator must override abstract CalculateValue method. Additional animation customizations are possible with overriding the CalculateViewboxAndRotationAngle method.
The following class defines a simple sine animation:
public class ZoomPanelSineAnimator : BaseZoomPanelAnimator { public override double CalculateValue(double startValue, double endValue, double progress) { double middleValue = (endValue - startValue) / 2; if (progress < 0.5) return (1 - Math.Cos(progress * Math.PI)) * middleValue + startValue; else return Math.Sin((progress - 0.5) * Math.PI) * middleValue + startValue + middleValue; } }