Assembly: System.Windows (in System.Windows.dll)
Thetype exposes the following members.
|Dispatcher||Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)|
|KeyTime||Gets or sets the time at which the key frame's target Value should be reached. (Inherited from PointKeyFrame.)|
|Value||Gets or sets the key frame's target value. (Inherited from PointKeyFrame.)|
|CheckAccess||Determines whether the calling thread has access to this object. (Inherited from DependencyObject.)|
|ClearValue||Clears the local value of a dependency property. (Inherited from DependencyObject.)|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetAnimationBaseValue||Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|GetValue||Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ReadLocalValue||Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)|
|SetValue||Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
A key frame defines a segment of the PointAnimationUsingKeyFrames 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.
Discrete key frames like create sudden "jumps" between values (no interpolation). In other words, the animated property does not change until the key frame's key time is reached, at which point the animated property goes suddenly to the target value.
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, it 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 such as LinearPointKeyFrame create a smooth linear interpolation between values.
During the end of the next half second, it uses an instance of the class to suddenly move the ellipse along the path to the next position. Discrete key frames like create sudden jumps between values.
During the final two seconds, it 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.
<Canvas Width="400" Height="300"> <Canvas.Resources> <Storyboard x:Name="myStoryboard"> <!-- 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> </Canvas.Resources> <Path Fill="Blue" Loaded="Start_Animation"> <Path.Data> <!-- Describes an ellipse. --> <EllipseGeometry x:Name="MyAnimatedEllipseGeometry" Center="200,100" RadiusX="15" RadiusY="15" /> </Path.Data> </Path> </Canvas>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.