* 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.8 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|
| How to: Animate the Thickness of a Border by Using Key Frames | 03/30/2017 |
|
3a9cb463-0a63-407d-aae7-3fbb1a559947 |
How to: Animate the Thickness of a Border by Using Key Frames
This example shows how to animate the xref:System.Windows.Controls.Control.BorderThickness%2A property of a xref:System.Windows.Controls.Border.
Example
The following example uses the xref:System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames class to animate the xref:System.Windows.Controls.Control.BorderThickness%2A property of a xref:System.Windows.Controls.Border. This animation uses three key frames in the following manner:
-
During the first half second, uses an instance of the xref:System.Windows.Media.Animation.LinearThicknessKeyFrame class to gradually increase the thickness of the border. The example uses xref:System.Windows.Media.Animation.LinearThicknessKeyFrame to create a smooth linear increase between values.
-
At the end of the next half second, uses an instance of the xref:System.Windows.Media.Animation.DiscreteThicknessKeyFrame class to suddenly increase the thickness of the border. Discrete key frames like those derived from xref:System.Windows.Media.Animation.DiscreteThicknessKeyFrame create sudden jumps between values, that is, the movement of the animation is jerky.
-
During the final two seconds, uses an instance of the xref:System.Windows.Media.Animation.SplineThicknessKeyFrame class to decrease the thickness of the border. Spline key frames like those derived from xref:System.Windows.Media.Animation.SplineThicknessKeyFrame create a variable transition between values according to the values of the xref:System.Windows.Media.Animation.SplineThicknessKeyFrame.KeySpline%2A property. In this key frame, the animation starts off slow and speeds up exponentially toward the end of the time segment.
[!code-xamlkeyframes_snip#ThicknessAnimationUsingKeyFramesWholePage]
For the complete sample, see KeyFrame Animation Sample.