I have created the following XAML
<Canvas Background="Gray" Margin="10">
<Ellipse x:Name="Node1" Width="20" Height="20" Fill="AliceBlue" Canvas.Left="38" Canvas.Top="136" />
<Ellipse x:Name="Node2" Width="20" Height="20" Fill="AliceBlue" Canvas.Left="290" Canvas.Top="136" />
<Ellipse x:Name="object" Width="10" Height="20" Fill="Black" Canvas.Left="43" Canvas.Top="125" />
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="50,145">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="100,100" />
<LineSegment Point="250,100" />
<LineSegment Point="300,145" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Canvas>
As you can see, I have created 2 elliptical Nodes. A path connecting the two nodes and an object sitting at node 1. All I want to do here is to animate the object at node1 along the path towards node2.
I am trying to do the animation using code as I want the animation to happen on click of the node2. I have been struggling with DoubleAnimation, MatrixAnimation,storyboard..Very confusing. Please share you knowledge on how to achieve this. I am hoping the same code would work with curves and complex paths.