Replace the circle wallpaper reveal with a colonies shader
New wallpapers spread over the old one as noise-warped colonies in 4 px cells with a burning accent edge, drawn procedurally per change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c716a20e04
commit
ad740ef631
5 files changed
+161
-33
No files matched your search
@@ -1,6 +1,5 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import "../services"
|
||||
@@ -17,7 +16,7 @@ PanelWindow {
|
||||
WlrLayershell.namespace:"glassMxrph-wallpaper"
|
||||
mask:Region {}
|
||||
readonly property string target:ConfigService.ready && ConfigService.data.wallpaper.byMonitor[root.modelData.name] ? "file://"+encodeURI(ConfigService.data.wallpaper.byMonitor[root.modelData.name]).replace(/#/g,"%23").replace(/\?/g,"%3F") : ""
|
||||
// 0..1 while a new wallpaper grows in from the centre over the old one.
|
||||
// 0..1 while colonies of the new wallpaper eat through the old one.
|
||||
property real progress:0
|
||||
readonly property bool transitioning:incoming.source.toString()!==""
|
||||
// The first wallpaper (and reduced motion) appears directly; later changes
|
||||
@@ -41,53 +40,62 @@ PanelWindow {
|
||||
// Drop the overlay only once the base layer shows the new image.
|
||||
onStatusChanged:root.settle()
|
||||
}
|
||||
Item {
|
||||
id:revealMask
|
||||
anchors.fill:parent
|
||||
visible:false
|
||||
layer.enabled:root.transitioning
|
||||
Rectangle {
|
||||
readonly property real reach:Math.hypot(root.width,root.height)*1.15
|
||||
anchors.centerIn:parent
|
||||
width:reach*root.progress;height:width;radius:width/2
|
||||
color:"black"
|
||||
}
|
||||
}
|
||||
// The mask must be the image's own layer effect: a MultiEffect pointed at a
|
||||
// hidden source renders nothing here.
|
||||
// The incoming image is only a texture: the colonies shader draws the
|
||||
// change over `shown` (shaders/colonies.frag).
|
||||
Image {
|
||||
id:incoming
|
||||
anchors.fill:parent
|
||||
visible:root.transitioning && root.progress>0
|
||||
sourceSize:Qt.size(parent.width,parent.height)
|
||||
visible:false
|
||||
sourceSize:Qt.size(root.width,root.height)
|
||||
asynchronous:true
|
||||
fillMode:Image.PreserveAspectCrop
|
||||
// Settles from a slight zoom while the circle widens, like swww/awww "grow".
|
||||
scale:1.06-0.06*root.progress
|
||||
onStatusChanged:{
|
||||
if(status===Image.Ready && source.toString())WallpaperService.revealReady(root.modelData.name);
|
||||
else if(status===Image.Error)incoming.source="";
|
||||
}
|
||||
layer.enabled:root.transitioning
|
||||
layer.effect:MultiEffect {
|
||||
maskEnabled:true
|
||||
maskSource:revealMask
|
||||
maskThresholdMin:0.5
|
||||
maskSpreadAtMin:1
|
||||
}
|
||||
}
|
||||
// PreserveAspectCrop decodes to cover the output, so the texture can be
|
||||
// larger than the item on one axis: sample its centred window.
|
||||
function crop(img) {
|
||||
const iw=Math.max(img.implicitWidth,1),ih=Math.max(img.implicitHeight,1);
|
||||
const s=Math.max(root.width/iw,root.height/ih);
|
||||
const w=root.width/(iw*s),h=root.height/(ih*s);
|
||||
return Qt.vector4d((1-w)/2,(1-h)/2,w,h);
|
||||
}
|
||||
ShaderEffect {
|
||||
anchors.fill:parent
|
||||
visible:root.transitioning && incoming.status===Image.Ready && root.progress>0
|
||||
property var oldTex:shown
|
||||
property var newTex:incoming
|
||||
property real t:root.progress
|
||||
property real sw:width
|
||||
property real sh:height
|
||||
property real cell:4
|
||||
property real glow:0.9
|
||||
property real seed:root.seed
|
||||
property vector4d cropOld:root.crop(shown)
|
||||
property vector4d cropNew:root.crop(incoming)
|
||||
property color ember:root.ember
|
||||
fragmentShader:Qt.resolvedUrl("shaders/colonies.frag.qsb")
|
||||
}
|
||||
// Captured when a change starts, so the burn keeps its colour even if the
|
||||
// palette regenerates from the new wallpaper halfway through.
|
||||
property real seed:0
|
||||
property color ember:Theme.accentVivid
|
||||
Connections {
|
||||
target:WallpaperService
|
||||
function onRevealSerialChanged() {
|
||||
if(incoming.status===Image.Ready && incoming.source.toString() && !reveal.running && root.progress===0)reveal.restart();
|
||||
if(incoming.status===Image.Ready && incoming.source.toString() && !reveal.running && root.progress===0) {
|
||||
root.seed=Math.random()*100;root.ember=Theme.accentVivid;reveal.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
NumberAnimation {
|
||||
id:reveal
|
||||
target:root;property:"progress"
|
||||
from:0;to:1
|
||||
duration:1100
|
||||
easing.type:Easing.InOutCubic
|
||||
// Linear time: the shader eases its own fronts.
|
||||
duration:1800
|
||||
easing.type:Easing.Linear
|
||||
onFinished:{shown.source=incoming.source;Qt.callLater(root.settle);}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user