语言

EasingDoubleKeyFrame 类

定义

将缓动函数与 DoubleAnimationUsingKeyFrames 关键帧动画相关联。

public ref class EasingDoubleKeyFrame sealed : DoubleKeyFrame
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class EasingDoubleKeyFrame final : DoubleKeyFrame
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class EasingDoubleKeyFrame : DoubleKeyFrame
Public NotInheritable Class EasingDoubleKeyFrame
Inherits DoubleKeyFrame
<EasingDoubleKeyFrame .../>
继承
Object Platform::Object IInspectable DependencyObject DoubleKeyFrame EasingDoubleKeyFrame
属性

示例

此 XAML 示例演示如何使用与它们关联的缓动函数的关键帧来创建一个矩形的动画,该矩形向上收缩、放慢速度、向下展开(好像下降),然后弹到停止。

<StackPanel x:Name="LayoutRoot" >
    <StackPanel.Resources>
        <Storyboard x:Name="myStoryboard">
            <DoubleAnimationUsingKeyFrames
             Storyboard.TargetProperty="Height"
             Storyboard.TargetName="myRectangle" EnableDependentAnimation="true">

                <!-- This keyframe animates the ellipse up to the crest 
                     where it slows down and stops. -->
                <EasingDoubleKeyFrame Value="30" KeyTime="00:00:02">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>

                <!-- This keyframe animates the ellipse back down and makes
                     it bounce. -->
                <EasingDoubleKeyFrame Value="200" KeyTime="00:00:06">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BounceEase Bounces="5" EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>

            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </StackPanel.Resources>

    <Rectangle x:Name="myRectangle" PointerPressed="Pointer_Clicked" 
     Fill="Blue" Width="200" Height="200" />
</StackPanel>
// When the user clicks the rectangle, the animation
// begins. 
private void Pointer_Clicked(object sender, PointerRoutedEventArgs e)
{
    myStoryboard.Begin();
}

注解

缓动函数允许向动画应用自定义数学公式。 数学运算通常用于生成在二维坐标系中模拟真实物理的动画。 例如,你可能希望某个对象以现实方式弹跳或表现得像是处于弹簧上。 有关缓动函数的列表以及有关如何使用这些函数的信息,请参阅 关键帧动画和缓动函数动画。

如果未设置缓动函数,则默认缓动函数将是线性的。

构造函数

名称 说明
EasingDoubleKeyFrame()

初始化 EasingDoubleKeyFrame 类的新实例。

属性

名称 说明
Dispatcher

始终在 Windows 应用 SDK 应用中返回 null 。 请改用 DispatcherQueue 。

(继承自 DependencyObject)
DispatcherQueue

获取 DispatcherQueue 与此对象关联的对象。 表示 DispatcherQueue 即使代码是由非 UI 线程启动,也可以访问 DependencyObject UI 线程上的设施。

(继承自 DependencyObject)
EasingFunction

获取或设置应用于关键帧的缓动函数。

EasingFunctionProperty

标识 EasingFunction 依赖项属性。

KeyTime

获取或设置关键帧的目标 值 应到达的时间。

(继承自 DoubleKeyFrame)
Value

获取或设置关键帧的目标值。

(继承自 DoubleKeyFrame)

方法

名称 说明
ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

返回为依赖属性建立的任何基值,在动画未处于活动状态的情况下,该属性将适用。

(继承自 DependencyObject)
GetValue(DependencyProperty)

从 DependencyObject 返回依赖属性的当前有效值。

(继承自 DependencyObject)
ReadLocalValue(DependencyProperty)

如果设置了本地值,则返回依赖属性的本地值。

(继承自 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

注册一个通知函数,用于侦听此 DependencyObject 实例上对特定 DependencyProperty 所做的更改。

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

设置 DependencyObject 上的依赖属性的本地值。

(继承自 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消以前通过调用 RegisterPropertyChangedCallback 注册的更改通知。

(继承自 DependencyObject)

适用于

另请参阅