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)

속성 값

Nullable<TimeSpan>

Timeline이 시작되어야 하는 시간으로, 해당 부모의 BeginTime에 상대적입니다. 이 타임라인이 루트 타임라인인 경우 시간이 대화형 시작 시간(타임라인이 트리거된 순간)에 상대적입니다. 이 값은 양수, 음수 또는 null이 될 수 있습니다. 값이 null이면 타임라인이 재생되지 않습니다. 기본값은 영입니다.

예제

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

다음 예제에서는 설정이 다른 여러 타임라인을 보여 줍니다 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 인해 과거의 어느 시점에서 시작된 것처럼 동작합니다. 예를 들어 Timeline BeginTime 음수 2.5초와 Duration 5초의 값은 시작 시 절반 정도 완료된 것처럼 보입니다.

BeginTime 및 SpeedRatio

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

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

종속성 속성 정보

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

XAML 특성 사용

<object BeginTime="[-][days.] hours:minutes:seconds[.fractionalSeconds]"/>

또는

<object BeginTime="[-][days.] hours:minutes"/>

또는

<object BeginTime="[-]days"/>

또는

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

XAML 값

대괄호 안에 있는 항목 ([])은 선택 사항입니다.

days
System.Int32

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

hours
System.Int32

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

minutes
System.Int32

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


System.Int32

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

fractionalSeconds
System.Int32

소수 자릿수 초를 나타내는 1 ~ 7 자리 이루어진는 값입니다.

전체 TimeSpan 구문을의 주의 섹션을 참조 합니다 Parse 페이지입니다.

적용 대상

추가 정보