c#wpf双动画/故事板属性路径

c#wpf双动画/故事板属性路径,c#,wpf,storyboard,doubleanimation,C#,Wpf,Storyboard,Doubleanimation,我试图慢慢地为曲线设置动画,但我不知道如果我想让它从起点设置动画到X2,Y2点,我应该使用什么属性路径 private void DrawLine(Canvas canvas, double X1, double Y1, double X2, double Y2, Brush color) { QuadraticBezierSegment qbs = new QuadraticBezierSegment(new Point(X2, Y1), new Point(X2, Y2), t

我试图慢慢地为曲线设置动画,但我不知道如果我想让它从起点设置动画到X2,Y2点,我应该使用什么属性路径

private void DrawLine(Canvas canvas, double X1, double Y1, double X2, double  Y2, Brush color)
{
    QuadraticBezierSegment qbs = new QuadraticBezierSegment(new Point(X2,   Y1), new Point(X2, Y2), true);

    PathSegmentCollection pscollection = new PathSegmentCollection();
    pscollection.Add(qbs);

    PathFigure pf = new PathFigure();
    pf.Segments = pscollection;
    pf.StartPoint = new Point(X1, Y1);

    PathFigureCollection pfcollection = new PathFigureCollection();
    pfcollection.Add(pf);

    PathGeometry pathGeometry = new PathGeometry();
    pathGeometry.Figures = pfcollection;

    Path path = new Path();
    path.Data = pathGeometry;
    path.Stroke = color;
    path.StrokeThickness = 1;
    canvas.Children.Add(path);

    Storyboard story = new Storyboard();

    DoubleAnimation dAnim1 = new DoubleAnimation(Y1, Y2, new Duration(new TimeSpan(0, 0, 0, 0, 750)));
    DoubleAnimation dAnim2 = new DoubleAnimation(X1, X2, new Duration(new TimeSpan(0, 0, 0, 0, 750)));

    Storyboard.SetTargetProperty(dAnim1, new PropertyPath("???"));
    Storyboard.SetTargetProperty(dAnim2, new PropertyPath("???"));
    story.Children.Add(dAnim1);
    story.Children.Add(dAnim2);

    path.BeginStoryboard(story);

}

当你不告诉我们你想制作哪个对象的哪些属性时,你希望我们如何帮助你?编辑,我忘了。WPF中没有动画可以做到这一点。您可以使用Dispatcher定期向PathGeometry添加数据。在我尝试绘制此曲线之前,我只绘制了一条线并设置了动画,曲线是否会使此过程更加困难?如果是这样的话,我可能会返回到只画一条线。当你不告诉我们你想要动画的对象的哪些属性时,你希望我们如何帮助你?编辑,我忘记了。WPF中没有动画可以做到这一点。您可以使用Dispatcher定期向PathGeometry添加数据。在我尝试绘制此曲线之前,我只绘制了一条线并设置了动画,曲线是否会使此过程更加困难?如果是这样的话,我可能会回到只画一条线。