이 페이지에서

XAnimator QML Type

X애니메이터 유형은 아이템의 x 위치를 애니메이션합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

Animator

상세 설명

Animator 유형은 일반 애니메이션 유형과 다릅니다. 애니메이터를 사용하면 렌더 스레드에서 애니메이션을 실행할 수 있으며 애니메이션이 완료되면 속성 값이 끝으로 점프합니다.

Item::x 값은 애니메이션이 완료된 후에 업데이트됩니다.

다음 코드 조각은 직사각형 항목과 함께 X애니메이터를 사용하는 방법을 보여줍니다.

Rectangle {
    id: xmovingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator {
        target: xmovingBox;
        from: 10;
        to: 0;
        duration: 1000
        running: true
    }
}

on 키워드를 사용하여 XAnimator를 아이템 인스턴스에 직접 연결할 수도 있습니다.

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator on x {
        from: 10;
        to: 0;
        duration: 1000
    }
}

참고: 애니메이터 유형은 스레드가 없는 렌더링 루프를 사용할 때 이점이 없습니다.

참고: 애플리케이션은 메인(GUI) 스레드에서 비용이 많이 드는 블록 작업을 수행하면서 애니메이션 콘텐츠를 표시하기 위해 애니메이터에 의존하기보다는 멀티 스레드, 비동기 원칙에 기반한 디자인을 고려하는 것이 좋습니다. 길고 블록적인 작업 대신 QML의 WorkerScriptasynchronous image loading, 작업자 스레드, 병렬 알고리즘, Qt Concurrent, 코루틴을 사용하여 전체 애플리케이션과 UI가 항상 반응성을 유지하도록 하세요.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.