Blog Content

    티스토리 뷰

    76.SilverLight3 - EasingKeyFrame

    반응형


    MainPage.xaml

    [그림 76-1]


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

        <Canvas.Resources>

            <Storyboard x:Name="sb">

                <DoubleAnimationUsingKeyFrames

                    Storyboard.TargetName="myRect"

                    Storyboard.TargetProperty="(Canvas.Top)"

                    Duration="00:00:10">

                    <!-- -->

                    <EasingDoubleKeyFrame Value="400" KeyTime="00:00:10">

                        <EasingDoubleKeyFrame.EasingFunction>

                            <!--<SineEase></SineEase>-->  <!-- -->

                            <!--<ElasticEase></ElasticEase>-->  <!-- -->

                            <BounceEase></BounceEase>  <!-- -->

                        </EasingDoubleKeyFrame.EasingFunction>

                    </EasingDoubleKeyFrame>

                </DoubleAnimationUsingKeyFrames>

            </Storyboard>

        </Canvas.Resources>

        <Rectangle x:Name="myRect" Width="50" Height="50" Fill="DodgerBlue"></Rectangle>

    </Canvas>


    MainPage.xaml.cs

    namespace EasingKeyFrame

    {

        public partial class MainPage : UserControl

        {

            public MainPage()

            {

                InitializeComponent();

     

                myRect.MouseLeftButtonDown +=

                    new MouseButtonEventHandler(myRect_MouseLeftButtonDown);

            }

     

            void myRect_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

            {

                sb.Begin();

            }

        }

    }


    결과화면

    [그림 76-2]



    반응형

    Comments