[MainPage.xaml]


<UserControl x:Class="RiaPointAnimation.MainPage"

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

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

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Canvas Background="White" Width="400" Height="300">

        <!--[1] 스토리보드 정의-->

        <Canvas.Triggers>

            <EventTrigger RoutedEvent="Canvas.Loaded">

                <BeginStoryboard>

                    <Storyboard>

                        <PointAnimation

                            Storyboard.TargetName="line"

                            Storyboard.TargetProperty="EndPoint"

 

                            Duration="0.0:0:2.0"

                            From="100, 100"

                            To="100, 50"

                            AutoReverse="True"

                            RepeatBehavior="2x"

                        />

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Canvas.Triggers>

        <!--[2] 대상 요소 정의 : 라인-->

        <Path Fill="Black" Stroke="Black">

            <Path.Data>

                <LineGeometry x:Name="line" StartPoint="50, 50" EndPoint="100, 100" />

            </Path.Data>

        </Path>

    </Canvas>

</UserControl>

 

 























Posted by holland14
: