public static DoubleAnimation CreateDouble(double? to, Duration duration, string targetProperty) { var animation = new DoubleAnimation { To = to, Duration = duration, EnableDependentAnimation = true }; Storyboard.SetTargetProperty(animation, targetProperty); return animation; }
public static void BeginDoubleAnimation(this DependencyObject target, string path, double? to, Duration duration) { var animation = new DoubleAnimation { To = to, Duration = duration, EnableDependentAnimation = true }; target.BeginAnimation(animation, path); }
public static ColorAnimation CreateColor(Color to, Duration duration, string targetProperty) { var animation = new ColorAnimation { To = to, Duration = duration, EnableDependentAnimation = true }; Storyboard.SetTargetProperty(animation, targetProperty); return animation; }
public static void CreateCanvasStoryBoardAndBegin(this DependencyObject target, double? toX, double? toY, Duration duration) { var xAnimation = CreateDouble(toX, duration, "(Canvas.Left)"); var yAnimation = CreateDouble(toY, duration, "(Canvas.Top)"); CreateStoryBoardAndBegin(target, xAnimation, yAnimation); }
public static void BeginPointAnimation(this DependencyObject target, string path, Point to, Duration duration) { var animation = CreatePoint(to, duration, path); target.BeginAnimation(animation, path); }
public static void BeginColorAnimation(this DependencyObject target, string path, Color to, Duration duration) { var animation = CreateColor(to, duration, path); target.BeginAnimation(animation, path); }
public static void CreateY1Y2StoryBoardAndBegin(this DependencyObject target, double? toY1, double? toY2, Duration duration) { var y1Animation = CreateDouble(toY1, duration, nameof(Line.Y1)); var y2Animation = CreateDouble(toY2, duration, nameof(Line.Y2)); CreateStoryBoardAndBegin(target, y1Animation, y2Animation); }
public static PointAnimation CreatePoint(Point from, Point to, Duration duration, string targetProperty) { var animation = new PointAnimation { From = from, To = to, Duration = duration }; Storyboard.SetTargetProperty(animation, targetProperty); return animation; }