aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/propertyaction-sequential.qml
blob: c2f029e709405a7f71b53289748ae278dc9757e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick

Row {

    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 }
            }

            //! [sequential]
            transitions: Transition {
                SequentialAnimation {
                    PropertyAction { target: rect; property: "transformOrigin" }
                    RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
                }
            }
            //! [sequential]

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