■ DoubleAnimationUsingPath 엘리먼트 사용하기

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

 

<Window

    x:Class="TestProject.MainWindow"

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

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

    Width="600"

    Height="450"

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

    <Canvas>

        <Canvas.Resources>

            <PathGeometry x:Key="path"

                Figures="M 96 192 C 288 0, 384 384, 576 192" />

        </Canvas.Resources>

        <Path Stroke="Black" Data="{StaticResource PathGeomertyKey}" />

        <Button Name="button" Content="버튼" />

        <Canvas.Triggers>

            <EventTrigger RoutedEvent="Canvas.Loaded">

                <BeginStoryboard>

                    <Storyboard TargetName="button">

                        <DoubleAnimationUsingPath

                            Storyboard.TargetProperty="(Canvas.Left)"

                            RepeatBehavior="Forever"

                            AutoReverse="True"

                            Duration="0:0:2.5"

                            Source="X"

                            PathGeometry="{StaticResource PathGeomertyKey}" />

                        <DoubleAnimationUsingPath

                            Storyboard.TargetProperty="(Canvas.Top)"

                            RepeatBehavior="Forever"

                            AutoReverse="True"

                            Duration="0:0:2.5"

                            Source="Y"

                            PathGeometry="{StaticResource PathGeomertyKey}" />

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Canvas.Triggers>

    </Canvas>

</Window>

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

Posted by 사용자 icodebroker

댓글을 달아 주세요