KeySpline 类

定义

样条关键帧使用此类定义动画进度。This class is used by a spline key frame to define animation progress.

public ref class KeySpline : System::Windows::Freezable, IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.KeySplineConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public class KeySpline : System.Windows.Freezable, IFormattable
type KeySpline = class
    inherit Freezable
    interface IFormattable
Public Class KeySpline
Inherits Freezable
Implements IFormattable
继承
属性
实现

注解

若要了解如何KeySpline工作, 了解三次方贝塞尔曲线会很有帮助。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. 中的两个坐标KeySpline定义了这两个控制点。The two coordinates in the KeySpline defines those two control points. 描述关键样条时, 贝塞尔曲线的起点始终为 0, 终点始终为 1, 这就是为何仅定义两个控制点的原因。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. 若要更好地查看动画进度和贝塞尔曲线之间的关系, 请参阅主曲线动画示例To better see the relationship between animation progress and a Bezier curve, see Key Spline Animation Sample.

XAML 属性用法XAML Attribute Usage

<object property="cp1X,cp1Y cp2X,cp2Y"/>  

XAML 值XAML Values

cp1Xcp1X
X曲线的第一个控制点的分量。X component of the curve's first control point. 该值必须介于 0 和 1 之间。The value must be between 0 and 1.

cp1Ycp1Y
Y曲线的第一个控制点的分量。Y component of the curve's first control point. 该值必须介于 0 和 1 之间。The value must be between 0 and 1.

cp2Xcp2X
X曲线的第二个控制点的分量。X component of the curve's second control point. 该值必须介于 0 和 1 之间。The value must be between 0 and 1.

cp2Ycp2Y
Y曲线的第二个控制点的分量。Y component of the curve's second control point. 该值必须介于 0 和 1 之间。The value must be between 0 and 1.

值之间的分隔符可以是逗号或一个或多个空格。The separator between values may be either comma or one or more spaces. 此处所示的点和空间之间的逗号之间的约定是推荐的约定。The convention shown here of commas between components of a point and space between points is a recommended convention. 不要在点组件的值中使用逗号作为小数点, 即使这是你的区域性中的标准。Do not use a comma as the decimal point within the values of point components, even if that is the norm in your culture. 在所有类型转换情况下, XAML 值都被视为 en-us, 因此逗号被解释为分隔符, 而不是预期的小数点。XAML values are treated as en-us in all type conversion cases, and the comma is thus interpreted as the separator and not as the intended decimal point.

构造函数

KeySpline()

初始化 KeySpline 类的新实例。Initializes a new instance of the KeySpline class.

KeySpline(Double, Double, Double, Double)

使用指定的控制点坐标初始化 KeySpline 类的新实例。Initializes a new instance of the KeySpline class with the specified coordinates for the control points.

KeySpline(Point, Point)

使用指定的控制点初始化 KeySpline 类的新实例。Initializes a new instance of the KeySpline class with the specified control points.

属性

CanFreeze

获取一个值,该值指示是否可将对象变为不可修改。Gets a value that indicates whether the object can be made unmodifiable.

(继承自 Freezable)
ControlPoint1

用于定义描述 KeySpline 的贝塞尔曲线的第一个控制点。The first control point used to define a Bezier curve that describes a KeySpline.

ControlPoint2

用于定义描述 KeySpline 的贝塞尔曲线的第二个控制点。The second control point used to define a Bezier curve that describes a KeySpline.

DependencyObjectType

获取对此实例的 CLRCLR 类型进行包装的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(继承自 DependencyObject)
Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(继承自 DispatcherObject)
IsFrozen

获取一个值,该值指示对象当前是否可修改。Gets a value that indicates whether the object is currently modifiable.

(继承自 Freezable)
IsSealed

获取一个值,该值指示此实例当前是否为密封的(只读)。Gets a value that indicates whether this instance is currently sealed (read-only).

(继承自 DependencyObject)

方法

CheckAccess()

确定调用线程是否可以访问此 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)
ClearValue(DependencyProperty)

清除属性的本地值。Clears the local value of a property. 要清除的属性由 DependencyProperty 标识符指定。The property to be cleared is specified by a DependencyProperty identifier.

(继承自 DependencyObject)
ClearValue(DependencyPropertyKey)

清除只读属性的本地值。Clears the local value of a read-only property. 要清除的属性由 DependencyPropertyKey 指定。The property to be cleared is specified by a DependencyPropertyKey.

(继承自 DependencyObject)
Clone()

创建 Freezable 的可修改克隆,以制作该对象值的深层副本。Creates a modifiable clone of the Freezable, making deep copies of the object's values. 在复制此对象的依赖属性时,此方法会复制表达式(可能不再解析),但不复制动画或其当前值。When copying the object's dependency properties, this method copies expressions (which might no longer resolve) but not animations or their current values.

(继承自 Freezable)
CloneCore(Freezable)

使此实例成为指定 KeySpline 的深层副本。Makes this instance a deep copy of the specified KeySpline. 在复制依赖项属性时,此方法会复制资源引用和数据绑定(但可能不再解析),但不复制动画或其当前值。When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.

CloneCurrentValue()

使用 Freezable 的当前值创建其可修改复本(深层副本)。Creates a modifiable clone (deep copy) of the Freezable using its current values.

(继承自 Freezable)
CloneCurrentValueCore(Freezable)

使用当前的属性值使此实例成为指定 KeySpline 的可修改深层复制。Makes this instance a modifiable deep copy of the specified KeySpline using current property values. 不复制资源引用、数据绑定和动画,而是复制其当前值。Resource references, data bindings, and animations are not copied, but their current values are.

CoerceValue(DependencyProperty)

对指定依赖属性的值进行强制。Coerces the value of the specified dependency property. 通过对调用方 DependencyObject 上存在的依赖属性的属性元数据中所指定的任何 CoerceValueCallback 函数进行调用来完成此操作。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(继承自 DependencyObject)
CreateInstance()

初始化 Freezable 类的新实例。Initializes a new instance of the Freezable class.

(继承自 Freezable)
CreateInstanceCore()

创建 KeySpline 的新实例。Creates a new instance of KeySpline.

Equals(Object)

确定提供的 DependencyObject 是否等效于当前 DependencyObjectDetermines whether a provided DependencyObject is equivalent to the current DependencyObject.

(继承自 DependencyObject)
Freeze()

使当前对象不可修改,并且将其 IsFrozen 属性设置为 trueMakes the current object unmodifiable and sets its IsFrozen property to true.

(继承自 Freezable)
FreezeCore(Boolean)

使 Freezable 对象变为不可修改或测试是否可将其变为不可修改。Makes the Freezable object unmodifiable or tests whether it can be made unmodifiable.

(继承自 Freezable)
GetAsFrozen()

使用基(未经过动画处理的)属性值创建 Freezable 的冻结副本。Creates a frozen copy of the Freezable, using base (non-animated) property values. 由于副本已冻结,因此将通过引用复制任何冻结的子对象。Because the copy is frozen, any frozen sub-objects are copied by reference.

(继承自 Freezable)
GetAsFrozenCore(Freezable)

使此实例成为指定 KeySpline 对象的副本。Makes this instance a clone of the specified KeySpline object.

GetCurrentValueAsFrozen()

使用当前属性值创建 Freezable 的冻结副本。Creates a frozen copy of the Freezable using current property values. 由于副本已冻结,因此将通过引用复制任何冻结的子对象。Because the copy is frozen, any frozen sub-objects are copied by reference.

(继承自 Freezable)
GetCurrentValueAsFrozenCore(Freezable)

使此实例成为指定 KeySpline 的冻结复本。Makes this instance a frozen clone of the specified KeySpline. 不复制资源引用、数据绑定和动画,而是复制其当前值。Resource references, data bindings, and animations are not copied, but their current values are.

GetHashCode()

获取此 DependencyObject 的哈希代码。Gets a hash code for this DependencyObject.

(继承自 DependencyObject)
GetLocalValueEnumerator()

创建一个专用的枚举数,用于确定哪些依赖项属性在此 DependencyObject 上具有以本地方式设置的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(继承自 DependencyObject)
GetSplineProgress(Double)

从所提供的线性进度计算样条进度。Calculates spline progress from a supplied linear progress.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetValue(DependencyProperty)

DependencyObject 的此实例返回依赖属性的当前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(继承自 DependencyObject)
InvalidateProperty(DependencyProperty)

重新评估指定依赖属性的有效值。Re-evaluates the effective value for the specified dependency property.

(继承自 DependencyObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnChanged()

修改当前 KeySpline 对象时调用。Called when the current KeySpline object is modified.

OnFreezablePropertyChanged(DependencyObject, DependencyObject)

确保为刚刚设置的 DependencyObjectType 数据成员建立适当的上下文指针。Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set.

(继承自 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(继承自 Freezable)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

重写 OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 实现,以同时调用任何响应类型 Freezable 不断变化的依赖属性的 Changed 处理程序。Overrides the DependencyObject implementation of OnPropertyChanged(DependencyPropertyChangedEventArgs) to also invoke any Changed handlers in response to a changing dependency property of type Freezable.

(继承自 Freezable)
ReadLocalValue(DependencyProperty)

如果存在,则返回依赖属性的本地值。Returns the local value of a dependency property, if it exists.

(继承自 DependencyObject)
ReadPreamble()

确保正在从有效的线程访问 FreezableEnsures that the Freezable is being accessed from a valid thread. Freezable 的继承者必须在任何 API 一开始读取不属于依赖项对象的数据成员时调用此方法。Inheritors of Freezable must call this method at the beginning of any API that reads data members that are not dependency properties.

(继承自 Freezable)
SetCurrentValue(DependencyProperty, Object)

设置依赖属性的值而不更改其值源。Sets the value of a dependency property without changing its value source.

(继承自 DependencyObject)
SetValue(DependencyProperty, Object)

设置依赖属性的本地值,该值由其依赖属性标识符指定。Sets the local value of a dependency property, specified by its dependency property identifier.

(继承自 DependencyObject)
SetValue(DependencyPropertyKey, Object)

设置一个只读依赖属性的本地值,该值由依赖属性的 DependencyPropertyKey 标识符指定。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(继承自 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

返回一个值,该值指示序列化进程是否应序列化所提供的依赖属性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(继承自 DependencyObject)
ToString()

基于当前区域性创建此 KeySpline 实例的字符串表示形式。Creates a string representation of this instance of KeySpline based on the current culture.

ToString(IFormatProvider)

基于提供的 KeySpline 创建此 IFormatProvider 的字符串表示形式。Creates a string representation of this KeySpline based on the supplied IFormatProvider.

VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。Enforces that the calling thread has access to this DispatcherObject.

(继承自 DispatcherObject)
WritePostscript()

引发 FreezableChanged 事件并调用其 OnChanged() 方法。Raises the Changed event for the Freezable and invokes its OnChanged() method. Freezable 派生的类应在修改的类成员不存储为依赖属性的任何 API 的末尾调用此方法。Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties.

(继承自 Freezable)
WritePreamble()

验证 Freezable 是否未被冻结,并且是否正在从有效的线程上下文中访问它。Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. Freezable 的继承项应当在任何 API 一开始写入不属于依赖项属性的数据成员时调用此方法。Freezable inheritors should call this method at the beginning of any API that writes to data members that are not dependency properties.

(继承自 Freezable)

事件

Changed

在修改 Freezable 或其包含的对象时发生。Occurs when the Freezable or an object it contains is modified.

(继承自 Freezable)

显式界面实现

IFormattable.ToString(String, IFormatProvider)

使用指定的格式格式化当前实例的值。Formats the value of the current instance using the specified format.

适用于

另请参阅