728x90
728x170
■ PointAnimationUsingKeyFrames 엘리먼트를 사용해 공을 튕기는 방법을 보여준다.
▶ 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
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] DependencyPropertyDescriptor 클래스 : 의존 속성 변경시 이벤트 핸들러 추가하기 (0) | 2015.10.10 |
---|---|
[C#/WPF] DynamicResource 엘리먼트 : 리소스 사용하기 (0) | 2015.10.10 |
[C#/WPF] ColorAnimationUsingKeyFrames 엘리먼트 사용하기 (0) | 2015.10.08 |
[C#/WPF] StringAnimationUsingKeyFrames 엘리먼트 : 문자열 교대로 표시하기 (0) | 2015.10.08 |
[C#/WPF] DoubleAnimationUsingKeyFrames 엘리먼트 : 문자열 교대로 표시하기 (0) | 2015.10.08 |
[C#/WPF] DoubleAnimation 엘리먼트 : 진자 운동 애니메이션 만들기 (0) | 2015.10.07 |
[C#/WPF] Binding 태그 확장 : RelativeSource 속성에서 RelativeSource 태그 확장을 사용해 상위 엘리먼트 속성 바인딩하기 (0) | 2015.10.07 |
[C#/WPF] Thumb 클래스 : 크기 조절 그립 사용하기 (0) | 2015.10.06 |
[C#/WPF] TextBox 클래스 : TextInput 이벤트 사용하기 (0) | 2015.10.02 |
[C#/WPF] TextBox 엘리먼트 : 한글 입력 모드 설정하기 (0) | 2015.10.02 |