feat: rework wallpaper to use stack instead of A/B

Also switch colour animation to SlowEffects
This commit is contained in:
2 * r + 2 * t 2026-04-23 01:00:35 +10:00
parent 3191ea9757
commit 04f34034c3
2 changed files with 31 additions and 43 deletions

View file

@ -2,6 +2,6 @@ import QtQuick
import Caelestia.Config import Caelestia.Config
ColorAnimation { ColorAnimation {
duration: Tokens.anim.durations.normal duration: Tokens.anim.durations.expressiveSlowEffects
easing: Tokens.anim.standard easing: Tokens.anim.expressiveSlowEffects
} }

View file

@ -12,22 +12,24 @@ Item {
id: root id: root
property string source: Wallpapers.current property string source: Wallpapers.current
property Image current: one property CachingImage current
property bool completed property bool completed
onSourceChanged: { onSourceChanged: {
if (!source) if (!source)
current = null; current = null;
else if (current === one)
two.update();
else else
one.update(); current = imgComp.createObject(this, {
path: source
});
} }
Component.onCompleted: { Component.onCompleted: {
if (source) if (source)
Qt.callLater(() => { Qt.callLater(() => {
one.update(); current = imgComp.createObject(this, {
path: source
});
completed = true; completed = true;
}); });
} }
@ -98,48 +100,34 @@ Item {
} }
} }
Img { Component {
id: one id: imgComp
}
Img { CachingImage {
id: two id: img
}
component Img: CachingImage { anchors.fill: parent
id: img
function update(): void { opacity: 0
if (path === root.source)
root.current = this;
else
path = root.source;
}
anchors.fill: parent onStatusChanged: {
if (status === Image.Ready)
opacity: 0 anim.start();
scale: Wallpapers.showPreview ? 1 : 0.8
onStatusChanged: {
if (status === Image.Ready)
root.current = this;
}
states: State {
name: "visible"
when: root.current === img
PropertyChanges {
img.opacity: 1
img.scale: 1
} }
}
transitions: Transition { Anim on opacity {
Anim { id: anim
target: img
properties: "opacity,scale" type: Anim.SlowEffects
running: false
from: 0
to: 1
}
Timer {
running: root.current !== img && root.current?.status === Image.Ready
interval: anim.duration
onTriggered: img.destroy()
} }
} }
} }