summaryrefslogtreecommitdiffstats
path: root/examples/grpc/magic8ball/WaitingAnimation.qml
blob: 16043ea46a38ac527f293cfd6eca42aa189c50f7 (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Rectangle {
    id: root

    property bool runAnimation: false

    anchors.centerIn: parent
    width: 100
    height: width

    color: "transparent"

    Row {
        id: scene
        anchors.centerIn: parent
        spacing: 12

        Repeater {
            model: 4
            ProgressDot {}
        }
    }

    ScaleAnimator on scale {
        id: openning
        target: root
        from: 0.3
        to: 1
        duration: 1000
        running: root.runAnimation
        onStopped: closing.start()
        easing.amplitude: 6.0
        easing.period: 2.5
    }

    ScaleAnimator on scale {
        id: closing
        target: root
        from: 1
        to: 0.3
        duration: 1000
        running: false
        onStopped: {
            if (root.runAnimation)
                openning.start()
        }
        easing.amplitude: 6.0
        easing.period: 2.5
    }
}