--- title: "How to: Animate a Point by Using Key Frames" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "key frames [WPF], animating Points with" - "Points [WPF], animating with key frames" - "animation [WPF], Points with key frames" ms.assetid: d2e2ef10-0773-4133-856e-d41c09f60ded --- # How to: Animate a Point by Using Key Frames This example shows how to use the class to animate a . ## Example The following example moves an ellipse along a triangular path. The example uses the class to animate the property of an . This animation uses three key frames in the following manner: 1. During the first half second, uses an instance of the class to move the ellipse along a path at a steady rate from its starting position. Linear key frames like create a smooth linear interpolation between values. 2. During the end of the next half second, uses an instance of the class to suddenly move the ellipse along the path to the next position. Discrete key frames like create sudden jumps between values. 3. During the final two seconds, uses an instance of the class to move the ellipse back to its starting position. Spline key frames like create a variable transition between values according to the values of the property. In this example, the animation begins slowly and speeds up exponentially toward the end of the time segment. [!code-csharp[keyframes_snip#PointAnimationUsingKeyFramesWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/keyframes_snip/CSharp/PointAnimationUsingKeyFramesExample.cs#pointanimationusingkeyframeswholepage)] [!code-vb[keyframes_snip#PointAnimationUsingKeyFramesWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/keyframes_snip/visualbasic/pointanimationusingkeyframesexample.vb#pointanimationusingkeyframeswholepage)] [!code-xaml[keyframes_snip#PointAnimationUsingKeyFramesWholePage](~/samples/snippets/xaml/VS_Snippets_Wpf/keyframes_snip/XAML/PointAnimationUsingKeyFramesExample.xaml#pointanimationusingkeyframeswholepage)] For the complete sample, see [KeyFrame Animation Sample](https://github.com/microsoft/WPF-Samples/tree/master/Animation/KeyFrameAnimation). For consistency with other animation examples, the code versions of this example use a object to apply the . However, when applying a single animation in code, it's simpler to use the method instead of using a . For an example, see [Animate a Property Without Using a Storyboard](how-to-animate-a-property-without-using-a-storyboard.md). ## See also - - - - [Key-Frame Animations Overview](key-frame-animations-overview.md) - [Key-Frame How-to Topics](key-frame-animation-how-to-topics.md)