다음을 통해 공유


Timeline.BeginTime 속성

정의

Timeline 시작하는 시간을 가져오거나 설정합니다.

public:
 property Nullable<TimeSpan> BeginTime { Nullable<TimeSpan> get(); void set(Nullable<TimeSpan> value); };
public TimeSpan? BeginTime { get; set; }
member this.BeginTime : Nullable<TimeSpan> with get, set
Public Property BeginTime As Nullable(Of TimeSpan)

속성 값

부모의 BeginTime기준으로 이 Timeline 시작해야 하는 시간입니다. 이 타임라인이 루트 타임라인인 경우 시간은 대화형 시작 시간(타임라인이 트리거된 순간)에 상대적입니다. 이 값은 양수, 음수 또는 null; null 값은 타임라인이 재생되지 않는 것을 의미합니다. 기본값은 0입니다.

예제

타임라인의 BeginTime 속성은 타임라인의 활성 기간의 시작을 결정합니다. 타임라인에 부모 타임라인이 있는 경우 BeginTime 속성은 부모가 시작된 후 타임라인을 시작하는 데 걸리는 시간을 결정합니다. 타임라인이 루트 타임라인(예: Storyboard)인 경우 BeginTime 속성은 타임라인이 트리거된 후 재생을 시작하는 데 걸리는 시간을 결정합니다.

다음 예제에서는 서로 다른 BeginTime 설정을 사용하여 여러 다른 타임라인을 보여 줍니다.

<!-- This example shows how the BeginTime property determines when a timeline starts.
     Several rectangles are animated by DoubleAnimations with identical 
     durations and target values, but with different
     BeginTime settings. -->
     
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="BeginTime Example">
  <StackPanel Margin="20">

    <!-- The rectangles to animate. -->
    <Rectangle Name="DefaultBeginTimeRectangle" 
      Width="20" Height="20" Fill="Blue"  />
      
    <Rectangle Name="DelayedBeginTimeRectangle" 
      Width="20" Height="20" Fill="Blue"  />
    
    <Rectangle Name="DelayedAnimationWithDelayedParentRectangle" 
      Width="20" Height="20" Fill="Blue"  /> 

    <Rectangle Name="NegativeBeginTimeExampleRectangle" 
      Width="20" Height="20" Fill="Blue"  />            
    
    <!-- Create a button to start the animations. -->
    <Button Margin="20" Content="Start Animations">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>

              <!-- This animation starts as soon as the button is clicked, because it
                   has a BeginTime of 0. -->
              <DoubleAnimation 
                Storyboard.TargetName="DefaultBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"
                BeginTime="0:0:0" From="100" To="600" Duration="0:0:5"  /> 

              <!-- This animation starts 5 seconds after the button is clicked. -->
              <DoubleAnimation 
                Storyboard.TargetName="DelayedBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"  
                BeginTime="0:0:5" From="100" To="600" Duration="0:0:5" />
                
              <ParallelTimeline BeginTime="0:0:5">  

              <!-- This animation starts 10 seconds after the button is clicked, 
                   because its parent has a BeginTime of 5 seconds and it has
                   a BeginTime of 5 seconds: 5 + 5 = 10.  -->              
                <DoubleAnimation  
                  Storyboard.TargetName="DelayedAnimationWithDelayedParentRectangle" 
                  Storyboard.TargetProperty="Width" 
                  BeginTime="0:0:5" From="100" To="600" Duration="0:0:5"  />
              </ParallelTimeline>
              
              <!-- This animation starts as soon as the button is clicked, but
                   it animates from 350 to 600 instead of from 100 to 600 
                   because of its negative BeginTime. The negative BeginTime
                   setting advances the animation, so that it behaves as though
                   it had already been playing for 2.5 seconds as soon as it is
                   started. -->
              <DoubleAnimation 
                Storyboard.TargetName="NegativeBeginTimeExampleRectangle" 
                Storyboard.TargetProperty="Width"  
                BeginTime="-0:0:2.5" From="100" To="600" Duration="0:0:5" />              
              
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>      
    </Button>
    
    <!-- This example demonstrates how the BeginTime property works on a root timeline. -->
    <Rectangle Name="RootTimelineWithDelayedBeginTimeRectangle"
      Width="20" Height="20" Fill="Blue" >
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
          <BeginStoryboard>
            <Storyboard BeginTime="0:0:5">
            
              <!-- This animation starts 5 seconds after the left mouse button
                   is pressed, because its parent storyboard (a root timeline)
                   has a BeginTime of 5 seconds. -->
              <DoubleAnimation 
                Storyboard.TargetName="RootTimelineWithDelayedBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"
                BeginTime="0:0:0" From="100" To="600" Duration="0:0:2" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>    
  </StackPanel>
</Page>

설명

BeginTime 속성은 시퀀스에서 재생되는 타임라인을 만드는 데 유용합니다. 동일한 부모를 공유하는 연속 타임라인의 BeginTime 늘리면 재생 시간을 엇갈릴 수 있습니다.

음수 값

음수 BeginTime 값을 사용하면 Timeline 과거 어느 시점에 시작된 것처럼 동작합니다. 예를 들어 음수 2.5초의 BeginTime 5초의 Duration 있는 Timeline 시작 시 반쯤 완료된 것처럼 보입니다.

BeginTime 및 SpeedRatio

BeginTime 속성에서 설명하는 시간은 타임라인의 부모 시간으로 측정됩니다. 예를 들어 부모가 2의 SpeedRatio 있는 BeginTime 5인 타임라인은 실제로 2.5초 후에 시작됩니다.

타임라인의 자체 SpeedRatio 설정은 BeginTime영향을 주지 않습니다. 예를 들어 BeginTime 5초, SpeedRatio 2, SpeedRatio 1인 부모 타임라인은 2.5가 아닌 5초 후에 시작됩니다.

종속성 속성 정보

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

XAML 특성 사용

< 개체BeginTime="[-][.]시간::[.fractionalSeconds]"/>

-또는-

< 개체BeginTime="[-][.]시간:"/>

-또는-

개체="[-] "/

-또는-

< 개체BeginTime="{x:Null 태그 확장}"/>

XAML 값

대괄호([])의 항목은 선택 사항입니다.


System.Int32

이 시작 시간에 걸친 일 수를 설명하는 0보다 크거나 같은 값입니다.

시간
System.Int32

이 시작 시간에 걸친 시간 수를 나타내는 0에서 23 사이의 값입니다.


System.Int32

이 시작 시간에 걸쳐 있는 시간(분)을 나타내는 0에서 59 사이의 값입니다.


System.Int32

이 시작 시간에 걸쳐 있는 시간(초)을 나타내는 0에서 59 사이의 값입니다.

fractionalSeconds
System.Int32

소수 자릿수 초를 나타내는 1~7자리 숫자로 구성된 값입니다.

전체 TimeSpan 구문은 Parse 페이지의 설명 섹션을 참조하세요.

적용 대상

추가 정보