This documentation is archived and is not being maintained.
MatrixAnimationBase Class
Visual Studio 2008
Abstract class that, when implemented, animates a Matrix value.
Assembly: PresentationCore (in PresentationCore.dll)
Notes to Inheritors:
See the Custom Animations Overview for information about extending animation classes.
The following code example demonstrates how to use the derived MatrixAnimationUsingKeyFrames class in Extensible Application Markup Language (XAML).
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Microsoft.Samples.KeyFrameAnimations.MatrixAnimationUsingKeyFramesExample" WindowTitle="MatrixAnimationUsingPath Example"> <StackPanel Margin="20"> <Canvas HorizontalAlignment="Left" Width="340" Height="240" > <!-- The Button that is animated. --> <Button Margin="-30,0,0,0" MinWidth="100"> Click <Button.RenderTransform> <MatrixTransform x:Name="myMatrixTransform"> <MatrixTransform.Matrix > <Matrix OffsetX="10" OffsetY="100"/> </MatrixTransform.Matrix> </MatrixTransform> </Button.RenderTransform> <Button.Triggers> <EventTrigger RoutedEvent="Button.Loaded"> <BeginStoryboard> <Storyboard> <!-- Animates the button's MatrixTransform using MatrixAnimationUsingKeyFrames. Animates to first Matrix in the first 0.2 seconds, to second Matrix in the next second, and then starts over. Notice that the first KeyFrame stretches the button and skews it using the M11 and M12 Matrix properties respectively. Also, animations are using Discrete interpolation, so the MatrixTransform appears to "jump" from one value to the next. --> <MatrixAnimationUsingKeyFrames Storyboard.TargetName="myMatrixTransform" Storyboard.TargetProperty="Matrix" Duration="0:0:3" RepeatBehavior="Forever"> <DiscreteMatrixKeyFrame KeyTime="0:0:0.2"> <DiscreteMatrixKeyFrame.Value> <Matrix OffsetX="100" OffsetY="200" M11="3" M12="1" /> </DiscreteMatrixKeyFrame.Value> </DiscreteMatrixKeyFrame> <DiscreteMatrixKeyFrame KeyTime="0:0:1"> <DiscreteMatrixKeyFrame.Value> <Matrix OffsetX="300" OffsetY="100" M11="1" M12="0" /> </DiscreteMatrixKeyFrame.Value> </DiscreteMatrixKeyFrame> </MatrixAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Button.Triggers> </Button> </Canvas> </StackPanel> </Page>
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Freezable
System.Windows.Media.Animation.Animatable
System.Windows.Media.Animation.Timeline
System.Windows.Media.Animation.AnimationTimeline
System.Windows.Media.Animation.MatrixAnimationBase
System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames
System.Windows.Media.Animation.MatrixAnimationUsingPath
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Freezable
System.Windows.Media.Animation.Animatable
System.Windows.Media.Animation.Timeline
System.Windows.Media.Animation.AnimationTimeline
System.Windows.Media.Animation.MatrixAnimationBase
System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames
System.Windows.Media.Animation.MatrixAnimationUsingPath
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: