Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
A key frame defines a segment of the SizeAnimationUsingKeyFrames to which it belongs. Each key frame has a target Value and a KeyTime. The KeyTime specifies the time at which the key frame's Value should be reached. A key frame animates from the target value of the previous key frame to its own target value. It starts when the previous key frame ends and ends when its own key time is reached.
Linear key frames like LinearSizeKeyFrame create a smooth, linear interpolation between values.
This example shows how to animate size changes by using key frames.
During the first half second of the animation, uses an instance of the LinearSizeKeyFrame class to gradually increase the size of the arc. Linear key frames like LinearSizeKeyFrame create a smooth linear transition between values.
At the end of the next half second, uses an instance of the DiscreteSizeKeyFrame class to suddenly increase the size of the arc. Discrete key frames like DiscreteSizeKeyFrame create sudden jumps between values, that is, the size changes occur suddenly and are not subtle.
Over the final two seconds, uses an instance of the SplineSizeKeyFrame class to increase the size of the arc. Spline key frames like SplineSizeKeyFrame create a variable transition between values according to the values of the KeySpline property. In this example, the size of the arc increases slowly at first and then increases exponentially toward the end of the time segment.
<!-- This example shows how to use the SizeAnimationUsingKeyFrames to animate the size of an ArcSegment. --> <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Canvas HorizontalAlignment="Left" Margin="0" > <!-- Create an arc on the screen that animates its size when it loads. --> <Path Stroke="Black" StrokeThickness="2" > <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigureCollection> <PathFigure StartPoint="100,200"> <PathFigure.Segments> <PathSegmentCollection> <ArcSegment x:Name="myArcSegment" Size="90,80" SweepDirection="Clockwise" Point="500,200" /> </PathSegmentCollection> </PathFigure.Segments> </PathFigure> </PathFigureCollection> </PathGeometry.Figures> </PathGeometry> </Path.Data> <Path.Triggers> <EventTrigger RoutedEvent="Path.Loaded"> <BeginStoryboard Name="myBeginStoryBoard"> <Storyboard> <!-- Animating the Size property uses 3 KeyFrames. --> <SizeAnimationUsingKeyFrames Storyboard.TargetName="myArcSegment" Storyboard.TargetProperty="Size" > <SizeAnimationUsingKeyFrames.KeyFrames> <!-- Using a LinearSizeKeyFrame, the size of the arc increases gradually over the first half second of the animation. --> <LinearSizeKeyFrame KeyTime="0:0:0.5" Value="120,120" /> <!-- Using a DiscreteSizeKeyFrame, the size increases suddenly after the first second of the animation. --> <DiscreteSizeKeyFrame KeyTime="0:0:1" Value="150,150" /> <!-- Using a SplineSizeKeyFrame, the Size increases slowly at first and then speeds up exponentially. This KeyFrame takes 2 seconds. --> <SplineSizeKeyFrame KeySpline="0.6,0.0 0.9,0.00" KeyTime="0:0:3" Value="300,300" /> </SizeAnimationUsingKeyFrames.KeyFrames> </SizeAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Path.Triggers> </Path> </Canvas> </Page>
For the complete sample, see KeyFrame Animation Sample.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.