aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/appearance/WallpaperSpread.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/appearance/WallpaperSpread.qml')
-rw-r--r--desktop/modules/appearance/WallpaperSpread.qml38
1 files changed, 21 insertions, 17 deletions
diff --git a/desktop/modules/appearance/WallpaperSpread.qml b/desktop/modules/appearance/WallpaperSpread.qml
index 02e5f94..f9e484b 100644
--- a/desktop/modules/appearance/WallpaperSpread.qml
+++ b/desktop/modules/appearance/WallpaperSpread.qml
@@ -16,8 +16,8 @@ import QtQuick
// The transition when Apply sets a wallpaper. swaybg has none: wallp kills
// the old one and starts a new one, which can show a frame of nothing. A
// surface on the bottom layer, above swaybg and below every window, covers
-// the swap: the old picture burns away over the new one, and the
-// surface goes once wallp has finished, by when the new swaybg is drawing
+// the swap: the old picture gives way to the new one, through the transition
+// Transitions picked, and the surface goes once wallp has finished, by when the new swaybg is drawing
// the same picture underneath. Sets from a terminal get no transition: by
// the time wall_h changes, swaybg has already swapped.
Scope {
@@ -34,6 +34,7 @@ Scope {
property bool running: false
property bool done: false
property real progress: 0
+ property string effect: "burn"
property point origin: Qt.point(0.5, 0.5)
visible: running
@@ -47,12 +48,12 @@ Scope {
Connections {
target: Wallpapers
- function onSwapping(which, from, to) {
+ function onSwapping(which, from, to, effect) {
if (which !== win.modelData.which || !win.screen) return;
anim.stop();
- // Behind the char band, so no pixel starts out scorched.
- win.progress = -0.05;
- // A different place each time the fire starts.
+ win.effect = effect;
+ win.progress = 0;
+ // A different place each time it starts.
win.origin = Qt.point(Math.random(), Math.random());
win.done = false;
oldImg.source = from;
@@ -69,7 +70,7 @@ Scope {
}
}
- // Both decoded before the first block drops, or the old one
+ // Both decoded before anything moves, or the old one
// would pop in late over a half-drawn screen.
readonly property bool ready: running && oldImg.status === Image.Ready
&& newImg.status === Image.Ready
@@ -88,7 +89,7 @@ Scope {
// -m fill is a centred crop, which is what PreserveAspectCrop does.
// Both hidden until both are decoded: the new one usually lands
// first, and drawn under an old one still loading it flashed
- // the new picture before the burn. Until then the surface is
+ // the new picture before the transition. Until then the surface is
// clear and swaybg shows the old picture itself.
Image {
id: newImg
@@ -98,6 +99,8 @@ Scope {
sourceSize: Qt.size(win.width, win.height)
asynchronous: true
cache: false
+ // A layer, so the shaders that read it get the crop.
+ layer.enabled: win.running
}
Image {
@@ -109,11 +112,12 @@ Scope {
asynchronous: true
cache: false
layer.enabled: win.running
- layer.effect: ShaderEffect {
- property real progress: win.progress
- property real aspect: win.width / Math.max(1, win.height)
- property point origin: win.origin
- fragmentShader: Qt.resolvedUrl("burn.frag.qsb")
+ layer.effect: WallShader {
+ name: win.effect
+ target: newImg
+ progress: win.progress
+ aspect: win.width / Math.max(1, win.height)
+ origin: win.origin
}
}
@@ -121,10 +125,10 @@ Scope {
id: anim
target: win
property: "progress"
- // Past 1: fbm can push a threshold a little over it. Linear,
- // since an ease spends its slow ends where nothing burns.
- to: 1.05
- duration: 3500
+ // Linear, since an ease spends its slow ends where nothing
+ // happens.
+ to: 1
+ duration: Transitions.duration
easing.type: Easing.Linear
onFinished: if (win.done) win.running = false
}