Export (0) Print
Expand All

KeySpline Class

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

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

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

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.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneKeySplineInitializes a new instance of the KeySpline class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneControlPoint1Gets or sets the first control point used to define a Bezier curve that describes a KeySpline.
Public propertySupported by Silverlight for Windows PhoneControlPoint2Gets or sets the second control point used to define a Bezier curve that describes a KeySpline.
Public propertySupported by Silverlight for Windows PhoneDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows 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 PhoneGetAnimationBaseValueReturns 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 PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

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

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

Community Additions

ADD
Show:
© 2014 Microsoft