From 23efad7b8634b32ff6f4d901af9997bc98206af3 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 10 Oct 2017 11:09:16 -0400 Subject: Update the Fireflies screensaver - seems to work fine now --- .../extrafiles/screensavers/Fireflies.qml | 3 +- .../extrafiles/screensavers/Firefly.qml | 39 ++++++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml index 36ed4df5..c2295a8f 100644 --- a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml +++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.qml @@ -8,11 +8,12 @@ Rectangle { color: "black" Repeater { - model: Math.round(Math.random()*100)+30 + model: Math.round(Math.random()*200)+60 QML.Firefly { parent: canvas x: Math.round(Math.random()*canvas.width) y: Math.round(Math.random()*canvas.height) } } //end of Repeater + } //end of canvas rectangle diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml index 704811a7..7b65d8ec 100644 --- a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml +++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Firefly.qml @@ -6,23 +6,28 @@ Item { RectangularGlow { anchors.fill: fly - glowRadius: 0.1 - spread: 0.1 - color: Qt.rgba(Math.random()*255,Math.random()*255,0,0.3) + glowRadius: Math.round(fly.radius /2) + spread: 0.5 + color: Qt.rgba(1,1,1,0.3) cornerRadius: fly.radius + glowRadius } Rectangle { id: fly - width: Math.round(Math.random()*3)+2 + width: Math.round(Math.random()*canvas.width/200)+2 height: width - color: Qt.rgba(Math.random()*255,Math.random()*255,0,0.8) + x: parent.x + y: parent.y + color: Qt.rgba(Math.random(),Math.random(),0,0.5) radius: Math.floor(width/2) property int jitterX: Math.round(Math.random()*100)+10 property int jitterY: Math.round(Math.random()*100)+10 - - } - + + Behavior on color { + ColorAnimation { + duration: 500 + } + } Behavior on x { SmoothedAnimation { velocity: 10+Math.random()*canvas.width/100 @@ -34,18 +39,24 @@ Item { } } + } + + + Timer { - interval: Math.round(Math.random()*1000) + interval: 5 repeat: true running: true + property bool starting: true onTriggered: { - if ( (x+fly.jitterX)>canvas.width || (x+fly.jitterX)<0 ){ fly.jitterX = 0-fly.jitterX } - x = x+fly.jitterX - if( (y+fly.jitterY)>canvas.height || (y+fly.jitterY)<0 ){ fly.jitterY = 0-fly.jitterY } - y = y+fly.jitterY + if(starting){ interval = Math.round(Math.random()*1000)+500; starting = false; } + if ( (fly.x+fly.jitterX)>parent.width || (fly.x+fly.jitterX)<0 ){ fly.jitterX = 0-fly.jitterX } + fly.x = fly.x+fly.jitterX + if( (fly.y+fly.jitterY)>parent.height || (fly.y+fly.jitterY)<0 ){ fly.jitterY = 0-fly.jitterY } + fly.y = fly.y+fly.jitterY fly.jitterX = (Math.round(Math.random())*2 - 1) *fly.jitterX fly.jitterY = (Math.round(Math.random())*2 - 1) *fly.jitterY - fly.color = Qt.rgba(Math.random()*255,Math.random()*255,Math.random()*150,0.8) + fly.color = Qt.rgba(Math.random(),Math.random(),Math.random(),0.5) } } //end of timer -- cgit