shell: new lock anim for bkg and bar

This commit is contained in:
outfoxxed 2025-01-20 03:42:11 -08:00
parent c70822c1f5
commit f6caa3e209
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
8 changed files with 48 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -1,9 +0,0 @@
import QtQuick
import Quickshell
Image {
required property ShellScreen screen;
source: Qt.resolvedUrl(screen.name == "DP-1" ? "5120x1440.png" : "1920x1080.png")
asynchronous: false
cache: false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -0,0 +1,19 @@
import QtQuick
import Quickshell
import "../lock" as Lock
Item {
id: root
required property ShellScreen screen;
property real slideAmount: 1.0 - Lock.Controller.bkgSlide
property alias asynchronous: image.asynchronous;
readonly property real remainingSize: image.sourceSize.height - root.height
Image {
id: image
source: Qt.resolvedUrl((screen?.name == "DP-1" ?? false) ? "5120x1728.png" : "1920x1296.png")
y: -(root.slideAmount * root.remainingSize)
}
}

View file

@ -16,7 +16,6 @@ PanelWindow {
} }
width: 70 width: 70
margins.left: Lock.Controller.locked ? -width : 0
exclusiveZone: width - margins.left exclusiveZone: width - margins.left
color: "transparent" color: "transparent"
@ -38,10 +37,13 @@ PanelWindow {
Rectangle { Rectangle {
id: barRect id: barRect
x: 10 - Lock.Controller.bkgSlide * (barRect.width + 10)
width: parent.width - 15
anchors { anchors {
fill: parent top: parent.top
bottom: parent.bottom
margins: 10 margins: 10
rightMargin: 5
} }
color: ShellGlobals.colors.bar color: ShellGlobals.colors.bar

View file

@ -8,13 +8,32 @@ import Quickshell.Wayland
import Quickshell.Hyprland import Quickshell.Hyprland
import Quickshell.Services.Pam import Quickshell.Services.Pam
import ".." import ".."
import "../.." import "../background"
Singleton { Singleton {
id: root id: root
function init() {} function init() {}
property bool locked: false; property bool locked: false;
property bool animState: false;
property real lockSlide: animState ? 1.0 : 0.0
property real bkgSlide: animState ? 1.0 : 0.0
Behavior on lockSlide {
NumberAnimation {
duration: 600
easing.type: Easing.BezierSpline
easing.bezierCurve: [0.0, 0.75, 0.15, 1.0, 1.0, 1.0]
}
}
Behavior on bkgSlide {
NumberAnimation {
duration: 600
easing.type: Easing.OutCirc
}
}
onLockedChanged: { onLockedChanged: {
if (locked) { if (locked) {
lockContextLoader.active = true; lockContextLoader.active = true;
@ -101,7 +120,7 @@ Singleton {
id: backgroundImage id: backgroundImage
anchors.fill: parent anchors.fill: parent
screen: lockSurface.screen screen: lockSurface.screen
visible: !lockAnim.running visible: root.lockSlide == 1.0
asynchronous: true asynchronous: true
} }
@ -112,23 +131,13 @@ Singleton {
visible: false visible: false
width: lockSurface.width width: lockSurface.width
height: lockSurface.height height: lockSurface.height
} y: -lockSurface.height * (1.0 - root.lockSlide)
NumberAnimation {
id: lockAnim
target: lockContent
property: "y"
to: 0
duration: 600
easing.type: Easing.BezierSpline
easing.bezierCurve: [0.0, 0.75, 0.15, 1.0, 1.0, 1.0]
} }
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
lockContent.y = -lockSurface.height
lockContent.visible = true; lockContent.visible = true;
lockAnim.running = true; root.animState = true;
} }
} }
@ -137,8 +146,7 @@ Singleton {
function onLockedChanged() { function onLockedChanged() {
if (!locked) { if (!locked) {
lockAnim.to = -lockSurface.height root.animState = false;
lockAnim.running = true;
} }
} }
} }