Represents an easing function that creates an animation that resembles a spring oscillating back and forth until it comes to rest.
Assembly: PresentationCore (in PresentationCore.dll)
Gets a value that indicates whether the object can be made unmodifiable. (Inherited from Freezable.)
Gets or sets a value that specifies how the animation interpolates. (Inherited from EasingFunctionBase.)
Gets a value that indicates whether the object is currently modifiable. (Inherited from Freezable.)
Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)
Gets or sets the number of times the target slides back and forth over the animation destination.
Gets or sets the stiffness of the spring. The smaller the Springiness value is, the stiffer the spring and the faster the elasticity decreases in intensity over each oscillation.
You can control when in the "spring" behavior occurs in an animation by specifying the EasingMode property value. The following graph demonstrates the different values of EasingMode, where f(t) represents the animation progress and t represents time.
Because this animation causes values to oscillate back and forth, the animation might interpolate into negative numbers unexpectedly. This can cause errors when animating properties that do not allow negative numbers. For example, if you apply this animation to the Height of an object (e.g. from 0 to 200 with an EasingMode of EaseIn), the animation will attempt to interpolate through negative numbers for Height which will throw an error.
There are several other easing functions besideswhich you can explore using the following Silverlight sample.
In addition to using the easing functions included in the run-time, you can create your own custom easing functions by inheriting from EasingFunctionBase.
The following example applies an DoubleAnimation to create an animation that resembles a spring oscillating back and forth until it comes to rest.easing function to a
<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>
Available since 4.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.