noctalia-shell/Modules/Audio/LinearSpectrum.qml
quadbyte 93b60e9002 Cava: Switched to ascii mode - buttery smooth
Fixes a nasty glitch where band would jump abruptly due to wrong data
parsing.
2025-08-13 22:52:28 -04:00

46 lines
969 B
QML

import QtQuick
import qs.Services
Item {
id: root
property color fillColor: Colors.accentPrimary
property color strokeColor: Colors.textPrimary
property int strokeWidth: 0
property var values: []
readonly property real xScale: width / (values.length * 2)
Repeater {
model: values.length
Rectangle {
property real amp: values[values.length - 1 - index]
color: fillColor
border.color: strokeColor
border.width: strokeWidth
antialiasing: true
width: xScale * 0.5
height: root.height * amp
x: index * xScale
y: root.height - height
}
}
Repeater {
model: values.length
Rectangle {
property real amp: values[index]
color: fillColor
border.color: strokeColor
border.width: strokeWidth
antialiasing: true
width: xScale * 0.5
height: root.height * amp
x: (values.length + index) * xScale
y: root.height - height
}
}
}