Export (0) Print
Expand All

Timeline.DecelerationRatio Property

Gets or sets a value specifying the percentage of the timeline's Duration spent decelerating the passage of time from its maximum rate to zero.

Namespace:  System.Windows.Media.Animation
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public double DecelerationRatio { get; set; }
<object DecelerationRatio="double" .../>

Property Value

Type: System.Double
A value between 0 and 1, inclusive, that specifies the percentage of the timeline's Duration spent decelerating the passage of time from its maximum rate to zero. If the timeline's AccelerationRatio property is also set, the sum of DecelerationRatio and AccelerationRatio must be less than or equal to 1. The default value is 0.

Identifier field


Metadata properties set to true



DecelerationRatio is less than 0 or greater than 1.


The sum of AccelerationRatio and DecelerationRatio exceeds 1.

Use the DecelerationRatio property to create animations that slow down before stopping. The DecelerationRatio property is useful for creating ease-in effects or making movement seem more natural. Use the AccelerationRatio and DecelerationRatio properties together to create animations that that start slowly, speed up, and then slow down again before finishing.

This example demonstrates how to make an animation accelerate and decelerate over time. In the following example, several rectangles are animated by animations with different AccelerationRatio and DecelerationRatio settings.

<!-- This example shows how to use the AccelerationRatio and 
     DecelerationRatio properties of timelines
     to make animations speed up or slow down as they progress. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  WindowTitle="Acceleration and Deceleration Example">
  <StackPanel Margin="20">

    <Rectangle Name="nonAcceleratedOrDeceleratedRectangle" Fill="#9933FF" 
      Width="10" Height="20" HorizontalAlignment="Left" />

    <Rectangle Name="acceleratedRectangle" Fill="#3333FF" 
      Width="10" Height="20" HorizontalAlignment="Left" />

    <Rectangle Name="deceleratedRectangle" Fill="#33FF66" 
      Width="10" Height="20" HorizontalAlignment="Left" />

    <Rectangle Name="acceleratedAndDeceleratedRectangle" Fill="#CCFF33" 
      Width="10" Height="20" HorizontalAlignment="Left" />

    <!-- Create a button to start the animations. -->
    <Button Margin="0,30,0,0" HorizontalAlignment="Left"
      Content="Start Animations">
        <EventTrigger RoutedEvent="Button.Click">

              <!-- Creates an animation without acceleration or deceleration for comparison. -->
                Duration="0:0:10" From="20" To="400" />              

              <!-- Creates an animation that accelerates through 40% of its duration. -->
                AccelerationRatio="0.4" Duration="0:0:10" From="20" To="400" />

              <!-- Creates an animation that decelerates through 60% of its duration. -->
                DecelerationRatio="0.6" Duration="0:0:10" From="20" To="400" />

              <!-- Creates an animation that accelerates through 40% of its duration and
                   decelerates through the 60% of its duration. -->
                AccelerationRatio="0.4" DecelerationRatio="0.6" Duration="0:0:10" From="20" To="400" />      

Code has been omitted from this example. For the complete code, see the Animation Timing Behavior Sample.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft