quickshell-rice/quickshell/components/VinylDisc.qml

69 lines
1.8 KiB
QML

import QtQuick
Item {
id: root
implicitWidth: 54
implicitHeight: 54
property string artUrl: ""
property bool isPlaying: false
property real size: Math.min(width, height)
// Outer Stationary Circular Mask Container (Enforces 1:1 Aspect Ratio)
Rectangle {
id: discMask
width: root.size
height: root.size
anchors.centerIn: parent
radius: root.size / 2
color: "#181920"
border.color: "#44475a"
border.width: 1
clip: true
// Inner Rotating Disc Item
Item {
anchors.fill: parent
RotationAnimation on rotation {
running: root.isPlaying
loops: Animation.Infinite
from: 0
to: 360
duration: 6000
}
// Entire Circular Album Cover Image
Image {
id: albumImg
anchors.fill: parent
source: root.artUrl
fillMode: Image.PreserveAspectCrop
visible: status === Image.Ready && root.artUrl !== ""
}
// Dracula Gradient Fallback for Web/Browser Sources without artUrl
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#bd93f9" }
GradientStop { position: 1.0; color: "#ff79c6" }
}
visible: !albumImg.visible
}
// Center Spindle Hole
Rectangle {
anchors.centerIn: parent
width: parent.width * 0.18
height: parent.height * 0.18
radius: width / 2
color: "#282a36"
border.color: "#44475a"
border.width: 1
}
}
}
}