2

LinearGradientBrush の StartPoint または EndPoint をアニメーション化することは可能ですか? もしそうなら、ポイントをアニメーション化するために使用される Storyboard オブジェクトのタイプは何ですか?次を試してみると、「0,1」は Double の有効な値ではありません。タイプ。

現在のコード:

<UserControl.Triggers>
    <EventTrigger RoutedEvent="UserControl.Loaded">
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="Path1" 
                                           Storyboard.TargetProperty="(Path.Stroke).(LinearGradientBrush.StartPoint)">
                    <SplineDoubleKeyFrame KeyTime="00:00:0" Value="0,1"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:2" Value=".5,.5"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:4" Value="1,0"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:6" Value=".5,.5"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="Path1" 
                                           Storyboard.TargetProperty="(Path.Stroke).(LinearGradientBrush.EndPoint)">
                    <SplineDoubleKeyFrame KeyTime="00:00:0" Value="1,0"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:2" Value=".5,.5"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:4" Value="0,1"/>
                    <SplineDoubleKeyFrame KeyTime="00:00:6" Value=".5,.5"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</UserControl.Triggers>
4

1 に答える 1

2

はい。上記の例では、「PointAnimationUsingKeyFrames」と「SplinePointKeyFrame」を使用してください。それはうまくいくはずです。

于 2010-09-09T19:58:41.757 に答える