Timeline.SpeedRatio Property

Gets or sets the rate, relative to its parent, at which time progresses for this Timeline.

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 SpeedRatio { get; set; }
<object SpeedRatio="double" .../>

Property Value

Type: System.Double
A finite value greater than 0 that describes the rate at which time progresses for this timeline, relative to the speed of the timeline's parent or, if this is a root timeline, the default timeline speed. The default value is 1.

Identifier field


Metadata properties set to true



SpeedRatio is less than 0 or is not a finite value.

A timeline's SpeedRatio setting does not have an effect on its BeginTime; that time is relative to the timeline's parent or, if the timeline is a root timeline, the moment at which the timeline's clock was begun.

If AccelerationRatio or DecelerationRatio are specified, this SpeedRatio is the average ratio over the natural length of the timeline.

A timeline's SpeedRatio property controls its rate of progress, relative to its parent. If the timeline is a root, its SpeedRatio is relative to the default timeline speed. The following example shows several timelines with different SpeedRatio settings.

<!-- This example shows how to use the SpeedRatio property 
     to make animations speed up or slow down. -->
  WindowTitle="Speed Example">

    <!-- The rectangles to animate. -->          
    <Rectangle Name="DefaultSpeedRectangle" 
      Width="20" Height="20" Fill="Blue"  />      
    <Rectangle Name="FasterRectangle" 
      Width="20" Height="20" Fill="Blue" />      
    <Rectangle Name="SlowerRectangle" 
      Width="20" Height="20" Fill="Blue" />
    <Rectangle Name="NestedTimelinesExampleRectangle" 
      Width="20" Height="20" Fill="Blue" />      

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

              <!-- This animation progresses at the same rate as its parent. -->
                From="20" To="400" Duration="0:0:2" 
                SpeedRatio="1" />

              <!-- This animation progresses twice as fast as its parent. -->
                From="20" To="400" Duration="0:0:2" 
                SpeedRatio="2"  />   

              <!-- This animation progresses at half the rate of its parent. -->
                From="20" To="400" Duration="0:0:2" 
                SpeedRatio="0.5"  />    

              <ParallelTimeline SpeedRatio="2">
                <ParallelTimeline SpeedRatio="2">

                  <!-- This animation progresses eight times faster
                       than normal, because of its SpeedRatio settings
                       and the SpeedRatio settings on its parents. -->
                    From="20" To="400" Duration="0:0:2" 
                    SpeedRatio="2"  />  

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft