PropertyAction QML Type

애니메이션 중 즉각적인 프로퍼티 변경을 지정합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

Animation

속성

상세 설명

PropertyAction은 애니메이션 중에 즉각적인 속성 변경을 지정하는 데 사용됩니다. 프로퍼티 변경은 애니메이션이 적용되지 않습니다.

애니메이션 중에 애니메이션이 적용되지 않는 속성 값을 설정할 때 유용합니다.

예를 들어, 다음은 이미지의 opacity 속성을 .5 로 설정하고 이미지 너비를 애니메이션한 다음 opacity 을 다시 1 로 설정하는 SequentialAnimation 입니다:

SequentialAnimation {
    PropertyAction { target: img; property: "opacity"; value: .5 }
    NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
    PropertyAction { target: img; property: "opacity"; value: 1 }
}

PropertyAction은 Transition 중에 속성 변경이 일어날 정확한 지점을 설정하는 데에도 유용합니다. 예를 들어 State 에서 PropertyChanges 을 사용하여 특정 transformOrigin 을 중심으로 항목을 회전하는 경우 다음과 같이 구현할 수 있습니다:

Item {
    width: 400; height: 400

    Rectangle {
        id: rect
        width: 200; height: 100
        color: "red"

        states: State {
            name: "rotated"
            PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
        }

        transitions: Transition {
            RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
        }

        MouseArea {
            anchors.fill: parent
            onClicked: rect.state = "rotated"
        }
    }
}

그러나 이 코드를 사용하면 전환이 끝날 때 값을 정의하기 위해 State 을 사용하므로 transformOrigin 은 애니메이션이 끝날 때까지 설정되지 않습니다. 애니메이션은 기본값 transformOrigin 에서 회전한 다음 Item.BottomRight 으로 이동합니다. 이 문제를 해결하려면 RotationAnimation 이 시작되기 전에 PropertyAction을 삽입합니다:

transitions: Transition {
    SequentialAnimation {
        PropertyAction { target: rect; property: "transformOrigin" }
        RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
    }
}

그러면 transformOrigin 프로퍼티가 Transition 의 끝 상태(즉, PropertyAction 객체에 정의된 값)로 즉시 설정되어 회전 애니메이션이 올바른 트랜스폼 원점에서 시작됩니다.

Qt Quick 의 애니메이션 및 전환과 Qt Qml.

프로퍼티 문서

properties : string

property : string

target : QtObject

targets : list<QtObject> [read-only]

이러한 속성에 따라 이 작업의 영향을 받는 항목과 해당 속성이 결정됩니다.

다양한 상황에서 이러한 속성이 어떻게 해석되는지에 대한 자세한 내용은 corresponding PropertyAnimation 문서에 나와 있습니다.

exclude도 참조하세요 .


exclude : list<QtObject> [read-only]

이 속성은 이 작업의 영향을 받지 않아야 하는 개체를 보유합니다.

targets도 참조하세요 .


value : var

이 속성은 속성에 설정할 값을 보유합니다.

PropertyActionTransition 또는 Behavior 내에 정의된 경우 이 값은 Transition 의 최종 상태에 정의된 값 또는 Behavior 를 트리거한 속성 변경 값으로 기본값이 지정됩니다.


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