Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
Animation Silverlight-贝塞尔曲线线绘制动画?_Animation_Silverlight_Bezier - Fatal编程技术网

Animation Silverlight-贝塞尔曲线线绘制动画?

Animation Silverlight-贝塞尔曲线线绘制动画?,animation,silverlight,bezier,Animation,Silverlight,Bezier,我正在构建一个小的Silverlight应用程序。在我的应用程序中,我需要画线,类似于所附图像中显示的内容 我知道绘制拱形连接线(绿色连接线)的最佳方法是使用贝塞尔曲线 我的问题是,如何设置线条绘制的动画(使它们从起始(X,Y)坐标开始,到目标坐标) 附图: 我花了一点时间玩这个,这是可能的。诀窍是不设置路径的动画。相反,首先将路径剪裁到零维的边界区域,然后基本上设置剪裁区域的高度和宽度的动画。最终效果看起来像是从点A到点B对路径设置动画 请看下面的XAML示例: <Canvas x:Na

我正在构建一个小的Silverlight应用程序。在我的应用程序中,我需要画线,类似于所附图像中显示的内容

我知道绘制拱形连接线(绿色连接线)的最佳方法是使用贝塞尔曲线

我的问题是,如何设置线条绘制的动画(使它们从起始(X,Y)坐标开始,到目标坐标)

附图:


我花了一点时间玩这个,这是可能的。诀窍是不设置路径的动画。相反,首先将路径剪裁到零维的边界区域,然后基本上设置剪裁区域的高度和宽度的动画。最终效果看起来像是从点A到点B对路径设置动画

请看下面的XAML示例:

<Canvas x:Name="LayoutRoot" Background="White">
        <Path Stroke="Blue" StrokeThickness="2" StrokeDashArray="10,2" >
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="50,50">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                       <BezierSegment
                                           Point1="50,20"
                                           Point2="120,170"
                                           Point3="350,150"
                                       /> 
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
            <Path.Clip>
                <PathGeometry>
                    <PathFigure IsClosed="true">
                        <LineSegment x:Name="seg1" Point="50,50"/>
                        <LineSegment x:Name="seg2" Point="0,0"/>
                        <LineSegment x:Name="seg3" Point="0,0"/>
                        <LineSegment x:Name="seg4" Point="0,0"/>
                    </PathFigure>
                </PathGeometry>
            </Path.Clip>
            <Path.Triggers>
                <EventTrigger RoutedEvent="Path.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <PointAnimation Storyboard.TargetName="seg2" Storyboard.TargetProperty="point" To="350,50" Duration="0:0:2" />
                            <PointAnimation Storyboard.TargetName="seg3" Storyboard.TargetProperty="point" To="350,150" Duration="0:0:2" />
                            <PointAnimation Storyboard.TargetName="seg4" Storyboard.TargetProperty="point" To="50,1500" Duration="0:0:2" />

                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Path.Triggers>
        </Path>
        <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <EllipseGeometry Center="50,50" RadiusX="20" RadiusY="20" />
            </Path.Data>
        </Path>
        <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <EllipseGeometry Center="350,150" RadiusX="20" RadiusY="20" />
            </Path.Data>
        </Path>
    </Canvas>

很乐意帮忙。请随时回答其他问题。