Timeline.SpeedRatio Propiedad

Definición

Obtiene o establece la velocidad, relativa a su elemento primario, a la que progresa Timeline.

public:
 property double SpeedRatio { double get(); void set(double value); };
public double SpeedRatio { get; set; }
member this.SpeedRatio : double with get, set
Public Property SpeedRatio As Double

Valor de propiedad

Double

Un valor finito mayor que 0 que describe la velocidad de progresión de esta escala de tiempo, relativa a su velocidad del elemento primario o, si se trata de una escala de tiempo raíz, la velocidad de la escala de tiempo predeterminada. El valor predeterminado es 1.

Excepciones

SpeedRatio es menor que 0 o no es un valor finito.

Ejemplos

La propiedad de una escala de SpeedRatio tiempo controla su tasa de progreso, en relación con su elemento primario. Si la escala de tiempo es una raíz, es SpeedRatio relativa a la velocidad de escala de tiempo predeterminada. En el ejemplo siguiente se muestran varias escalas de tiempo con diferentes SpeedRatio configuraciones.

<!-- This example shows how to use the SpeedRatio property 
     to make animations speed up or slow down. -->
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="Speed Example">
  <StackPanel>

    <!-- 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
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>

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

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

              <!-- This animation progresses at half the rate of its parent. -->
              <DoubleAnimation 
                Storyboard.TargetName="SlowerRectangle" 
                Storyboard.TargetProperty="Width" 
                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. -->
                  <DoubleAnimation 
                    Storyboard.TargetName="NestedTimelinesExampleRectangle" 
                    Storyboard.TargetProperty="Width" 
                    From="20" To="400" Duration="0:0:2" 
                    SpeedRatio="2"  />  
                </ParallelTimeline>
              </ParallelTimeline>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>     
    </Button>
  </StackPanel>
</Page>

Comentarios

La configuración de una escala de tiempo no tiene ningún efecto en su BeginTime; esa hora es relativa al elemento primario de SpeedRatio la escala de tiempo o, si la escala de tiempo es una escala de tiempo raíz, momento en el que se inició el reloj de la escala de tiempo.

Si AccelerationRatio se especifican o DecelerationRatio , esta SpeedRatio es la relación media sobre la longitud natural de la escala de tiempo.

Información sobre propiedades de dependencia

Campo identificador SpeedRatioProperty
Propiedades de metadatos establecidas en true Ninguno

Se aplica a