Blog Content

    티스토리 뷰

    74.SilverLight3 - DiscreteKeyFrame

    반응형
    DiscreteKeyFrame
    -  분리된 애니메이션 실행,  초기값에서 지정된 값으로 갑자기 변경

    MainPage.xaml

    [그림 74-1]


    <Canvas x:Name="LayoutRoot">

        <Canvas.Resources>

            <Storyboard x:Name="mySb">

                <DoubleAnimationUsingKeyFrames

                    Storyboard.TargetName="myRect"

                    Storyboard.TargetProperty="Width">

                    <DiscreteDoubleKeyFrame KeyTime="0.0:0:1.0" Value="200">

                    </DiscreteDoubleKeyFrame>

                    <DiscreteDoubleKeyFrame KeyTime="0.0:0:2.0" Value="300">

                    </DiscreteDoubleKeyFrame>

                    <DiscreteDoubleKeyFrame KeyTime="0.0:0:3.0" Value="400">

                    </DiscreteDoubleKeyFrame>

                </DoubleAnimationUsingKeyFrames>

            </Storyboard>

        </Canvas.Resources>

        <!---->

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

                   Canvas.Top="0">

            <Rectangle.Fill>

                <SolidColorBrush Color="DodgerBlue"></SolidColorBrush>

            </Rectangle.Fill>

        </Rectangle>

    </Canvas>


    MainPage.xaml.cs

    namespace DiscreteKeyFrame

    {

        public partial class MainPage : UserControl

        {

            public MainPage()

            {

                InitializeComponent();

                this.myRect.MouseLeftButtonDown +=

                     new MouseButtonEventHandler(myRect_MouseLeftButtonDown);

            }

     

            void myRect_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

            {

                mySb.Begin();

            }

        }

    }


    결과화면
     

    [그림 74-2]



    반응형

    'Silverlight' 카테고리의 다른 글

    76.SilverLight3 - EasingKeyFrame  (0) 2009.12.04
    75.SilverLight3 - SplineKeyFrame  (0) 2009.12.04
    73.SilverLight3 - LinearKeyFrame  (0) 2009.12.04
    72.SilverLight3 - TimeLine  (0) 2009.12.03
    71.SilverLight3 - ColorAnimation  (0) 2009.12.03

    Comments