KeyTime 구조체

정의

특정 키 프레임이 애니메이션 중에 발생할 시점을 지정합니다.

/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
struct KeyTime
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public struct KeyTime
Public Structure KeyTime
<object property="[days.]hours:minutes:seconds[.fractionalSeconds]"/>
상속
KeyTime
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

이 예제에서는 XAML 특성 구문을 사용하여 여러 유형의 DoubleAnimationUsingKeyFrames 클래스에서 KeyTime 값을 설정합니다.

<Canvas>
    <Canvas.Resources>
        <Storyboard x:Name="myStoryboard">

            <!-- Animate the TranslateTransform's X property
           from 0 to 350, then 50, then 200 over 10 seconds. -->
            <DoubleAnimationUsingKeyFrames
       Storyboard.TargetName="MyAnimatedTranslateTransform"
       Storyboard.TargetProperty="X"
       Duration="0:0:10" EnableDependentAnimation="True">

                <!-- Using a LinearDoubleKeyFrame, the rectangle moves 
           steadily from its starting position to 500 over 
           the first 3 seconds.  -->
                <LinearDoubleKeyFrame Value="500" KeyTime="0:0:3" />

                <!-- Using a DiscreteDoubleKeyFrame, the rectangle suddenly 
           appears at 400 after the fourth second of the animation. -->
                <DiscreteDoubleKeyFrame Value="400" KeyTime="0:0:4" />

                <!-- Using a SplineDoubleKeyFrame, the rectangle moves 
           back to its starting point. The animation starts out slowly at 
           first and then speeds up. This KeyFrame ends after the 6th
           second. -->
                <SplineDoubleKeyFrame KeySpline="0.6,0.0 0.9,0.00" Value="0" KeyTime="0:0:6" />

            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Canvas.Resources>

    <Rectangle PointerPressed="Pointer_Clicked" Fill="Blue"
 Width="50" Height="50">
        <Rectangle.RenderTransform>
            <TranslateTransform x:Name="MyAnimatedTranslateTransform" />
        </Rectangle.RenderTransform>
    </Rectangle>

</Canvas>
// Start the animation when the object loads
private void Start_Animation(object sender, RoutedEventArgs e)
{
    myStoryboard.Begin();
}
' Start the animation when the object loads
Private Sub Start_Animation(ByVal sender As Object, ByVal e As EventArgs)
    myStoryboard.Begin()
End Sub

설명

각 키 프레임의 KeyTime 속성은 해당 키 프레임이 종료되는 시기를 지정합니다. 키 프레임의 재생 기간을 지정하지 않습니다. 키 프레임이 재생되는 기간은 키 프레임이 끝나는 시점, 이전 키 프레임 끝난 시점 및 애니메이션의 지속 시간에 의해 결정됩니다.

시간 범위 리터럴 문자(예: :또는 ) 가 없는 정수로만 KeyTime을 지정하면 해당 일 수의 KeyTime이 생성됩니다. 의도한 결과는 거의 없습니다. 일반적으로 시간 범위를 초 단위로 지정합니다. 따라서 KeyTime 문자열에는 일반적으로 시간, 분 및 초 사이의 구분 기호로 리터 럴 과 함께 시간 및 분 동안 앞에 0 값이 포함됩니다. 예를 들어 KeyTime을 5초로 지정하려면 올바른 문자열은 "0:0:5"입니다("0:0:05"는 동일합니다).

XAML 구문에 대한 참고 사항

ResourceDictionary에서는 KeyTime을 공유 가능한 개체로 선언할 수 없습니다.

KeyTime의 프로젝션 및 멤버

Microsoft .NET 언어(C# 또는 Microsoft Visual Basic) 또는 Visual C++ 구성 요소 확장(C++/CX)을 사용하는 경우 KeyTime에는 몇 가지 유틸리티 메서드가 있으며 해당 데이터 멤버 TimeSpan 은 필드가 아닌 읽기 전용 속성으로 노출됩니다.

Microsoft .NET의 경우 DurationTimeSpan, FromTimeSpan 메서드 및 암시적 연산자에 대해 TimeSpan.Parse를 노출합니다. Visual C++ 구성 요소 확장(C++/CX)의 구조에서는 사용할 수 없지만 KeyTimeHelper.FromTimeSpan을 사용할 수 있습니다.

WINDOWS 런타임 WRL(템플릿 라이브러리)을 사용하여 C++로 프로그래밍하는 경우 데이터 멤버 필드 TimeSpan만 KeyTime의 멤버로 존재합니다. WRL 코드는 KeyTimeHelper 클래스에 있는 FromTimeSpan에 액세스할 수 있습니다.

필드

TimeSpan

이 KeyTime의 시간 구성 요소입니다.

적용 대상