Simple Path Animation : Path Animation « Windows Presentation Foundation « C# / CSharp Tutorial






<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Path Fill="Blue">
        <Path.Data>
            <EllipseGeometry x:Name="elips"
                             RadiusX="12" RadiusY="12" />
        </Path.Data>

        <Path.Triggers>
            <EventTrigger RoutedEvent="Path.Loaded">
                <BeginStoryboard>
                    <Storyboard TargetName="elips" TargetProperty="Center">
                        <PointAnimationUsingPath Duration="0:0:2.5" 
                                                 AutoReverse="True"
                                                 RepeatBehavior="Forever">
                            <PointAnimationUsingPath.PathGeometry>
                                <PathGeometry 
                                    Figures="M 6 288 C 576 0, 0 0, 480 288" />
                            </PointAnimationUsingPath.PathGeometry>
                        </PointAnimationUsingPath>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Path.Triggers>
    </Path>
</Canvas>
WPF Simple Path Animation








24.112.Path Animation
24.112.1.Animation along a pathAnimation along a path
24.112.2.Simple Path AnimationSimple Path Animation
24.112.3.Start the animation with Path is loadedStart the animation with Path is loaded
24.112.4.Path animation by code, duration, RepeatBehaviorPath animation by code, duration, RepeatBehavior