■ MatrixAnimationUsingPath 엘리먼트 사용하기

----------------------------------------------------------------------------------------------------

 

<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="800"

    Title="MatrixAnimationUsingPath 엘리먼트 사용하기">

    <Canvas>

        <Canvas.Resources>

            <PathGeometry x:Key="PathGeometryKey"

                Figures="M 96 192 C 288 0, 384 384, 576 192 S 662 192 576 576 S 384 576 96 192" />

        </Canvas.Resources>

        <Path

            Stroke="Black"

            Data="{StaticResource PathGeometryKey}" />

        <Button

            Width="60"

            Height="25"

            Content="버튼">

            <Button.RenderTransform>

                <MatrixTransform x:Name="matrixTransform" />

            </Button.RenderTransform>

        </Button>

        <Canvas.Triggers>

            <EventTrigger RoutedEvent="Canvas.Loaded">

                <BeginStoryboard>

                    <Storyboard

                        RepeatBehavior="Forever">

                        <MatrixAnimationUsingPath

                            Storyboard.TargetName="matrixTransform"

                            Storyboard.TargetProperty="Matrix"

                            Duration="0:0:10"

                            PathGeometry="{StaticResource PathGeometryKey}"

                            DoesRotateWithTangent="True" />

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Canvas.Triggers>

    </Canvas>

</Window>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요