ElasticEase 類別

定義

表示緩動函式,這個函式會建立類似於彈簧來回振動直到停止的動畫。

public ref class ElasticEase sealed : EasingFunctionBase
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 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.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ElasticEase final : EasingFunctionBase
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ElasticEase : EasingFunctionBase
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ElasticEase : EasingFunctionBase
Public NotInheritable Class ElasticEase
Inherits EasingFunctionBase
<ElasticEase .../>
繼承
Object Platform::Object IInspectable DependencyObject EasingFunctionBase ElasticEase
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

這個 XAML 範例會將 ElasticEase Easing 函式套用至 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();
}
' When the user clicks the rectangle, the animation
' begins. 
Private Sub Pointer_Clicked(ByVal sender As Object, ByVal e As PointerRoutedEventArgs)
    myStoryboard.Begin()
End Sub

備註

ElasticEase 是兩個 Easing 函式的其中一個,可在標準From/To範圍之外產生值。 (另一個是 BackEase.) 當 easing 函式開始時,值會在 From 值周圍旋轉正值和負值,直到達到最終的正幅為 To 值為止。 Springiness屬性會修改這個振動的正弦字元。 當 Springiness 為 0 時,振動基本上是正弦值,而且類似于一般彈簧動作的圖表。 使用較大的 Springiness 值時,就像是降低彈簧的動作。

在從值開始之後, 此屬性 會宣告函式旋轉和交叉到實際低於起始 From 值的值的次數。

您只要試驗 Springiness一般EasingMode 屬性,即可獲得最佳結果,直到動畫以視覺化方式執行動畫屬性值案例所需的動作為止。

BounceEase 是類似的 Easing 函式,適用于動畫中的物理模擬。 ElasticEase 的差異在於BounceEase永遠不會超出[從/] 範圍。 將兩個 Easing 函式概念化的另一種方式是 ElasticEase 是您可能用來建立字串擷取動畫效果的專案, 而 BounceEase 則是您可能用來對線條或平面顯示球彈跳的專案。

Easing 函式可以套用至From/To/By動畫的EasingFunction屬性,或套用至用於主要畫面格動畫 Easing 變體之主要畫面格類型的EasingFunction屬性。 如需詳細資訊,請參閱 主要畫面格動畫和 Easing 函式動畫

建構函式

ElasticEase()

初始化 ElasticEase 類別的新實例。

屬性

Dispatcher

取得這個 物件相關聯的 CoreDispatcherCoreDispatcher代表可在 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)

適用於

另請參閱