[英]c# wpf rotate animation for pie slice (drawn using PathGeometry)
无论如何,我有没有为PathGeometry制作一个旋转动画,该动画包含从角度A到角度B的弧段和线段(扇形)?
PathGeometry是使用c#而不是xaml绘制的,因此将赞赏使用c#而不是xaml的答案,并且需要在加载动画时播放动画。
不知道我是否缺少某些东西:您能否仅将RotateTransform
应用于Transform
,然后为Angle
属性设置动画? 例如:
<Path Stroke="Black" StrokeThickness="5" Width="100" Height="100">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="RotationStates">
<VisualState x:Name="RotatingState">
<Storyboard Duration="0:0:1" RepeatBehavior="Forever" AutoReverse="True">
<DoubleAnimation Storyboard.TargetName="rotateTransform"
Storyboard.TargetProperty="Angle"
To="45"
/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<ei:GoToStateAction StateName="RotatingState" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Path.Data>
<PathGeometry>
<PathGeometry.Transform>
<RotateTransform x:Name="rotateTransform" Angle="0" />
</PathGeometry.Transform>
<PathFigure StartPoint="10,10">
<LineSegment Point="50,0" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.