needs some more work
This commit is contained in:
parent
8845996c8c
commit
41ad28610a
4 changed files with 146 additions and 81 deletions
85
GlassSurface.qml
Normal file
85
GlassSurface.qml
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
id: root
|
||||||
|
color: "transparent"
|
||||||
|
border.width: 1
|
||||||
|
border.color: Qt.rgba(1, 1, 1, 0.1)
|
||||||
|
|
||||||
|
property var source
|
||||||
|
property real time: 0.5
|
||||||
|
property real strength: 0.3
|
||||||
|
property real speed: 0.25
|
||||||
|
property real scale: 3.0
|
||||||
|
property real edgeReflectionStrength: 0.2
|
||||||
|
property real edgeReflectionWidth: 0
|
||||||
|
|
||||||
|
// Blur
|
||||||
|
ShaderEffectSource {
|
||||||
|
id: blurredBackground
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceItem: root.source
|
||||||
|
sourceRect: Qt.rect(root.x, root.y, root.width, root.height)
|
||||||
|
hideSource: false
|
||||||
|
live: true
|
||||||
|
}
|
||||||
|
|
||||||
|
FastBlur {
|
||||||
|
id: backgroundBlur
|
||||||
|
anchors.fill: parent
|
||||||
|
source: blurredBackground
|
||||||
|
radius: 16
|
||||||
|
transparentBorder: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Liquid glass shader warp
|
||||||
|
ShaderEffect {
|
||||||
|
anchors.fill: parent
|
||||||
|
fragmentShader: "root:shaders/liquid-glass.frag.qsb"
|
||||||
|
|
||||||
|
property real time: root.time
|
||||||
|
property real flowSpeed: root.speed
|
||||||
|
property real warpStrength: root.strength
|
||||||
|
property real scale: root.scale
|
||||||
|
property real edgeReflectionStrength: root.edgeReflectionStrength
|
||||||
|
property real edgeReflectionWidth: root.edgeReflectionWidth
|
||||||
|
|
||||||
|
property variant source: ShaderEffectSource {
|
||||||
|
sourceItem: backgroundBlur
|
||||||
|
hideSource: false
|
||||||
|
live: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subtle glass overlay
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: 1
|
||||||
|
height: parent.height * 0.3
|
||||||
|
radius: parent.radius - 1
|
||||||
|
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 0.0
|
||||||
|
color: Qt.rgba(1, 1, 1, 0.08)
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 0.5
|
||||||
|
color: Qt.rgba(1, 1, 1, 0.0)
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 1.0
|
||||||
|
color: Qt.rgba(1, 1, 1, 0.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ void main() {
|
||||||
|
|
||||||
vec4 glassColor = vec4(r, g, b, 1.0);
|
vec4 glassColor = vec4(r, g, b, 1.0);
|
||||||
|
|
||||||
// Simple edge reflection - back to what worked
|
// Simple edge reflection
|
||||||
float edgeWidth = ubuf.edgeReflectionWidth;
|
float edgeWidth = ubuf.edgeReflectionWidth;
|
||||||
|
|
||||||
// Calculate distance from edges
|
// Calculate distance from edges
|
||||||
|
|
@ -84,16 +84,16 @@ void main() {
|
||||||
// Simple reflection logic
|
// Simple reflection logic
|
||||||
if (minDistToEdge == distFromLeft) {
|
if (minDistToEdge == distFromLeft) {
|
||||||
// Left edge - flip horizontally
|
// Left edge - flip horizontally
|
||||||
reflectionUV.x = 1.0 - distortedUV.x;
|
reflectionUV.x = 0.5 - distortedUV.x;
|
||||||
} else if (minDistToEdge == distFromRight) {
|
} else if (minDistToEdge == distFromRight) {
|
||||||
// Right edge - keep as is but sample from further right
|
// Right edge - keep as is but sample from further right
|
||||||
reflectionUV.x = distortedUV.x + 0.1;
|
reflectionUV.x = distortedUV.x + 0.1;
|
||||||
} else if (minDistToEdge == distFromTop) {
|
} else if (minDistToEdge == distFromTop) {
|
||||||
// Top edge - flip vertically
|
// Top edge - flip vertically
|
||||||
reflectionUV.y = 1.0 - distortedUV.y;
|
reflectionUV.y = 0.5 - distortedUV.y;
|
||||||
} else {
|
} else {
|
||||||
// Bottom edge - flip vertically
|
// Bottom edge - flip vertically
|
||||||
reflectionUV.y = 1.0 - distortedUV.y + 0.1;
|
reflectionUV.y = 0.5 - distortedUV.y + 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp to valid range
|
// Clamp to valid range
|
||||||
|
|
|
||||||
Binary file not shown.
132
shell.qml
132
shell.qml
|
|
@ -4,8 +4,6 @@ import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
|
||||||
import Qt5Compat.GraphicalEffects
|
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
FloatingWindow {
|
FloatingWindow {
|
||||||
|
|
@ -39,90 +37,56 @@ ShellRoot {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingRectangle {
|
GlassSurface {
|
||||||
id: glassContainer
|
source: backgroundContent
|
||||||
color: "transparent"
|
|
||||||
radius: 20
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 400
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
|
|
||||||
// Blur
|
|
||||||
ShaderEffectSource {
|
|
||||||
id: blurredBackground
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceItem: backgroundContent
|
|
||||||
sourceRect: Qt.rect(glassContainer.x, glassContainer.y, glassContainer.width, glassContainer.height)
|
|
||||||
hideSource: false
|
|
||||||
live: true
|
|
||||||
}
|
|
||||||
|
|
||||||
GaussianBlur {
|
|
||||||
id: backgroundBlur
|
|
||||||
anchors.fill: parent
|
|
||||||
source: blurredBackground
|
|
||||||
radius: 4
|
|
||||||
samples: 4
|
|
||||||
// transparentBorder: true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Liquid glass shader warp
|
|
||||||
ShaderEffect {
|
|
||||||
anchors.fill: parent
|
|
||||||
fragmentShader: "root:shaders/liquid-glass.frag.qsb"
|
|
||||||
|
|
||||||
property real time: timeSlider.value
|
|
||||||
property real warpStrength: warpSlider.value
|
|
||||||
property real flowSpeed: speedSlider.value
|
|
||||||
property real scale: 3.0
|
|
||||||
property real edgeReflectionStrength: edgeReflectionSlider.value
|
|
||||||
property real edgeReflectionWidth: edgeWidthSlider.value
|
|
||||||
property real cornerRadius: 0.1
|
|
||||||
|
|
||||||
property variant source: ShaderEffectSource {
|
|
||||||
sourceItem: backgroundBlur
|
|
||||||
hideSource: false
|
|
||||||
live: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subtle glass overlay
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
radius: 20
|
radius: 20
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
// Subtle inner glow
|
// parameters
|
||||||
Rectangle {
|
time: timeSlider.value
|
||||||
anchors.fill: parent
|
speed: speedSlider.value
|
||||||
anchors.margins: 1
|
strength: warpSlider.value
|
||||||
radius: parent.radius - 1
|
scale: scaleSlider.value
|
||||||
color: "transparent"
|
edgeReflectionStrength: edgeReflectionSlider.value
|
||||||
border.width: 1
|
edgeReflectionWidth: edgeWidthSlider.value
|
||||||
border.color: Qt.rgba(1, 1, 1, 0.05)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
border.width: 1
|
RowLayout {
|
||||||
border.color: Qt.rgba(1, 1, 1, 0.15)
|
spacing: 40
|
||||||
|
|
||||||
Rectangle {
|
Repeater {
|
||||||
anchors.top: parent.top
|
model: ["1", "2", "3"]
|
||||||
anchors.left: parent.left
|
delegate: GlassSurface {
|
||||||
anchors.right: parent.right
|
id: surface
|
||||||
anchors.margins: 1
|
required property var modelData
|
||||||
height: parent.height * 0.3
|
source: backgroundContent
|
||||||
radius: parent.radius - 1
|
width: 100
|
||||||
gradient: Gradient {
|
height: 100
|
||||||
GradientStop {
|
radius: 40
|
||||||
position: 0.0
|
|
||||||
color: Qt.rgba(1, 1, 1, 0.08)
|
time: timeSlider.value
|
||||||
}
|
speed: speedSlider.value
|
||||||
GradientStop {
|
strength: warpSlider.value
|
||||||
position: 1.0
|
scale: scaleSlider.value
|
||||||
color: Qt.rgba(1, 1, 1, 0.0)
|
edgeReflectionStrength: edgeReflectionSlider.value
|
||||||
|
edgeReflectionWidth: edgeWidthSlider.value
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: surface.modelData
|
||||||
|
color: Qt.rgba(1, 1, 1, 0.2)
|
||||||
|
font.bold: true
|
||||||
|
font.pointSize: 16
|
||||||
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: 25
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -206,6 +170,22 @@ ShellRoot {
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Text {
|
||||||
|
text: "Scale:"
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: scaleSlider
|
||||||
|
from: 0.0
|
||||||
|
to: 20.0
|
||||||
|
value: 3.0
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue