flyout animations
This commit is contained in:
parent
472ecf6783
commit
3a8b2d5b11
2 changed files with 73 additions and 40 deletions
|
|
@ -8,9 +8,23 @@ PanelWindow {
|
||||||
|
|
||||||
required property var screen
|
required property var screen
|
||||||
|
|
||||||
visible: M.FlyoutState.visible && M.FlyoutState.screen === root.screen
|
visible: _winVisible
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
property bool _winVisible: false
|
||||||
|
property bool _shown: M.FlyoutState.visible && M.FlyoutState.screen === root.screen
|
||||||
|
|
||||||
|
on_ShownChanged: {
|
||||||
|
if (_shown) {
|
||||||
|
_winVisible = true;
|
||||||
|
hideAnim.stop();
|
||||||
|
showAnim.start();
|
||||||
|
} else {
|
||||||
|
showAnim.stop();
|
||||||
|
hideAnim.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusiveZone: 0
|
WlrLayershell.exclusiveZone: 0
|
||||||
WlrLayershell.namespace: "nova-flyout"
|
WlrLayershell.namespace: "nova-flyout"
|
||||||
|
|
@ -18,15 +32,36 @@ PanelWindow {
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
|
|
||||||
// Flush below bar, centered on hovered item
|
|
||||||
margins.top: 0
|
margins.top: 0
|
||||||
margins.left: Math.max(0, Math.min(Math.round(M.FlyoutState.itemX - implicitWidth / 2), screen.width - implicitWidth))
|
margins.left: Math.max(0, Math.min(
|
||||||
|
Math.round(M.FlyoutState.itemX - implicitWidth / 2),
|
||||||
|
screen.width - implicitWidth
|
||||||
|
))
|
||||||
|
|
||||||
implicitWidth: label.implicitWidth + M.Theme.barPadding * 2
|
implicitWidth: label.implicitWidth + M.Theme.barPadding * 2
|
||||||
implicitHeight: label.implicitHeight + M.Theme.barPadding * 2
|
implicitHeight: label.implicitHeight + M.Theme.barPadding * 2
|
||||||
|
|
||||||
// Background matching bar style — square top corners so it looks
|
ParallelAnimation {
|
||||||
// flush / attached to the bar above, rounded bottom corners only
|
id: showAnim
|
||||||
|
NumberAnimation { target: content; property: "opacity"; to: 1; duration: 120; easing.type: Easing.OutCubic }
|
||||||
|
NumberAnimation { target: content; property: "y"; to: 0; duration: 150; easing.type: Easing.OutCubic }
|
||||||
|
}
|
||||||
|
|
||||||
|
ParallelAnimation {
|
||||||
|
id: hideAnim
|
||||||
|
NumberAnimation { target: content; property: "opacity"; to: 0; duration: 150; easing.type: Easing.InCubic }
|
||||||
|
NumberAnimation { target: content; property: "y"; to: -content.height; duration: 150; easing.type: Easing.InCubic }
|
||||||
|
onFinished: root._winVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: content
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: root.implicitHeight
|
||||||
|
opacity: 0
|
||||||
|
y: -height
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: M.Theme.base00
|
color: M.Theme.base00
|
||||||
|
|
@ -46,4 +81,5 @@ PanelWindow {
|
||||||
font.pixelSize: M.Theme.fontSize
|
font.pixelSize: M.Theme.fontSize
|
||||||
font.family: M.Theme.fontFamily
|
font.family: M.Theme.fontFamily
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,28 @@ import Quickshell.Wayland
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
// OSD overlay — slides out from the bar, centered on screen.
|
// OSD overlay — slides out from the bar, centered on screen.
|
||||||
// Attached to the bar (square top corners, flush below it).
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var screen
|
required property var screen
|
||||||
|
|
||||||
// Stay visible while animating out
|
visible: _winVisible
|
||||||
visible: M.OsdState.visible || hideAnim.running
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
property bool _winVisible: false
|
||||||
|
property bool _shown: M.OsdState.visible
|
||||||
|
|
||||||
|
on_ShownChanged: {
|
||||||
|
if (_shown) {
|
||||||
|
_winVisible = true;
|
||||||
|
hideAnim.stop();
|
||||||
|
showAnim.start();
|
||||||
|
} else {
|
||||||
|
showAnim.stop();
|
||||||
|
hideAnim.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusiveZone: 0
|
WlrLayershell.exclusiveZone: 0
|
||||||
WlrLayershell.namespace: "nova-osd"
|
WlrLayershell.namespace: "nova-osd"
|
||||||
|
|
@ -28,18 +40,6 @@ PanelWindow {
|
||||||
implicitWidth: 200
|
implicitWidth: 200
|
||||||
implicitHeight: 48
|
implicitHeight: 48
|
||||||
|
|
||||||
// Slide + fade animation state
|
|
||||||
property bool _shown: M.OsdState.visible
|
|
||||||
on_ShownChanged: {
|
|
||||||
if (_shown) {
|
|
||||||
hideAnim.stop();
|
|
||||||
showAnim.start();
|
|
||||||
} else {
|
|
||||||
showAnim.stop();
|
|
||||||
hideAnim.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
id: showAnim
|
id: showAnim
|
||||||
NumberAnimation { target: content; property: "opacity"; to: 1; duration: 150; easing.type: Easing.OutCubic }
|
NumberAnimation { target: content; property: "opacity"; to: 1; duration: 150; easing.type: Easing.OutCubic }
|
||||||
|
|
@ -50,6 +50,7 @@ PanelWindow {
|
||||||
id: hideAnim
|
id: hideAnim
|
||||||
NumberAnimation { target: content; property: "opacity"; to: 0; duration: 250; easing.type: Easing.InCubic }
|
NumberAnimation { target: content; property: "opacity"; to: 0; duration: 250; easing.type: Easing.InCubic }
|
||||||
NumberAnimation { target: content; property: "y"; to: -content.height; duration: 250; easing.type: Easing.InCubic }
|
NumberAnimation { target: content; property: "y"; to: -content.height; duration: 250; easing.type: Easing.InCubic }
|
||||||
|
onFinished: root._winVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
@ -60,7 +61,6 @@ PanelWindow {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
y: -height
|
y: -height
|
||||||
|
|
||||||
// Background — flush with bar above
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: M.Theme.base00
|
color: M.Theme.base00
|
||||||
|
|
@ -75,7 +75,6 @@ PanelWindow {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
// Icon
|
|
||||||
Text {
|
Text {
|
||||||
text: M.OsdState.icon
|
text: M.OsdState.icon
|
||||||
color: M.Theme.base0D
|
color: M.Theme.base0D
|
||||||
|
|
@ -84,7 +83,6 @@ PanelWindow {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress bar
|
|
||||||
Item {
|
Item {
|
||||||
width: 120
|
width: 120
|
||||||
height: 6
|
height: 6
|
||||||
|
|
@ -108,7 +106,6 @@ PanelWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Percentage
|
|
||||||
Text {
|
Text {
|
||||||
text: Math.round(M.OsdState.value * 100) + "%"
|
text: Math.round(M.OsdState.value * 100) + "%"
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue