Timeline.SpeedRatio Egenskap

Definition

Hämtar eller anger frekvensen, i förhållande till dess överordnade, vid vilken tidpunkt förlopp för detta 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

Egenskapsvärde

Ett begränsat värde som är större än 0 och som beskriver den hastighet med vilken tiden förlopp för den här tidslinjen, i förhållande till hastigheten för tidslinjens överordnade eller, om detta är en rottidslinje, standardtidslinjens hastighet. Standardvärdet är 1.

Undantag

SpeedRatio är mindre än 0 eller är inte ett ändlig värde.

Exempel

En tidslinjes SpeedRatio egenskap styr dess förloppshastighet i förhållande till dess överordnade. Om tidslinjen är en rot är den SpeedRatio relativ till standardtidslinjens hastighet. I följande exempel visas flera tidslinjer med olika SpeedRatio inställningar.

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

Kommentarer

En tidslinjes SpeedRatio inställning har ingen effekt på dess BeginTime; den tiden är relativ till tidslinjens överordnade eller, om tidslinjen är en rottidslinje, det ögonblick då tidslinjens klocka påbörjades.

Om AccelerationRatio eller DecelerationRatio anges är detta SpeedRatio det genomsnittliga förhållandet över tidslinjens naturliga längd.

Information om beroendeegenskap

Objekt Value
Identifierarfält SpeedRatioProperty
Metadataegenskaper inställda på true Ingen

Gäller för