aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimations/data/restartNestedAnimationGroupWhenDirty.qml
blob: da0de9644817d01069e49758dccbd4cc31323673 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import QtQuick

Rectangle {
    width: 300
    height: 300

    // test ParallelAnimation in SequentialAnimation
    Rectangle {
        id: line0
        y: 100
        width: parent.width
        height: 2
        color: "blue"
    }
    Rectangle {
        id: target0
        objectName: "target0"
        y: 100
        anchors.verticalCenter: line0.verticalCenter
        height: line0.height * 5
        width: height
        color: "red"
        radius: height/2

        property bool onFinishedCalled : false;

        SequentialAnimation {
            id: seqAnim0
            objectName: "seqAnim0"
            loops: 2
            running: true
            ParallelAnimation {
                NumberAnimation {
                    id: anim0
                    target: target0
                    property: "x"
                    from: 0
                    to: 50
                    duration: 500
                }
            }
            Component.onCompleted: anim0.to = 290
            onFinished: target0.onFinishedCalled = true
        }
    }

    // test SequentialAnimation in ParallelAnimation
    Rectangle {
        id: line1
        y: 200
        width: parent.width
        height: 2
        color: "blue"
    }
    Rectangle {
        id: target1
        objectName: "target1"
        anchors.verticalCenter: line1.verticalCenter
        height: line1.height * 5
        width: height
        color: "yellow"
        radius: height/2

        property bool onFinishedCalled : false;

        ParallelAnimation {
            id: parAnim0
            objectName: "parAnim0"
            loops: 2
            running: true
            SequentialAnimation {
                NumberAnimation {
                    id: anim1
                    target: target1
                    property: "x"
                    from: 0
                    to: 50
                    duration: 500
                }
            }
            Component.onCompleted: anim1.to = 290
            onFinished: target1.onFinishedCalled = true
        }
    }

    Timer {
        interval: 400
        running: true
        onTriggered: {
            seqAnim0.pause()
            parAnim0.pause()
            anim0.to = 140
            anim1.to = 140
        }
    }
}