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。

示例

以下示例将缓动函数应用于 ElasticEaseDoubleAnimation 以创建一个动画,该动画类似于来回振荡的弹簧,直到它停止。

<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"/>  

适用于