/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="function">Type of easing equation</param> /// <param name="mode">type of easing mode</param> /// <param name="to">destination point</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> /// <returns></returns> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, PointEasingFunction function, PointEasingMode mode, Point to, int durationMS, EventHandler callbackFunc) { return AnimatePointEasingEquation(element, prop, function, mode, null, to, durationMS, callbackFunc); }
/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="function">Type of easing equation</param> /// <param name="mode">type of easing mode</param> /// <param name="to">destination point</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> /// <returns></returns> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, PointEasingFunction function, PointEasingMode mode, Point to, int durationMS, EventHandler callbackFunc) { return(AnimatePointEasingEquation(element, prop, function, mode, null, to, durationMS, callbackFunc)); }
/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="function">Type of easing equation</param> /// <param name="mode">type of easing mode</param> /// <param name="from">starting point</param> /// <param name="to">destination point</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> /// <returns></returns> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, PointEasingFunction function, PointEasingMode mode, Point? from, Point to, int durationMS, EventHandler callbackFunc) { Point defaultFrom = element.GetValue(prop) == null ? new Point(0,0) : (Point)element.GetValue(prop); AnimationTimeline anim = GetPointEasingAnimation(function, mode, from.GetValueOrDefault(defaultFrom), to, durationMS); return Animate(element, prop, anim, durationMS, null, null, callbackFunc); }
/// <summary> /// Setup the animation for the point /// </summary> /// <param name="element">Element to run the animation on</param> /// <param name="prop">Property to run the animation on</param> /// <param name="function">Type of easing equation</param> /// <param name="mode">type of easing mode</param> /// <param name="from">starting point</param> /// <param name="to">destination point</param> /// <param name="durationMS">duration of the animation in milliseconds</param> /// <param name="callbackFunc">callback function</param> /// <returns></returns> public static AnimationClock AnimatePointEasingEquation( DependencyObject element, DependencyProperty prop, PointEasingFunction function, PointEasingMode mode, Point?from, Point to, int durationMS, EventHandler callbackFunc) { Point defaultFrom = element.GetValue(prop) == null ? new Point(0, 0) : (Point)element.GetValue(prop); AnimationTimeline anim = GetPointEasingAnimation(function, mode, from.GetValueOrDefault(defaultFrom), to, durationMS); return(Animate(element, prop, anim, durationMS, null, null, callbackFunc)); }
/// <summary> /// Select the appropriate animation via switch /// </summary> /// <param name="function">function to swich on</param> /// <param name="mode">easing mode to use</param> /// <param name="from">Starting Point</param> /// <param name="to">End point</param> /// <param name="durationMS">duration of animation</param> /// <returns></returns> private static AnimationTimeline GetPointEasingAnimation(PointEasingFunction function, PointEasingMode mode, Point from, Point to, int durationMS) { AnimationTimeline returnTimeline = null; switch (function) { case PointEasingFunction.Quad: returnTimeline = new QuadPointEasingAnimation(from, to, mode, new Duration(new TimeSpan(0, 0, 0, 0, durationMS))); break; case PointEasingFunction.Expo: returnTimeline = new ExpoPointEasingAnimation(from, to, mode, new Duration(new TimeSpan(0, 0, 0, 0, durationMS))); break; default: break; } return(returnTimeline); }
/// <summary> /// Select the appropriate animation via switch /// </summary> /// <param name="function">function to swich on</param> /// <param name="mode">easing mode to use</param> /// <param name="from">Starting Point</param> /// <param name="to">End point</param> /// <param name="durationMS">duration of animation</param> /// <returns></returns> private static AnimationTimeline GetPointEasingAnimation(PointEasingFunction function, PointEasingMode mode, Point from, Point to, int durationMS) { AnimationTimeline returnTimeline = null; switch (function) { case PointEasingFunction.Quad: returnTimeline = new QuadPointEasingAnimation(from, to, mode, new Duration(new TimeSpan(0, 0, 0, 0, durationMS))); break; case PointEasingFunction.Expo: returnTimeline = new ExpoPointEasingAnimation(from, to, mode, new Duration(new TimeSpan(0, 0, 0, 0, durationMS))); break; default: break; } return returnTimeline; }