첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ PointAnimationUsingKeyFrames 엘리먼트를 사용해 공을 튕기는 방법을 보여준다.

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="PointAnimationUsingKeyFrames 엘리먼트 : 공 튕기기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <Canvas
            Width="480"
            Height="480">
            <Rectangle
                Width="480"
                Height="480"
                Stroke="Black" />
            <Path
                Fill="Aqua"
                Stroke="Chocolate"
                StrokeThickness="3">
                <Path.Data>
                    <EllipseGeometry x:Name="ellipseGeometry"
                        Center="240 50"
                        RadiusX="48"
                        RadiusY="48" />
                </Path.Data>
            </Path>
            <Canvas.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                    <BeginStoryboard>
                        <Storyboard
                            TargetName="ellipseGeometry"
                            TargetProperty="Center">
                            <PointAnimationUsingKeyFrames
                                RepeatBehavior="Forever"
                                Duration="0:0:4">
                                <LinearPointKeyFrame KeyTime="0:0:1" Value="430 240" />
                                <LinearPointKeyFrame KeyTime="0:0:2" Value="240 430" />
                                <LinearPointKeyFrame KeyTime="0:0:3" Value="50 240"  />
                                <LinearPointKeyFrame KeyTime="0:0:4" Value="240 50"  />
                            </PointAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Canvas.Triggers>
        </Canvas>
    </Grid>
</Window>
728x90
그리드형(광고전용)
Posted by icodebroker
,