共用方式為


KeySpline Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This class is used by a spline key frame to define animation progress.

Inheritance Hierarchy

System.Object
  System.Windows.DependencyObject
    System.Windows.Media.Animation.KeySpline

Namespace:  System.Windows.Media.Animation
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public NotInheritable Class KeySpline _
    Inherits DependencyObject
public sealed class KeySpline : DependencyObject
<KeySpline .../>
<object property="controlPoint1 controlPoint2"/>

XAML Values

  • controlPoint1
    The curve's first control point, expressed as an x,y pair. The point's X and Y values must each be between 0 and 1, inclusive. For more information, see the ControlPoint1 property.

  • controlPoint2
    The curve's second control point, expressed as an x,y pair. The point's X and Y values must each be between 0 and 1, inclusive. For more information, see the ControlPoint2 property.

The KeySpline type exposes the following members.

Constructors

  Name Description
Public methodSupported by Silverlight for Windows Phone KeySpline Initializes a new instance of the KeySpline class.

Top

Properties

  Name Description
Public propertySupported by Silverlight for Windows Phone ControlPoint1 Gets or sets the first control point used to define a Bezier curve that describes a KeySpline.
Public propertySupported by Silverlight for Windows Phone ControlPoint2 Gets or sets the second control point used to define a Bezier curve that describes a KeySpline.
Public propertySupported by Silverlight for Windows Phone Dispatcher Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone CheckAccess Determines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone 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.)
Public methodSupported by Silverlight for Windows Phone 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.)
Public methodSupported by Silverlight for Windows Phone GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

To understand how a KeySpline works, it is helpful to understand cubic Bezier curves. A cubic Bezier curve is defined by a start point, an end point, and two control points. The two coordinates in the KeySpline defines those two control points. When describing key splines, the start point of the Bezier curve is always 0, and the end point is always 1, which is why you define only the two control points. The resulting curve specifies how an animation is interpolated during a time segment; that is, the curve represents the rate of change in the animation's target attribute over the time segment.

Run the sample below to see how changing the KeySpline value effects the interpolation of the animation. Also, this sample demonstrates the effect of the KeySpline on the Bezier curve which represents the interpolation.

Run this sample

XAML object element syntax for KeySpline (to fill a KeySpline property in property element syntax) is possible but not common. It is more common to use attribute syntax on a KeySpline property and use the type conversion behavior to specify both ControlPoint1 and ControlPoint2 in a single string.

XAML Usage Notes

  • The two control points may also be delimited by a single comma and/or one or more spaces.

  • controlPoint1 and controlPoint2 are "logical points", not points in an actual onscreen coordinate system. See "Logical Points" section in Point.

  • The common usage is to use a comma between x,y of a point, and a space between points, for example 0,0 0.5,1.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.