SizeAnimationUsingKeyFrames.KeyFrames Property
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public SizeKeyFrameCollection get_KeyFrames () /** @property */ public void set_KeyFrames (SizeKeyFrameCollection value)
public function get KeyFrames () : SizeKeyFrameCollection public function set KeyFrames (value : SizeKeyFrameCollection)
<object> <SizeKeyFrameCollection .../> </object>
Property Value
The collection of SizeKeyFrame objects that define the animation. The default value is Empty.This example shows how to animate size changes by using key frames.
The following example uses the SizeAnimationUsingKeyFrames class to animate the Size property of an ArcSegment. This animation uses three key frames in the following manner:
-
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 Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.