mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
42 lines
1.1 KiB
QML
42 lines
1.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
GridLayout {
|
|
id: root
|
|
|
|
property bool vertical: true
|
|
columns: vertical ? 1 : -1
|
|
property real totalDuration: 250
|
|
property real interval: totalDuration / count
|
|
|
|
default property list<QtObject> choreographableChildren
|
|
readonly property int count: choreographableChildren.length
|
|
children: choreographableChildren
|
|
|
|
property bool shown: false
|
|
onShownChanged: {
|
|
// When hiding, hide all at once
|
|
if (!shown) {
|
|
for (var i = 0; i < count; i++) {
|
|
choreographableChildren[i].progress = 0;
|
|
}
|
|
}
|
|
// When showing, choreograph
|
|
root.choreographIndex = 0;
|
|
}
|
|
property int choreographIndex: count
|
|
Timer {
|
|
id: choreographTimer
|
|
interval: root.interval
|
|
property bool step: root.shown && root.choreographIndex < root.count
|
|
running: step
|
|
repeat: step
|
|
onTriggered: {
|
|
const index = root.choreographIndex;
|
|
root.choreographableChildren[index].progress = 1;
|
|
root.choreographIndex++;
|
|
}
|
|
}
|
|
}
|