첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ DoubleAnimationUsingKeyFrames 엘리먼트 : 공 떨어뜨리기

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


TestProject.zip



MainWindow.xaml

 

 

<Window x:Class="TestProject.MainWindow"

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

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

    Width="800"

    Height="600"

    Title="DoubleAnimationUsingKeyFrames 엘리먼트 : 공 떨어뜨리기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Canvas>

        <Line

            X1="0"

            Y1="506"

            X2="1000"

            Y2="506"

            Stroke="Black"

            StrokeThickness="5" />

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

            Width="24"

            Height="24"

            Fill="Red">

            <Ellipse.Triggers>

                <EventTrigger RoutedEvent="Ellipse.Loaded">

                    <BeginStoryboard>

                        <Storyboard

                            TargetName="ellipse"

                            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

댓글을 달아 주세요