--- title: "How to: Animate a Rectangle" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "animation [WPF], rectangles" - "rectangles [WPF], animating" ms.assetid: 572ffb95-790d-4ace-adbf-b2ea8a90e75b --- # How to: Animate a Rectangle This example shows how to animate changes to the size and position of a rectangle. ## Example The following example uses an instance of the class to animate the property of a , which animates changes to the size and position of the rectangle. [!code-csharp[BasicAnimations_snip#RectAnimationWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/BasicAnimations_snip/CSharp/RectAnimationExample.cs#rectanimationwholepage)] [!code-vb[BasicAnimations_snip#RectAnimationWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BasicAnimations_snip/VisualBasic/RectAnimationExample.vb#rectanimationwholepage)] ## See also - - - - [Animation Overview](animation-overview.md) - [Graphics and Multimedia](index.md) - [Graphics How-to Topics](graphics-how-to-topics.md) - [Animation and Timing How-to Topics](animation-and-timing-how-to-topics.md)