forked from Shinonome/dots-hyprland
background clock: hour marks: put in loader, reduce behavior spam
This commit is contained in:
@@ -9,70 +9,42 @@ import QtQuick
|
||||
Item {
|
||||
id: root
|
||||
property real implicitSize: 135
|
||||
property real markLength: 10
|
||||
property real markLength: 12
|
||||
property real markWidth: 4
|
||||
property color color: Appearance.colors.colOnSecondaryContainer
|
||||
property color colOnBackground: Appearance.colors.colSecondaryContainer
|
||||
|
||||
property bool isEnabled: Config.options.background.clock.cookie.hourMarks
|
||||
property real padding: 10
|
||||
|
||||
Rectangle {
|
||||
opacity: root.isEnabled ? 1.0 : 0
|
||||
z: 0
|
||||
color: root.color
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: root.isEnabled ? root.implicitSize : root.implicitSize * 1.75
|
||||
implicitHeight: root.isEnabled ? root.implicitSize : root.implicitSize * 1.75 // Not using implicitHeight to allow smooth transition
|
||||
radius: implicitWidth / 2
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||
}
|
||||
Behavior on implicitHeight {
|
||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||
}
|
||||
}
|
||||
implicitWidth: root.implicitSize
|
||||
implicitHeight: root.implicitSize
|
||||
radius: width / 2
|
||||
|
||||
// Hour mark lines
|
||||
Rectangle {
|
||||
id: glowLines
|
||||
z: 1
|
||||
anchors.centerIn: parent
|
||||
// Hour mark lines
|
||||
Repeater {
|
||||
model: 12
|
||||
|
||||
Item {
|
||||
required property int index
|
||||
anchors.fill: parent
|
||||
|
||||
rotation: 360 / 12 * index
|
||||
opacity: root.isEnabled ? 1.0 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
leftMargin: root.isEnabled ? 50 : 75
|
||||
leftMargin: root.padding
|
||||
}
|
||||
implicitWidth: root.markLength
|
||||
implicitHeight: implicitWidth / 2
|
||||
implicitHeight: root.markWidth
|
||||
|
||||
radius: implicitWidth / 2
|
||||
radius: width / 2
|
||||
color: root.colOnBackground
|
||||
opacity: root.isEnabled ? 0.5 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
Behavior on anchors.leftMargin {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user