语言

ElasticEase 类

定义

表示缓动函数,该函数创建一个动画,该动画类似于一个春天来回振荡,直到它到达休息为止。

public ref class ElasticEase sealed : EasingFunctionBase
/// [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 ElasticEase final : EasingFunctionBase
[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 ElasticEase : EasingFunctionBase
Public NotInheritable Class ElasticEase
Inherits EasingFunctionBase
<ElasticEase .../>
继承
Object Platform::Object IInspectable DependencyObject EasingFunctionBase ElasticEase
属性

示例

此 XAML 示例将 ElasticEase 缓动函数应用于 DoubleAnimation ,以创建一个类似于春天来回振荡的动画,直到休息为止。

<StackPanel x:Name="LayoutRoot" >
    <StackPanel.Resources>
        <Storyboard x:Name="myStoryboard">
            <DoubleAnimation From="1" To="6" Duration="00:00:3" 
                Storyboard.TargetName="rectScaleTransform" 
                Storyboard.TargetProperty="ScaleY">
                <DoubleAnimation.EasingFunction>
                    
                    <!-- Elastic easing function assigned to From/To animation -->
                    <ElasticEase x:Name="myElasticEase" Oscillations="3" 
                     Springiness="1" EasingMode="EaseOut"/>
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </StackPanel.Resources>

    <Rectangle PointerPressed="Pointer_Clicked" 
     Fill="Blue" Width="200" Height="30">
        <Rectangle.RenderTransform>
            <ScaleTransform x:Name="rectScaleTransform" />
        </Rectangle.RenderTransform>
    </Rectangle>

</StackPanel>
// When the user clicks the rectangle, the animation
// begins. 
private void Pointer_Clicked(object sender, PointerRoutedEventArgs e)
{
    myStoryboard.Begin();
}

注解

ElasticEase 是两个缓动函数之一,可以在从正态 从/到范围 之外生成值。 (另一个是 BackEase。随着缓动函数的开始,值在 From 值周围振荡正负值,直到达到最终的正振幅,即 To 值。 Springiness 属性修改此振荡的正弦字符。 随着 Springiness 为 0,振荡基本上是正弦的,类似于春季运动的典型图。 有了更大的 Springiness 值,它就像抑制春天的运动。

“振荡”属性声明函数振荡并交叉到实际低于起始 From 值的值的次数。

只需尝试 Springiness、 振荡 和 EasingMode 属性,即可获得最佳结果,直到动画直观地为动画属性值方案执行所需操作。

BounceEase 是一种类似的缓动函数,适用于动画中的物理仿真。 ElasticEase 的区别在于,BounceEase 永远不会超出“从到”/范围。 概念化这两种缓动函数的另一种方法是 ElasticEase 是可用于对字符串的采摘进行动画处理,而 BounceEase 是可用于显示对线条或平面的球弹跳的内容。

缓动函数可以应用于 From/To/By 动画的 EasingFunction 属性,也可以应用于用于关键帧动画缓动变体的关键帧类型的 EasingFunction 属性。 有关详细信息,请参阅 关键帧动画和缓动函数动画。

构造函数

名称 说明
ElasticEase()

初始化 ElasticEase 类的新实例。

属性

名称 说明
Dispatcher

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

(继承自 DependencyObject)
DispatcherQueue

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

(继承自 DependencyObject)
EasingMode

获取或设置一个值,该值指定动画的内插方式。

(继承自 EasingFunctionBase)
Oscillations

获取或设置目标在动画目标上来回滑动的次数。

OscillationsProperty

标识 振荡 依赖属性。

Springiness

获取或设置春天的僵硬性。 Springiness 值越小,春天越僵硬,弹性越快,每个振荡的强度就越快。

SpringinessProperty

标识 Springiness 依赖属性。

方法

名称 说明
ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
Ease(Double)

转换规范化时间以控制动画的节奏。

(继承自 EasingFunctionBase)
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)

适用于

另请参阅