이 페이지에서

RotationAnimation QML Type

회전 값의 변화를 애니메이션으로 표현합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

PropertyAnimation

속성

상세 설명

RotationAnimation은 애니메이션 진행 중 회전 방향을 제어할 수 있게 해주는 특수한 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 값을 설정할 필요가 없다는 점에 유의하십시오. 편의상, 전환(transition)에서 사용될 때 RotationAnimation은 "rotation" 또는 "angle"이라는 이름의 모든 속성을 회전시킵니다. properties 또는 property 을 통해 사용자 정의 속성을 지정하여 이 동작을 재정의할 수 있습니다.

또한, Rectangle 는 기본 transformOrigin (즉, Item.Center)을 중심으로 회전된다는 점에 유의하십시오. 다른 변환 원점을 사용하려면 PropertyChanges 객체에서 원점을 설정하고, PropertyAction 를 사용하여 애니메이션 시작 시 변경 사항을 적용하십시오. 자세한 내용은 PropertyAction 문서를 참조하십시오.

다른 애니메이션 유형과 마찬가지로, RotationAnimation은 전환, 동작 및 속성 값 소스를 포함하여 다양한 방법으로 적용할 수 있습니다. Qt Quick 문서의 ‘애니메이션 및 전환’ 섹션에서는 애니메이션을 생성하는 다양한 방법을 보여줍니다.

또한 ‘ Qt Quick 의 애니메이션 및 전환 ’ 및 ‘Qt Quick 예제 - 애니메이션’도 참조하십시오 .

속성 문서

direction : enumeration

이 속성은 회전 방향을 나타냅니다.

사용 가능한 값은 다음과 같습니다:

상수설명
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 의 ‘애니메이션 및 전환(Animation and Transitions)’항목도 참조하십시오 .

© 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.