Give notch-mode panels their own liquid drop animation
With no bar to unroll from, attached drawers in notch mode now open as a glass bead that swells out under the clicked island icon on a tapered neck, flips the wallpaper behind it like a lens, then widens into the panel and lets go. NotchDrop draws it with a signed-distance shader; BarDrawer swaps to it in notch mode, and hosts pass the icon's screen x. The notch-shaped wallpaper picker keeps its own motion. Notch settings gain panel opening and closing speeds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6ad9c0b17e
commit
b03bd77941
14 files changed
+287
-9
No files matched your search
@@ -21,17 +21,27 @@ Item {
|
||||
// "slide" unrolls out of the bar; "drop" falls into place and away
|
||||
// downwards; "fade" fades in place; "shrink" grows from / shrinks to nothing.
|
||||
property string style: "slide"
|
||||
// Notch mode has no bar to unroll from: attached drawers use NotchDrop
|
||||
// instead, with the notch's own panel speeds. Opt out with `liquid: false`.
|
||||
property bool liquid: ShellState.notchMode && attached
|
||||
// Screen x of the icon the drawer belongs to; the drop comes out under it.
|
||||
property real sourceScreenX: -1
|
||||
// Fill and timing; notch mode passes the notch's own.
|
||||
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
|
||||
property real openDuration: Theme.duration * 1.8
|
||||
property real closeDuration: Theme.duration
|
||||
readonly property bool unrolls: style === "slide"
|
||||
readonly property bool unrolls: style === "slide" && !liquid
|
||||
property real progress: open ? 1 : 0
|
||||
readonly property real revealed: unrolls ? Math.max(0, contentHeight * progress) : contentHeight
|
||||
// Drop moves down on the way in and on the way out.
|
||||
property real dropFrom: -1
|
||||
onOpenChanged: dropFrom = open ? -1 : 1
|
||||
readonly property bool shown: progress > 0.001
|
||||
// NotchDrop's content fade: in once the panel has its size, out first.
|
||||
readonly property real dropContent: {
|
||||
const t = Math.min(1, Math.max(0, (progress - 0.82) / 0.18));
|
||||
return t * t * (3 - 2 * t);
|
||||
}
|
||||
readonly property bool settled: !anim.running && open
|
||||
// Input/hover region: the full body as soon as it opens (the pointer may
|
||||
// reach the drawer before the reveal finishes), the visible part while closing.
|
||||
@@ -43,8 +53,9 @@ Item {
|
||||
Behavior on progress {
|
||||
NumberAnimation {
|
||||
id: anim
|
||||
duration: root.open ? root.openDuration : root.closeDuration
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: root.liquid ? (root.open ? Theme.notchPanelOpenDuration : Theme.notchPanelCloseDuration) : root.open ? root.openDuration : root.closeDuration
|
||||
// NotchDrop eases each phase itself.
|
||||
easing.type: root.liquid ? Easing.Linear : Easing.BezierSpline
|
||||
easing.bezierCurve: root.open ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1]
|
||||
}
|
||||
}
|
||||
@@ -69,14 +80,32 @@ Item {
|
||||
id: motion
|
||||
width: root.width
|
||||
height: root.height
|
||||
opacity: root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
|
||||
scale: root.style === "shrink" ? Math.max(0.001, root.progress) : 1
|
||||
opacity: root.liquid ? 1 : root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
|
||||
scale: !root.liquid && root.style === "shrink" ? Math.max(0.001, root.progress) : 1
|
||||
transformOrigin: Item.Center
|
||||
transform: Translate {
|
||||
y: root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
|
||||
y: !root.liquid && root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
|
||||
}
|
||||
Loader {
|
||||
active: root.liquid
|
||||
width: root.width
|
||||
sourceComponent: NotchDrop {
|
||||
width: root.width
|
||||
progress: root.progress
|
||||
bodyX: root.ear
|
||||
bodyWidth: root.contentWidth
|
||||
bodyHeight: root.contentHeight
|
||||
sourceX: root.sourceScreenX < 0 ? -1 : root.sourceScreenX - root.screenX
|
||||
topSpace: Math.max(0, root.y)
|
||||
islandBottom: Math.round((BarDrawers.bottom - BarDrawers.height) / 2) + BarDrawers.height - root.y
|
||||
fillColor: root.fillColor
|
||||
screenName: root.screenName
|
||||
screenX: root.screenX
|
||||
}
|
||||
}
|
||||
DrawerShape {
|
||||
id: shape
|
||||
visible: !root.liquid
|
||||
bodyWidth: root.contentWidth
|
||||
bodyHeight: root.revealed
|
||||
ear: BarDrawers.ear
|
||||
@@ -94,7 +123,10 @@ Item {
|
||||
width: root.contentWidth
|
||||
height: root.contentHeight
|
||||
y: root.revealed - root.contentHeight
|
||||
opacity: root.unrolls ? Math.min(1, root.progress * 1.6) : 1
|
||||
opacity: root.liquid ? root.dropContent : root.unrolls ? Math.min(1, root.progress * 1.6) : 1
|
||||
transform: Translate {
|
||||
y: root.liquid ? (1 - root.dropContent) * 6 : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user