summary refs log tree commit diff
path: root/resources/qml/NhekoBusyIndicator.qml
blob: f3d1e8a4862b1bb92c9536280973859a6991c6de (plain) (blame)
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
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0

BusyIndicator {
    id: control

    contentItem: Item {
        implicitWidth: 64
        implicitHeight: 64

        Item {
            id: item

            height: Math.min(parent.height, parent.width)
            width: height
            opacity: control.running ? 1 : 0

            RotationAnimator {
                target: item
                running: control.visible && control.running
                from: 0
                to: 360
                loops: Animation.Infinite
                duration: 2000
            }

            Repeater {
                id: repeater

                model: 6

                Rectangle {
                    implicitWidth: radius * 2
                    implicitHeight: radius * 2
                    radius: item.height / 8
                    color: Nheko.colors.text
                    opacity: (index + 2) / (repeater.count + 2)
                    transform: [
                        Translate {
                            y: item.height / 2
                        },
                        Rotation {
                            angle: index / repeater.count * 360
                            origin.x: item.height / 2
                            origin.y: item.height / 2
                        }
                    ]
                }

            }

            Behavior on opacity {
                OpacityAnimator {
                    duration: 250
                }

            }

        }

    }

}