0

角度 A から角度 B までの円弧と線分 (パイ) で構成される PathGeometry の回転アニメーションを作成する方法はありますか?

PathGeometry は xaml の代わりに c# を使用して描画されるため、xaml の代わりに c# での回答が高く評価され、読み込まれたときにアニメーションを再生する必要があります。

4

1 に答える 1

0

何か不足しているかどうかわかりません。 に適用RotateTransformしてTransformAngleプロパティをアニメーション化することはできませんか? 例えば:

<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>
于 2014-07-30T18:57:14.767 に答える