共用方式為


DoubleAnimation.EasingFunction 屬性

定義

取得或設定套用至這個動畫的 easing 函式。

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>

屬性值

套用至這個動畫的 easing 函式。

範例

此 XAML 範例會將 BounceEase easing 函式套用至 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();
}

備註

Easing 函式可讓您將自訂的數學公式套用至動畫。 對於製作以 2-D 座標系統模擬真實世界物理的動畫來說,數學運算操作通常很有用。 例如,您可能想要物件實際表現出反彈或像是在彈簧上一樣。 如需 easing 函式的清單,以及如何使用它們的資訊,請參閱 主要畫面格動畫和 Easing 函式動畫

適用於

另請參閱