* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
2.7 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|
| How to: Rotate an Object by Using a Geometric Path | 03/30/2017 |
|
|
cb31ca4d-f05a-4c6b-9a18-4b6faaf38d45 |
How to: Rotate an Object by Using a Geometric Path
This example shows how to rotate (pivot) an object along a geometric path that is defined by a xref:System.Windows.Media.PathGeometry object.
Example
The following example uses three xref:System.Windows.Media.Animation.DoubleAnimationUsingPath objects to move a rectangle along a geometric path.
-
The first xref:System.Windows.Media.Animation.DoubleAnimationUsingPath animates a xref:System.Windows.Media.RotateTransform that is applied to the rectangle. The animation generates angle values. It makes the rectangle rotate (pivot) along the contours of the path.
-
The other two objects animate the xref:System.Windows.Media.TranslateTransform.X%2A and xref:System.Windows.Media.TranslateTransform.Y%2A values of a xref:System.Windows.Media.TranslateTransform that is applied to the rectangle. They make the rectangle move horizontally and vertically along the path.
[!code-xamlPathAnimationGallery_snippet#RotateAnimationUsingPathWholePage]
[!code-csharpPathAnimationGallery_procedural_snip#RotateAnimationUsingPathWholePage] [!code-vbPathAnimationGallery_procedural_snip#RotateAnimationUsingPathWholePage]
Another way to rotate an object by using a geometric path is to use a xref:System.Windows.Media.Animation.MatrixAnimationUsingPath object and set its xref:System.Windows.Media.Animation.MatrixAnimationUsingPath.DoesRotateWithTangent%2A property to true. For more information and an example, see Rotate an Object by Using a Geometric Path (Matrix Animation).
For the complete sample, see Path Animation Sample.