init
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var bg: settingsContainer
|
||||
property int bx1: 0
|
||||
property int by1: 0
|
||||
property int br1: 200
|
||||
property int bx2: 0
|
||||
property int by2: 0
|
||||
property int br2: 200
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
}
|
||||
|
||||
// Solid color
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: settingsContainer.backgroundType === "solid"
|
||||
color: settingsContainer.backgroundColor1
|
||||
}
|
||||
|
||||
// Image background
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
visible: settingsContainer.backgroundType === "image" && source != ""
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: {
|
||||
var p = settingsContainer.backgroundImage
|
||||
if (!p) return ""
|
||||
if (p.indexOf("file://") === 0 || p.indexOf("qrc:") === 0 || p.indexOf("http") === 0) return p
|
||||
if (p.charAt(0) === "/" || /^[A-Za-z]:[\\\/]/.test(p)) return "file://" + p
|
||||
return "file://" + settingsContainer.iconsDir + "/" + p
|
||||
}
|
||||
}
|
||||
|
||||
// Animated gradient (default)
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
visible: settingsContainer.backgroundType === "gradient"
|
||||
|
||||
RadialGradient {
|
||||
anchors.fill: parent
|
||||
horizontalOffset: bx1
|
||||
verticalOffset: by1
|
||||
horizontalRadius: br1
|
||||
verticalRadius: br1
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: settingsContainer.backgroundColor1 }
|
||||
GradientStop { position: 1.0; color: "transparent" }
|
||||
}
|
||||
Behavior on horizontalOffset { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on verticalOffset { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on horizontalRadius { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on verticalRadius { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
}
|
||||
RadialGradient {
|
||||
anchors.fill: parent
|
||||
horizontalOffset: bx2
|
||||
verticalOffset: by2
|
||||
horizontalRadius: br2
|
||||
verticalRadius: br2
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: settingsContainer.backgroundColor2 }
|
||||
GradientStop { position: 1.0; color: "transparent" }
|
||||
}
|
||||
Behavior on horizontalOffset { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on verticalOffset { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on horizontalRadius { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
Behavior on verticalRadius { NumberAnimation { duration: 5000; easing.type: Easing.Linear } }
|
||||
}
|
||||
|
||||
Timer {
|
||||
running: settingsContainer.backgroundAnimated && settingsContainer.backgroundType === "gradient"
|
||||
repeat: true
|
||||
interval: 2500
|
||||
triggeredOnStart: true
|
||||
onTriggered: {
|
||||
bx1 = Math.random() * root.width - root.width / 2
|
||||
by1 = Math.random() * root.height - root.height / 2
|
||||
br1 = Math.random() * 300 + 200
|
||||
bx2 = Math.random() * root.width - root.width / 2
|
||||
by2 = Math.random() * root.height - root.height / 2
|
||||
br2 = Math.random() * 300 + 200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user