--- title: "How to: Animate an Object Along a Path (Matrix Animation)" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "animation [WPF], objects along paths (matrix animation)" - "matrix animation [WPF]" ms.assetid: 7000e697-1414-468c-b915-cf66062fc49e --- # How to: Animate an Object Along a Path (Matrix Animation) This example shows how to use the class to animate an object along a path that is defined by a . ## Example The following example animates an object along a path by doing the following: - Applies a to the object in order to move it. - Defines the path by using a . - Creates a and uses it to animate the property of the . The takes the and uses it to generate values. [!code-xaml[PathAnimationGallery_snippet#MatrixAnimationUsingPathWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/PathAnimationGallery_snippet/CS/matrixanimationusingpathexample.xaml#matrixanimationusingpathwholepage)] [!code-csharp[PathAnimationGallery_procedural_snip#MatrixAnimationUsingPathWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/PathAnimationGallery_procedural_snip/CSharp/MatrixAnimationUsingPathExample.cs#matrixanimationusingpathwholepage)] [!code-vb[PathAnimationGallery_procedural_snip#MatrixAnimationUsingPathWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/PathAnimationGallery_procedural_snip/VisualBasic/MatrixAnimationUsingPathExample.vb#matrixanimationusingpathwholepage)] For the complete sample, see [Path Animation Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Animation/PathAnimations). For more information about geometric paths, see the [Geometry Overview](geometry-overview.md). ## See also - [Animation Overview](animation-overview.md) - [Path Animation Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Animation/PathAnimations) - [Path Animation How-to Topics](path-animation-how-to-topics.md)