PointAnimation use in WPF with VB.NET

In this article, We will see how to use PointAnimation in WPF.
  • 2107
We will create an animation in Window Presentation Foundation, you must associate an animation with an object's property value. The PointAnimation  is a key frame animation. The animation move left and right. The animation updates the value of a property over a period of time.

We will use Duration, From, To, RepeatBehavior, Storyboard.TargetName and Storyboard.TargetProperty any property use in this example. The target values is From and To.

Example:-

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Canvas Margin="0,0,0,12">
            <Path Fill="PeachPuff" Margin="15,0,20,20">
                <Path.Data>                                      
                   
<EllipseGeometry x:Name="AnimatedEllipse" Center="20,40" RadiusX="30"
RadiusY="30" />
                </Path.Data>
                <Path.Triggers>
                    <EventTrigger RoutedEvent="Path.Loaded">
                        <BeginStoryboard Name="BeginStoryboard">
                            <Storyboard>
                                <PointAnimation Storyboard.TargetProperty="Center"
Storyboard.TargetName="AnimatedEllipse" Duration="0:0:5" From="30,30" To="278,262"
RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Path.Triggers>
            </Path>
        </Canvas>
    </Grid>
</
Window>

Deign Of application:-

PointAnimation2.bmp 

When you run the animation application, it moves smoothly from one value to another value.

Output:-

PointAnimation1.bmp

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.