Gets or sets the collection of PointKeyFrame objects that define the animation.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Property ValueType: System.Windows.Media.Animation.PointKeyFrameCollection
The collection of PointKeyFrame objects that define the animation. The default value is Empty.
The following example moves an ellipse along a triangular path. The example uses the PointAnimationUsingKeyFrames class to animate the Center property of an EllipseGeometry. This animation uses three key frames in the following manner:
During the first half second, uses an instance of the LinearPointKeyFrame class to move the ellipse along a path at a steady rate from its starting position. Linear key frames like LinearPointKeyFrame create a smooth linear interpolation between values.
During the end of the next half second, uses an instance of the DiscretePointKeyFrame class to suddenly move the ellipse along the path to the next position. Discrete key frames like DiscretePointKeyFrame create sudden jumps between values.
During the final two seconds, uses an instance of the SplinePointKeyFrame class to move the ellipse back to its starting position. Spline key frames like SplinePointKeyFrame create a variable transition between values according to the values of the KeySpline property. In this example, the animation begins slowly and speeds up exponentially toward the end of the time segment.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="White" Margin="20"> <Canvas Width="400" Height="400"> <Path Fill="Blue"> <Path.Data> <!-- Describes an ellipse. --> <EllipseGeometry x:Name="MyAnimatedEllipseGeometry" Center="200,100" RadiusX="15" RadiusY="15" /> </Path.Data> <Path.Triggers> <EventTrigger RoutedEvent="Path.Loaded"> <BeginStoryboard> <Storyboard> <!-- Animating the Center property uses 3 KeyFrames, which animate the ellipse allong a triangular path. --> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="Center" Storyboard.TargetName="MyAnimatedEllipseGeometry" Duration="0:0:5" RepeatBehavior="Forever"> <!-- Over the first half second, Using a LinearPointKeyFrame, the ellipse moves steadily from its starting position along the first line of the trianglar path. --> <LinearPointKeyFrame KeyTime="0:0:0.5" Value="100,300" /> <!-- Using a DiscretePointKeyFrame, the ellipse suddenly changes position after the first second of the animation. --> <DiscretePointKeyFrame KeyTime="0:0:1" Value="400,300" /> <!-- Using a SplinePointKeyFrame, the ellipse moves back to its starting position. It moves slowly at first and then speeds up. This key frame takes 2 seconds to complete. --> <SplinePointKeyFrame KeySpline="0.6,0.0 0.9,0.00" KeyTime="0:0:3" Value="200,100" /> </PointAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Path.Triggers> </Path> </Canvas> </Page>
For the complete sample, see KeyFrame Animation Sample.
For consistency with other animation examples, the code versions of this example use a Storyboard object to apply the PointAnimationUsingKeyFrames. However, when applying a single animation in code, it's simpler to use the BeginAnimation method instead of using a Storyboard. For an example, see How to: Animate a Property Without Using a Storyboard.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)