wpf按动画顺序绘制多条曲线

时间:2017-05-19 10:01:24

标签: c# wpf

我尝试创建一个动画,就像我们使用Touch ID扫描指纹一样,它绘制部分指纹,最后生成完整的指纹图像, like this 指纹svg路径的一部分如下:

<Path Stroke="Black" StrokeLineJoin="Round" Name="Path1">
           <Path.Data>
               <GeometryGroup >
                   <PathGeometry Figures="M211, 161 C 208, 133 224, 117 242, 114 C 257, 112 285, 118 293, 151 C 301, 191 295, 254 256, 296"></PathGeometry>
                   <PathGeometry Figures="M268, 199 C 271, 164 263, 136 246, 141 C 229, 147 242, 172 241, 199 C 239, 226 224, 257 211, 269"></PathGeometry>
                    <PathGeometry Figures="M250, 155 C 255, 171 260, 204 247, 234"></PathGeometry>
                    <PathGeometry Figures="M207, 321 C 226, 310 262, 281 275, 237"></PathGeometry>
                    <PathGeometry Figures="M301, 280 C 320, 245 327, 200 323, 165"></PathGeometry>
                    <PathGeometry Figures="M228, 384 C 238, 380 262, 365 277, 353"></PathGeometry>
                </GeometryGroup>
            </Path.Data> 

那么如何绘制指纹线动态?

1 个答案:

答案 0 :(得分:0)

PathFigureCollection pathFigureCollection = new PathFigureCollection();

// Create figures making up the fingerprint
PathFigure pathFigure = new PathFigure();

...

pathFigureCollection.Add(pathFigure);

...

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

Path1.Data = pathGeometry;