RotationAnimation QML Type
회전 값의 변화를 애니메이션으로 표현합니다. 더 보기...
Import Statement: | import QtQuick |
Inherits: |
속성
자세한 설명
회전 애니메이션은 애니메이션 중 회전 방향을 제어할 수 있는 특수한 PropertyAnimation 입니다.
기본적으로 숫자 변화 방향으로 회전하며, 0에서 240으로 회전하면 시계 방향으로 240도 회전하고, 240에서 0으로 회전하면 시계 반대 방향으로 240도 회전합니다. direction 속성을 설정하여 회전할 방향을 지정할 수 있습니다.
다음 예시에서는 RotationAnimation을 사용하여 최단 경로를 통해 상태 간 회전에 애니메이션을 적용합니다:
import QtQuick Item { width: 300; height: 300 Rectangle { id: rect width: 150; height: 100; anchors.centerIn: parent color: "red" antialiasing: true states: State { name: "rotated" PropertyChanges { target: rect; rotation: 180 } } transitions: Transition { RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise } } } MouseArea { anchors.fill: parent; onClicked: rect.state = "rotated" } }
RotationAnimation에 target
값을 설정할 필요가 없다는 것을 알 수 있습니다. 편의를 위해 전환에 사용할 경우 RotationAnimation은 "rotation" 또는 "angle"이라는 이름의 모든 프로퍼티를 회전시킵니다. properties 또는 property 을 통해 자체 프로퍼티를 제공하여 이를 재정의할 수 있습니다.
또한 Rectangle 은 기본값인 transformOrigin ( Item.Center
)을 중심으로 회전합니다. 다른 트랜스폼 원점을 사용하려면 PropertyChanges 객체에서 원점을 설정하고 PropertyAction 을 사용하여 애니메이션 시작 시 변경 사항을 적용합니다. 자세한 내용은 PropertyAction 문서를 참조하세요.
다른 애니메이션 유형과 마찬가지로 회전 애니메이션은 트랜지션, 동작 및 속성 값 소스 등 다양한 방법으로 적용할 수 있습니다. 애니메이션 및 트랜지션( Qt Quick )의 애니메이션 및 트랜지션 문서에는 애니메이션을 만드는 다양한 방법이 나와 있습니다.
애니메이션 및 전환은 Qt Quick 및 Qt Quick 예제 - 애니메이션을참조하세요 .
프로퍼티 문서
direction : enumeration |
이 프로퍼티는 회전 방향을 보유합니다.
가능한 값은 다음과 같습니다:
Constant | 설명 |
---|---|
RotationAnimation.Numerical | (기본값) 두 숫자 사이를 선형 보간하여 회전합니다. 10 에서 350 로 회전하면 시계 방향으로 340도 회전합니다. |
RotationAnimation.Clockwise | 두 값 사이를 시계 방향으로 회전합니다. |
RotationAnimation.Counterclockwise | 두 값 사이를 시계 반대 방향으로 회전합니다. |
RotationAnimation.Shortest | 가장 짧은 애니메이션 경로를 생성하는 방향으로 회전합니다. 10 에서 350 로 회전하면 시계 반대 방향으로 20 도 회전합니다. |
from : real |
이 속성은 애니메이션의 시작 값을 보유합니다.
예를 들어 다음 애니메이션은 angle
값이 100에 도달할 때까지 적용되지 않습니다:
Item { states: [ // ... ] transitions: Transition { RotationAnimation { properties: "angle"; from: 100; duration: 2000 } } }
RotationAnimation 가 Transition 또는 Behavior 내에 정의된 경우 이 값은 Transition 의 시작 상태에 정의된 값 또는 Behavior 가 트리거되는 순간의 속성 현재 값으로 기본값이 지정됩니다.
Qt Quick 의 애니메이션 및 전환을참조하세요 .
to : real |
이 속성은 애니메이션의 종료 값을 보유합니다.
RotationAnimation 가 Transition 또는 Behavior 내에 정의된 경우 이 값은 Transition 의 종료 상태 또는 Behavior 를 트리거한 속성 변경 값에 정의된 값을 기본값으로 합니다.
Qt Quick 의 애니메이션 및 전환을참조하세요 .
© 2025 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.