Timeline.SpeedRatio Właściwość

Definicja

Pobiera lub ustawia stawkę względem jej elementu nadrzędnego, w którym czasie postępuje dla tego Timelineelementu .

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

Wartość właściwości

Double

Wartość skończona większa niż 0, która opisuje szybkość postępu dla tej osi czasu w stosunku do szybkości nadrzędnej osi czasu lub, jeśli jest to oś czasu głównego, domyślna szybkość osi czasu. Wartość domyślna to 1.

Wyjątki

SpeedRatio jest mniejsza niż 0 lub nie jest wartością skończona.

Przykłady

Właściwość osi czasu SpeedRatio kontroluje jego szybkość postępu względem jej elementu nadrzędnego. Jeśli oś czasu jest elementem głównym, jest względem SpeedRatio domyślnej szybkości osi czasu. W poniższym przykładzie przedstawiono kilka osi czasu z różnymi SpeedRatio ustawieniami.

<!-- 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>

Uwagi

Ustawienie osi czasu SpeedRatio nie ma wpływu na jego BeginTime; ten czas jest powiązany z osią nadrzędną osi czasu lub, jeśli oś czasu jest główną osią czasu, moment, w którym zegar osi czasu został rozpoczęty.

Jeśli AccelerationRatio określono wartość lub DecelerationRatio jest to SpeedRatio średni współczynnik na naturalnej długości osi czasu.

Informacje dotyczące właściwości zależności

Pole identyfikatora SpeedRatioProperty
Właściwości metadanych ustawione na true Brak

Dotyczy