Private Sub AnimateLine(ByVal myLine As Line, ByVal p1 As Windows.Point, ByVal p2 As Windows.Point)
Dim daX As DoubleAnimation = New DoubleAnimation(p1.X, p2.X, New Windows.Duration(TimeSpan.FromSeconds(3)))
daX.RepeatBehavior = RepeatBehavior.Forever
daX.AutoReverse = True
myLine.BeginAnimation(Line.X2Property, daX)
Dim daY As DoubleAnimation = New DoubleAnimation(p1.Y, p2.Y, New Windows.Duration(TimeSpan.FromSeconds(3)))
daY.RepeatBehavior = RepeatBehavior.Forever
daY.AutoReverse = True
myLine.BeginAnimation(Line.Y2Property, daY)
End Sub
'Enjoy IT!