matrixion/qml/NhekoBusyIndicator.qml

61 lines
1.7 KiB
QML
Raw Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-03-05 02:35:15 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
2020-11-15 06:52:49 +03:00
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko
2020-11-15 06:52:49 +03:00
BusyIndicator {
id: control
contentItem: Item {
2020-11-16 01:14:47 +03:00
implicitHeight: 64
2022-04-16 03:13:01 +03:00
implicitWidth: 64
2020-11-15 06:52:49 +03:00
Item {
id: item
height: Math.min(parent.height, parent.width)
opacity: control.running ? 1 : 0
2022-04-16 03:13:01 +03:00
width: height
Behavior on opacity {
OpacityAnimator {
duration: 250
}
}
2020-11-15 06:52:49 +03:00
RotationAnimator {
2022-04-16 03:13:01 +03:00
duration: 2000
2020-11-15 06:52:49 +03:00
from: 0
loops: Animation.Infinite
2022-04-16 03:13:01 +03:00
running: control.visible && control.running
target: item
to: 360
2020-11-15 06:52:49 +03:00
}
Repeater {
id: repeater
model: 6
Rectangle {
2022-04-11 05:18:16 +03:00
color: timelineRoot.palette.text
2022-04-16 03:13:01 +03:00
implicitHeight: radius * 2
implicitWidth: radius * 2
2020-11-15 06:52:49 +03:00
opacity: (index + 2) / (repeater.count + 2)
2022-04-16 03:13:01 +03:00
radius: item.height / 6
2020-11-15 06:52:49 +03:00
transform: [
Translate {
y: -Math.min(item.width, item.height) * 0.5 + item.height / 6
},
Rotation {
angle: index / repeater.count * 360
origin.x: item.height / 2
origin.y: item.height / 2
}
]
}
}
}
}
}