Timeline.SpeedRatio 속성

정의

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

속성 값

Double

이 Timeline에 대한 진행 속도로 부모 Timeline의 속도에 상대적인 비율을 설명하는 0보다 큰 유한 값이며, 이 Timeline이 루트 Timeline이면 기본 Timeline 속도입니다. 기본값은 1입니다.

예외

SpeedRatio가 0보다 작거나 유한 값이 아닌 경우

예제

타임라인의 SpeedRatio 속성은 부모를 기준으로 진행률을 제어합니다. 타임라인이 루트 SpeedRatio 인 경우 타임라인은 기본 타임라인 속도를 기준으로 합니다. 다음 예제에서는 다양한 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>

설명

타임라인의 SpeedRatio 설정은 해당 시간에 영향을 BeginTime주지 않습니다. 해당 시간은 타임라인의 부모에 상대적이거나, 타임라인이 루트 타임라인인 경우 타임라인의 시계가 시작된 순간입니다.

지정되거나 DecelerationRatio 지정된 SpeedRatio 경우 AccelerationRatio 타임라인의 자연 길이에 대한 평균 비율입니다.

종속성 속성 정보

식별자 필드 SpeedRatioProperty
메타 데이터 속성 설정 true 없음

적용 대상