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

(image error) Size: 335 KiB

Binary file not shown.

Before

(image error) 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

(image error) Size: 402 KiB

Binary file not shown.

After

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

View file

@ -8,13 +8,32 @@ import Quickshell.Wayland
import Quickshell.Hyprland
import Quickshell.Services.Pam
import ".."
import "../.."
import "../background"
Singleton {
id: root
function init() {}
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: {
if (locked) {
lockContextLoader.active = true;
@ -101,7 +120,7 @@ Singleton {
id: backgroundImage
anchors.fill: parent
screen: lockSurface.screen
visible: !lockAnim.running
visible: root.lockSlide == 1.0
asynchronous: true
}
@ -112,23 +131,13 @@ Singleton {
visible: false
width: lockSurface.width
height: lockSurface.height
}
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]
y: -lockSurface.height * (1.0 - root.lockSlide)
}
onVisibleChanged: {
if (visible) {
lockContent.y = -lockSurface.height
lockContent.visible = true;
lockAnim.running = true;
root.animState = true;
}
}
@ -137,8 +146,7 @@ Singleton {
function onLockedChanged() {
if (!locked) {
lockAnim.to = -lockSurface.height
lockAnim.running = true;
root.animState = false;
}
}
}