RotationAnimator QML Type
RotationAnimator 유형은 Item의 회전 애니메이션을 처리합니다. 더 보기...
| Import Statement: | import QtQuick |
| Inherits: |
속성
- direction : enumeration
상세 설명
Animator 유형은 일반적인 애니메이션 유형과 다릅니다. Animator를 사용할 경우, 애니메이션은 렌더 스레드에서 실행될 수 있으며, 애니메이션이 완료되면 속성 값이 끝 지점으로 바로 이동합니다.
Item::rotation 의 값은 애니메이션이 끝난 후에 업데이트됩니다.
다음 코드 예제는 RotationAnimator를 Rectangle 항목과 함께 사용하는 방법을 보여줍니다.
Rectangle {
id: rotatingBox
width: 50
height: 50
color: "lightsteelblue"
RotationAnimator {
target: rotatingBox;
from: 0;
to: 360;
duration: 1000
running: true
}
}on 키워드를 사용하여 RotationAnimator를 Item 인스턴스의 rotation 속성에 직접 연결할 수도 있습니다.
Rectangle {
width: 50
height: 50
color: "lightsteelblue"
RotationAnimator on rotation {
from: 0;
to: 360;
duration: 1000
}
}참고: 비스레드 렌더 루프를 사용하는 경우Animator 유형은 아무런 이점이 없습니다.
참고: 애플리케이션에서는 메인(GUI) 스레드에서 리소스 소모가 크고 차단되는 작업을 수행하는 동안 애니메이터에 의존하여 애니메이션 콘텐츠를 표시하기보다는, 멀티스레드 및 비동기 원칙에 기반한 설계를 고려하는 것이 좋습니다 . 길고 차단되는 작업 대신, QML에서는 ` WorkerScript ` 및 ` asynchronous image loading `을, C++에서는 워커 스레드, 병렬 알고리즘 Qt Concurrent, 코루틴을 사용하는 것이 좋습니다. 이를 통해 전체 애플리케이션과 UI가 항상 반응성을 유지할 수 있습니다.
Item::transformOrigin 및 ScaleAnimator도 참조하십시오 .
속성 문서
direction : enumeration
이 속성은 회전 방향을 나타냅니다.
사용 가능한 값은 다음과 같습니다:
| 상수 | 설명 |
|---|---|
RotationAnimator.Numerical | (기본값) 두 숫자 사이의 선형 보간을 통해 회전합니다. 10에서 350으로 회전하면 시계 방향으로 340도 회전합니다. |
RotationAnimator.Clockwise | 두 값 사이에서 시계 방향으로 회전합니다. |
RotationAnimator.Counterclockwise | 두 값 사이에서 시계 반대 방향으로 회전 |
RotationAnimator.Shortest | 애니메이션 경로가 가장 짧아지는 방향으로 회전합니다. 10에서 350으로 회전하면 시계 반대 방향으로 20도 회전합니다. |
© 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.