Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在WPF中设置圆弧段动画_C#_Wpf_Animation_Wpf Animation - Fatal编程技术网

C# 在WPF中设置圆弧段动画

C# 在WPF中设置圆弧段动画,c#,wpf,animation,wpf-animation,C#,Wpf,Animation,Wpf Animation,如何在WPF中设置圆弧段的动画。以下是所附代码 PathGeometry pg = new PathGeometry(); PathFigure pf = new PathFigure(); LineSegment ls1 = new LineSegment(); LineSegment ls2 = new LineSegment(); ArcSegment arc = new ArcSegment(); double xc = canvas.Width / 2 - 50 + dx; doubl

如何在WPF中设置圆弧段的动画。以下是所附代码

PathGeometry pg = new PathGeometry();
PathFigure pf = new PathFigure();
LineSegment ls1 = new LineSegment();
LineSegment ls2 = new LineSegment();
ArcSegment arc = new ArcSegment();
double xc = canvas.Width / 2 - 50 + dx;
double yc = canvas.Height / 2 + dy;
double r = 0.7 * xc;   // To control the Explosion generally for all the slices 
pf.IsClosed = true;
pf.StartPoint = new Point(xc, yc);
pf.Segments.Add(ls1);
pf.Segments.Add(arc);
pf.Segments.Add(ls2);
pg.Figures.Add(pf);
path.Data = pg;
arc.IsLargeArc = isLargArc;

ls1.Point = new Point(xc + r * Math.Cos(startAngle), yc + r * Math.Sin(startAngle));
arc.SweepDirection = SweepDirection.Clockwise;

arc.Point = new Point(xc + r * Math.Cos(endAngle), yc + r * Math.Sin(endAngle));
arc.Size = new Size(r, r);
ls2.Point = new Point(xc + r * Math.Cos(endAngle), yc + r * Math.Sin(endAngle));

Duration duration = new Duration(TimeSpan.FromSeconds(5));

pau = new PointAnimationUsingPath();
pau.PathGeometry = pg;
pau.FillBehavior = FillBehavior.Stop;
pau.Duration = new Duration(TimeSpan.FromSeconds(5));


我试图让弧段从一个位置移动到另一个位置,如图所示。有一个弧段列表,这些弧段一个接一个地设置动画。

您可以使用
序列图像板
类设置动画。例如,您可以设置位置动画和
RenderTransform
它应该可以工作