* 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.9 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|
| How to: Animate an Object Along a Path (Point Animation) | 03/30/2017 |
|
|
1fa3f817-35bc-41a1-b366-f5a20b70da0c |
How to: Animate an Object Along a Path (Point Animation)
This example shows how to use a xref:System.Windows.Media.Animation.PointAnimationUsingPath object to animate a xref:System.Windows.Point along a curved path.
Example
The following example moves an xref:System.Windows.Media.EllipseGeometry along a path defined by a xref:System.Windows.Media.PathGeometry. The ellipse geometry's xref:System.Windows.Media.EllipseGeometry.Center%2A property, which takes a xref:System.Windows.Point value, specifies its position; to move the ellipse geometry, you animate its xref:System.Windows.Media.EllipseGeometry.Center%2A property. The example uses a xref:System.Windows.Media.Animation.PointAnimationUsingPath to animate the xref:System.Windows.Media.EllipseGeometry object's xref:System.Windows.Media.EllipseGeometry.Center%2A property.
[!code-xamlPathAnimationGallery_snippet#PointAnimationUsingPathWholePage]
[!code-csharpPathAnimationGallery_procedural_snip#PointAnimationUsingPathWholePage] [!code-vbPathAnimationGallery_procedural_snip#PointAnimationUsingPathWholePage]
For the complete sample, see Path Animation Sample.
The code version of the preceding sample used a xref:System.Windows.Media.Animation.Storyboard to animate the xref:System.Windows.Media.EllipseGeometry, even though only one animation was applied. A xref:System.Windows.Media.Animation.Storyboard is often the easiest way to apply multiple animations because these animations can be controlled by the same xref:System.Windows.Media.Animation.Storyboard. However, an easier way to apply a single animation to a property when using code is to use the xref:System.Windows.Media.Animation.Animatable.BeginAnimation%2A method. For an example, see Animate a Property Without Using a Storyboard.