wallpaper: renamed Swipe => Wipe

This commit is contained in:
LemmyCook 2025-08-29 19:10:16 -04:00
parent f5b4984295
commit 5ab76c98e5
4 changed files with 30 additions and 30 deletions

View file

@ -22,9 +22,9 @@ Variants {
property bool transitioning: false property bool transitioning: false
property real transitionProgress: 0.0 property real transitionProgress: 0.0
// Swipe direction: 0=left, 1=right, 2=up, 3=down // Wipe direction: 0=left, 1=right, 2=up, 3=down
property real swipeDirection: 0 property real wipeDirection: 0
property real swipeSmoothness: 0.05 property real wipeSmoothness: 0.05
// External state management // External state management
property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name) property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name)
@ -42,20 +42,20 @@ Variants {
case "none": case "none":
setWallpaperImmediate(servicedWallpaper) setWallpaperImmediate(servicedWallpaper)
break break
case "swipe_left": case "wipe_left":
swipeDirection = 0 wipeDirection = 0
setWallpaperWithTransition(servicedWallpaper) setWallpaperWithTransition(servicedWallpaper)
break break
case "swipe_right": case "wipe_right":
swipeDirection = 1 wipeDirection = 1
setWallpaperWithTransition(servicedWallpaper) setWallpaperWithTransition(servicedWallpaper)
break break
case "swipe_up": case "wipe_up":
swipeDirection = 2 wipeDirection = 2
setWallpaperWithTransition(servicedWallpaper) setWallpaperWithTransition(servicedWallpaper)
break break
case "swipe_down": case "wipe_down":
swipeDirection = 3 wipeDirection = 3
setWallpaperWithTransition(servicedWallpaper) setWallpaperWithTransition(servicedWallpaper)
break break
default: default:
@ -112,18 +112,18 @@ Variants {
fragmentShader: Qt.resolvedUrl("../../Shaders/qsb/wp_fade.frag.qsb") fragmentShader: Qt.resolvedUrl("../../Shaders/qsb/wp_fade.frag.qsb")
} }
// Swipe transition shader // Wipe transition shader
ShaderEffect { ShaderEffect {
id: swipeShader id: wipeShader
anchors.fill: parent anchors.fill: parent
visible: Settings.data.wallpaper.transitionType.startsWith('swipe_') visible: Settings.data.wallpaper.transitionType.startsWith('wipe_')
property variant source1: currentWallpaper property variant source1: currentWallpaper
property variant source2: nextWallpaper property variant source2: nextWallpaper
property real progress: transitionProgress property real progress: transitionProgress
property real direction: swipeDirection property real direction: wipeDirection
property real smoothness: swipeSmoothness property real smoothness: wipeSmoothness
fragmentShader: Qt.resolvedUrl("../../Shaders/qsb/wp_swipe.frag.qsb") fragmentShader: Qt.resolvedUrl("../../Shaders/qsb/wp_wipe.frag.qsb")
} }
// Animation for the transition progress // Animation for the transition progress
@ -136,7 +136,7 @@ Variants {
duration: Settings.data.wallpaper.transitionDuration ?? 1000 duration: Settings.data.wallpaper.transitionDuration ?? 1000
easing.type: { easing.type: {
const transitionType = Settings.data.wallpaper.transitionType ?? 'fade' const transitionType = Settings.data.wallpaper.transitionType ?? 'fade'
if (transitionType.startsWith('swipe_')) { if (transitionType.startsWith('wipe_')) {
return Easing.InOutCubic return Easing.InOutCubic
} }
return Easing.InOutCubic return Easing.InOutCubic

View file

@ -24,20 +24,20 @@ Singleton {
name: "Fade" name: "Fade"
} }
ListElement { ListElement {
key: "swipe_left" key: "wipe_left"
name: "Swipe Left" name: "Wipe Left"
} }
ListElement { ListElement {
key: "swipe_right" key: "wipe_right"
name: "Swipe Right" name: "Wipe Right"
} }
ListElement { ListElement {
key: "swipe_up" key: "wipe_up"
name: "Swipe Up" name: "Wipe Up"
} }
ListElement { ListElement {
key: "swipe_down" key: "wipe_down"
name: "Swipe Down" name: "Wipe Down"
} }
} }

View file

@ -29,25 +29,25 @@ void main() {
// Calculate edge position based on direction // Calculate edge position based on direction
// As progress goes from 0 to 1, we reveal source2 (new wallpaper) // As progress goes from 0 to 1, we reveal source2 (new wallpaper)
if (ubuf.direction < 0.5) { if (ubuf.direction < 0.5) {
// Swipe from right to left (new image enters from right) // Wipe from right to left (new image enters from right)
edge = 1.0 - extendedProgress; edge = 1.0 - extendedProgress;
factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.x); factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.x);
fragColor = mix(color1, color2, factor); fragColor = mix(color1, color2, factor);
} }
else if (ubuf.direction < 1.5) { else if (ubuf.direction < 1.5) {
// Swipe from left to right (new image enters from left) // Wipe from left to right (new image enters from left)
edge = extendedProgress; edge = extendedProgress;
factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.x); factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.x);
fragColor = mix(color2, color1, factor); fragColor = mix(color2, color1, factor);
} }
else if (ubuf.direction < 2.5) { else if (ubuf.direction < 2.5) {
// Swipe from bottom to top (new image enters from bottom) // Wipe from bottom to top (new image enters from bottom)
edge = 1.0 - extendedProgress; edge = 1.0 - extendedProgress;
factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.y); factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.y);
fragColor = mix(color1, color2, factor); fragColor = mix(color1, color2, factor);
} }
else { else {
// Swipe from top to bottom (new image enters from top) // Wipe from top to bottom (new image enters from top)
edge = extendedProgress; edge = extendedProgress;
factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.y); factor = smoothstep(edge - ubuf.smoothness, edge + ubuf.smoothness, uv.y);
fragColor = mix(color2, color1, factor); fragColor = mix(color2, color1, factor);