[C#/WPF] DrawingBrush 엘리먼트 : EllipseGeometry 객체의 크기를 변경해 애니메이션 만들기
■ DrawingBrush 엘리먼트에서 EllipseGeometry 객체의 크기를 변경해 애니메이션을 만드는 방법을 보여준다. ▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
<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="DrawingBrush 엘리먼트 : EllipseGeometry 객체의 크기를 변경해 애니메이션 만들기" FontFamily="나눔고딕코딩" FontSize="16"> <Window.Background> <DrawingBrush TileMode="Tile" Stretch="None" Viewport="0 0 12 12" ViewportUnits="Absolute"> <DrawingBrush.Drawing> <GeometryDrawing Brush="Red"> <GeometryDrawing.Geometry> <EllipseGeometry x:Name="ellipseGeometry" Center="0 0" /> </GeometryDrawing.Geometry> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Window.Background> <Window.Triggers> <EventTrigger RoutedEvent="Window.Loaded"> <BeginStoryboard> <Storyboard TargetName="ellipseGeometry" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetProperty="RadiusX" AutoReverse="True" Duration="0:0:0.25" From="4" To="6" /> <DoubleAnimation Storyboard.TargetProperty="RadiusY" AutoReverse="True" Duration="0:0:0.25" From="4" To="6" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Window.Triggers> </Window> |
TestProject.zip