0
Answer

WPF MatrixAnimationUsingPath

Red Naw

Red Naw

16y
4.1k
1
Hi

I´m trying to make an ellipse move along a path and there are some things I don´t get. What I don´t get is the positioning of the ellipse path. It moves along the path but not on the path. Actully it moves like an inch below. Why? They have the same pathgeo. Can anyone help me out?

I just have an ellipse and a path in my wpf app and the code looks like this.

private void button1_Click(object sender, RoutedEventArgs e)
{
   MatrixAnimationUsingPath anima = new MatrixAnimationUsingPath();
   MatrixTransform xform = new MatrixTransform();
   PathGeometry pathGeo = path1.Data.GetFlattenedPathGeometry();
   e1.RenderTransform = xform;
   anima.PathGeometry = pathGeo;
   anima.BeginTime = TimeSpan.FromSeconds(0);
   xform.BeginAnimation(MatrixTransform.MatrixProperty, anima);
}

Rednaw