Silverlight

73.SilverLight3 - LinearKeyFrame

Godffs 2009. 12. 4. 09:07
반응형
LinearKeyFrame
- 선형 애니메이션을 실행, 속성값이 초기값으로 연속적으로 변경

MainPage.xaml

[그림 73-1]


<Canvas x:Name="LayoutRoot" Background="White">

    <!-- -->

    <Canvas.Resources>

        <Storyboard x:Name="mySb">

            <ColorAnimationUsingKeyFrames

                Storyboard.TargetName="myRect"

                Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"

                Duration="0:0:3">

                <ColorAnimationUsingKeyFrames.KeyFrames>

                    <LinearColorKeyFrame KeyTime="0:0:0" Value="Red">

                    </LinearColorKeyFrame>

                    <LinearColorKeyFrame KeyTime="0:0:1" Value="Blue">

                    </LinearColorKeyFrame>

                    <LinearColorKeyFrame KeyTime="0:0:2" Value="Green">

                    </LinearColorKeyFrame>

                    <LinearColorKeyFrame KeyTime="0:0:3" Value="Yellow">

                    </LinearColorKeyFrame>

                </ColorAnimationUsingKeyFrames.KeyFrames>

            </ColorAnimationUsingKeyFrames>

        </Storyboard>

    </Canvas.Resources>

    <!---->

    <Rectangle x:Name="myRect" Width="100" Height="100" Canvas.Left="50" Canvas.Top="50"

               Fill="Red"></Rectangle>

</Canvas>


결과화면

[그림 73-2]



반응형