Timeline.SpeedRatio Properti

Definisi

Mendapatkan atau menetapkan tarif, relatif terhadap induknya, di mana waktu berlangsung untuk ini 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

Nilai Properti

Nilai terbatas lebih besar dari 0 yang menjelaskan tingkat kemajuan waktu untuk garis waktu ini, relatif terhadap kecepatan induk garis waktu atau, jika ini adalah garis waktu akar, kecepatan garis waktu default. Nilai defaultnya adalah 1.

Pengecualian

SpeedRatio kurang dari 0 atau bukan nilai terbatas.

Contoh

Properti garis SpeedRatio waktu mengontrol tingkat kemajuannya, relatif terhadap induknya. Jika garis waktu adalah akar, SpeedRatio relatif terhadap kecepatan garis waktu default. Contoh berikut menunjukkan beberapa garis waktu dengan pengaturan yang berbeda SpeedRatio .

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

Keterangan

Pengaturan garis SpeedRatio waktu tidak berpengaruh pada pengaturannya BeginTime; waktu tersebut relatif terhadap induk garis waktu atau, jika garis waktu adalah garis waktu akar, momen di mana jam garis waktu dimulai.

Jika AccelerationRatio atau DecelerationRatio ditentukan, ini SpeedRatio adalah rasio rata-rata atas panjang alami garis waktu.

Informasi Properti Dependensi

Item Nilai
Bidang pengidentifikasi SpeedRatioProperty
Properti metadata diatur ke true Tidak

Berlaku untuk