import QtQuick import Quickshell import qs.Services Item { id: root anchors.fill: parent required property string screen property Img current: one property string source: selector.selected WallpaperSelector { id: selector seed: screen } onSourceChanged: { if (!source) current = null; else if (current === one) two.update() else one.update() } Img { id: one } Img { id: two } component Img: Image { id: img function update() { source = root.source || "" } anchors.fill: parent fillMode: Image.PreserveAspectCrop smooth: true asynchronous: true cache: false opacity: 0 onStatusChanged: { if (status === Image.Ready) { root.current = this } } states: State { name: "visible" when: root.current === img PropertyChanges { img.opacity: 1 } StateChangeScript { name: "unloadOther" script: { if (img === one) two.source = "" if (img === two) one.source = "" } } } transitions: Transition { SequentialAnimation { NumberAnimation { target: img properties: "opacity" duration: 5000 easing.type: Easing.OutCubic } ScriptAction { scriptName: "unloadOther" } } } } }