■ DoubleAnimationUsingKeyFrames 엘리먼트 사용하기

----------------------------------------------------------------------------------------------------

 

<Window

    x:Class="TestProject.MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:s="clr-namespace:System;assembly=mscorlib"

    xmlns:src="clr-namespace:TestProject"

    Width="800"

    Height="600"

    Title="DoubleAnimationUsingKeyFrames 엘리먼트 사용하기">

    <Canvas>

        <Line

            X1="0"

            Y1="506"

            X2="1000"

            Y2="506"

            Stroke="Black"

            StrokeThickness="5" />

        <Ellipse Name="elips" Canvas.Left="96"

            Width="24"

            Height="24"

            Fill="Red">

            <Ellipse.Triggers>

                <EventTrigger RoutedEvent="Ellipse.Loaded">

                    <BeginStoryboard>

                        <Storyboard

                            TargetName="elips"

                            TargetProperty="(Canvas.Top)"

                            RepeatBehavior="Forever">

                            <DoubleAnimationUsingKeyFrames>

                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="96"                              />

                                <SplineDoubleKeyFrame   KeyTime="0:0:1" Value="480" KeySpline="0.25 0, 0.6 0.2" />

                                <SplineDoubleKeyFrame   KeyTime="0:0:2" Value="96" KeySpline="0.75 1, 0.4 0.8" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                    </BeginStoryboard>

                </EventTrigger>

            </Ellipse.Triggers>

        </Ellipse>

    </Canvas>

</Window>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker