ConnectedAnimationService 클래스

정의

ConnectedAnimation을 표시하는 속성 및 메서드를 제공하는 서비스를 나타냅니다.

public ref class ConnectedAnimationService sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ConnectedAnimationService final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ConnectedAnimationService
Public NotInheritable Class ConnectedAnimationService
상속
Object Platform::Object IInspectable ConnectedAnimationService
특성

Windows 요구 사항

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

예제

자세한 정보, 디자인 지침 및 코드 예제는 연결된 애니메이션을 참조하세요.

WinUI 2 갤러리 앱이 설치되어 있는 경우 여기를 클릭하여 앱을 열고 작동하는 연결된 애니메이션을 확인합니다.

이 예제에서는 탐색하는 동안 두 페이지 간에 이미지에 애니메이션 효과를 주는 방법을 보여줍니다.

SourcePage.xaml/SourcePage.xaml.cs

<Image x:Name="SourceImage"
       Width="200"
       Height="200"
       Stretch="Fill"
       Source="Assets/StoreLogo.png" />
private void NavigateToDestinationPage()
{
    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("image", SourceImage);
    Frame.Navigate(typeof(DestinationPage));
}

DestinationPage.xaml/DestinationPage.xaml.cs

<Image x:Name="DestinationImage"
       Width="400"
       Height="400"
       Stretch="Fill"
       Source="Assets/StoreLogo.png" />
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);

    ConnectedAnimation imageAnimation = 
        ConnectedAnimationService.GetForCurrentView().GetAnimation("image");
    if (imageAnimation != null)
    {
        imageAnimation.TryStart(DestinationImage);
    }
}

설명

ConnectedAnimationService의 instance 얻으려면 정적 GetForCurrentView 메서드를 호출합니다.

PrepareToAnimate를 호출할 때 메서드에서 반환된 새로 만든 ConnectedAnimation과 연결할 키를 입력합니다. 나중에 이 키를 사용하여 GetAnimation을 호출하여 동일한 애니메이션을 검색할 수 있습니다. 이렇게 하면 페이지 간에 ConnectedAnimation 개체에 대한 참조를 수동으로 전달할 필요 없이 두 페이지 간에 애니메이션을 연결할 수 있습니다.

ConnectedAnimationService의 전체 예제는 연결된 애니메이션 샘플을 참조하세요.

속성

DefaultDuration

애니메이션이 실행되는 기본 시간을 가져오거나 설정합니다.

DefaultEasingFunction

애니메이션에서 사용하는 기본 CompositionEasingFunction 을 가져오거나 설정합니다.

메서드

GetAnimation(String)

지정된 키를 사용하여 애니메이션을 반환합니다.

GetForCurrentView()

현재 보기에 대한 ConnectedAnimationService의 instance 반환합니다.

PrepareToAnimate(String, UIElement)

지정된 키 및 원본 요소와 연결된 연결된 애니메이션을 반환합니다.

적용 대상

추가 정보