aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/MusicVisualizer.qml
blob: f0c322736c0b598555fcaebad1e05cde116b218f (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
import QtQuick

Row {
    id: root
    property bool active: false
    property color color: Theme.accent
    spacing: 2
    height: 16

    Repeater {
        model: 4
        delegate: Rectangle {
            id: bar
            width: 3
            height: root.active ? 4 + Math.random() * (root.height - 4) : 4
            radius: 1.5
            color: root.color

            Timer {
                running: root.active
                interval: 100 + Math.random() * 200
                repeat: true
                onTriggered: {
                    bar.height = 4 + Math.random() * (root.height - 4);
                }
            }

            Behavior on height {
                NumberAnimation {
                    duration: 150
                    easing.type: Easing.OutCubic
                }
            }
        }
    }
}