DoubleAnimation.EasingFunction 属性

定义

获取或设置应用于此动画的缓动函数。

public:
 property EasingFunctionBase ^ EasingFunction { EasingFunctionBase ^ get(); void set(EasingFunctionBase ^ value); };
EasingFunctionBase EasingFunction();

void EasingFunction(EasingFunctionBase value);
public EasingFunctionBase EasingFunction { get; set; }
var easingFunctionBase = doubleAnimation.easingFunction;
doubleAnimation.easingFunction = easingFunctionBase;
Public Property EasingFunction As EasingFunctionBase
<DoubleAnimation>
  <DoubleAnimation.EasingFunction>
    singleEasingFunction
  </DoubleAnimation.EasingFunction>
</DoubleAnimation>

属性值

应用于此动画的缓动函数。

示例

此 XAML 示例将 BounceEase 缓动函数应用于 DoubleAnimation 以创建弹跳效果。

<StackPanel x:Name="LayoutRoot" Background="White">
    <StackPanel.Resources>
        <Storyboard x:Name="myStoryboard">
            <DoubleAnimation From="30" To="200" Duration="00:00:3" 
                Storyboard.TargetName="ball" 
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
                <DoubleAnimation.EasingFunction>
                    <BounceEase Bounces="4" EasingMode="EaseOut" 
                                Bounciness="1.8" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </StackPanel.Resources>

    <Ellipse x:Name="ball" MouseLeftButtonDown="Clicked" 
     Fill="Blue" Width="100" Height="100">
      <Ellipse.RenderTransform>
        <TranslateTransform/>
      <Ellipse.RenderTransform>
    <Ellipse
</StackPanel>
// When the user clicks the object, the animation begins. 
private void Clicked(object sender, PointerRoutedEventArgs e)
{
    myStoryboard.Begin();
}

注解

缓动函数允许将自定义的数学公式应用到动画。 数学运算通常对于制作在 2-D 坐标系中模拟真实物理效果的动画非常有用。 例如,用户可能希望某个对象逼真地弹跳或表现出像在弹簧上一样。 有关缓动函数的列表以及如何使用它们的信息,请参阅 关键帧动画和缓动函数动画

适用于

另请参阅