xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Path Animation" Height="500" Width="518">
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Namespace WpfApplication1
Public Partial Class PathAnimationExample
Inherits Window
Public Sub New()
InitializeComponent()
path2.Freeze()
' For performance benefits.
Dim daPath As New DoubleAnimationUsingPath()
daPath.Duration = TimeSpan.FromSeconds(5)
daPath.RepeatBehavior = RepeatBehavior.Forever
daPath.AccelerationRatio = 0.6
daPath.DecelerationRatio = 0.4
daPath.AutoReverse = True
daPath.PathGeometry = path2
daPath.Source = PathAnimationSource.X
circle2.BeginAnimation(Canvas.LeftProperty, daPath)
daPath = New DoubleAnimationUsingPath()
daPath.Duration = TimeSpan.FromSeconds(5)
daPath.RepeatBehavior = RepeatBehavior.Forever
daPath.AccelerationRatio = 0.6
daPath.DecelerationRatio = 0.4
daPath.AutoReverse = True
daPath.PathGeometry = path2
daPath.Source = PathAnimationSource.Y
circle2.BeginAnimation(Canvas.TopProperty, daPath)
End Sub
End Class
End Namespace