ParentAnimation QML Type

부모 값의 변화를 애니메이션으로 표시합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

Animation

속성

상세 설명

부모 애니메이션은 Item 에 대한 부모 변경 애니메이션을 적용하는 데 사용됩니다.

예를 들어 다음 ParentChange 을 클릭하면 blueRectredRect 의 자식으로 변경됩니다. 전환 중에 적용될 NumberAnimation 을 정의하는 ParentAnimation을 포함하면 항목이 새 부모로 이동할 때 원활하게 애니메이션이 적용됩니다:

import QtQuick

Item {
    width: 200; height: 100

    Rectangle {
        id: redRect
        width: 100; height: 100
        color: "red"
    }

    Rectangle {
        id: blueRect
        x: redRect.width
        width: 50; height: 50
        color: "blue"

        states: State {
            name: "reparented"
            ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
        }

        transitions: Transition {
            ParentAnimation {
                NumberAnimation { properties: "x,y"; duration: 1000 }
            }
        }

        MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
    }
}

부모 애니메이션에는 애니메이션을 얼마든지 포함할 수 있습니다. 이러한 애니메이션은 병렬로 실행되며, 순차적으로 실행하려면 SequentialAnimation 내에 정의합니다.

클리핑이 활성화된 항목 간에 부모를 변경하는 경우와 같이 클리핑이 활성화되지 않은 다른 항목을 통해 부모 변경에 애니메이션을 적용하는 것이 유용한 경우가 있습니다. 이러한 항목은 via 속성을 사용하여 설정할 수 있습니다.

부모 애니메이션은 일반적으로 ParentChange 과 함께 Transition 내에서 사용됩니다. 이 방식으로 사용하면 상태 변경 중에 발생한 모든 ParentChange 에 애니메이션이 적용됩니다. target 속성을 사용하여 특정 대상 항목을 설정하면 이 속성을 재정의할 수 있습니다.

애니메이션 및 전환은 Qt QuickQt Quick 예제 - 애니메이션을참조하세요 .

속성 문서

newParent : Item

애니메이션을 적용할 새 부모입니다.

ParentAnimationTransition 내에 정의된 경우 이 값은 Transition 의 최종 상태에 정의된 값으로 기본값이 지정됩니다.


target : Item

부모를 다시 지정할 항목입니다.

전환에서 사용할 때 대상을 지정하지 않으면 모든 ParentChange 발생 시 ParentAnimation 에 의해 애니메이션이 적용됩니다.


via : Item

다시 부모로 지정할 항목입니다. 이렇게 하면 이전 부모와 새 부모가 모두 클리핑된 경우 클리핑되지 않은 애니메이션을 실행할 수 있습니다.

ParentAnimation {
    target: myItem
    via: topLevelItem
    // ...
}

참고: Transition 에서 ParentChange 과 함께 ParentAnimation 을 사용하는 경우에만 작동합니다.


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