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

■ DrawingBrush 엘리먼트에서 EllipseGeometry 객체의 크기를 변경해 애니메이션을 만드는 방법을 보여준다.

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="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>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요