I am trying to do a countdown circle. But I just cannot get it working. What I can do is to create a filling circle, but not one for countdown. Hopefully code will be clear. What I am trying to do is exactly what reverse animation does ( commented in code )
<UserControl.Triggers>
<EventTrigger RoutedEvent="Page.Loaded">
<BeginStoryboard>
<Storyboard >
<!--RepeatBehavior="Forever"
AutoReverse="True" >-->
<PointAnimationUsingPath
Storyboard.TargetName="arc"
Storyboard.TargetProperty="Point"
Duration="0:0:5">
<PointAnimationUsingPath.PathGeometry>
<PathGeometry>
<PathFigure StartPoint="200 100">
<ArcSegment Size="100 100" Point="200 300" SweepDirection="Clockwise" />
<ArcSegment Size="100 100" Point="200 100" SweepDirection="Clockwise" />
</PathFigure>
</PathGeometry>
</PointAnimationUsingPath.PathGeometry>
</PointAnimationUsingPath>
<BooleanAnimationUsingKeyFrames
Storyboard.TargetName="arc"
Storyboard.TargetProperty="IsLargeArc">
<DiscreteBooleanKeyFrame KeyTime="0:0:2.5" Value="True" />
<DiscreteBooleanKeyFrame KeyTime="0:0:5" Value="False" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Path Stroke="Blue" StrokeThickness="3" Fill="Transparent">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="200 100" IsClosed="False">
<ArcSegment x:Name="arc" Size="100 100" SweepDirection="Clockwise" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
我终于设法只使用一个ArcSegment动画点来解决它,该动画点的端点与起始点的偏差为.01,并且为IsLargeArc改变了离散布尔动画的时间,尽管我体验到ArcSegment有时在不更改代码的情况下表现有所不同。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.