語言

ElasticEase.Oscillations 屬性

定義

它會取得或設定目標在動畫目的地上來回滑動的次數。

public:
 property int Oscillations { int get(); void set(int value); };
public int Oscillations { get; set; }
member this.Oscillations : int with get, set
Public Property Oscillations As Integer

屬性值

目標在動畫目的地上來回滑動的次數。 此值必須大於或等於0。 預設值為 3。

範例

以下範例將一個緩和函數應用 ElasticEase 於 a DoubleAnimation ,產生類似彈簧來回擺動直到停下的動畫。

<Rectangle Name="myRectangle" Width="200" Height="30" Fill="Blue">
    <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.MouseDown">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation From="30" To="200" Duration="00:00:4" 
                     Storyboard.TargetName="myRectangle" 
                     Storyboard.TargetProperty="Height">
                        <DoubleAnimation.EasingFunction>
                            
                            <!-- Elastic easing function assigned to From/To animation -->
                            <ElasticEase x:Name="myElasticEase" Oscillations="3" 
                             Springiness="1" EasingMode="EaseOut"/>
                        </DoubleAnimation.EasingFunction>
                    </DoubleAnimation>

                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Rectangle.Triggers>

</Rectangle>

備註

相依屬性識別碼欄位: OscillationsProperty

XAML 屬性使用方式

<ElasticEase Oscillations="int"/>

適用於