mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add custom Background qml item. This prevents flickering on navigation change
This commit is contained in:
parent
c1618a45a7
commit
062d6d6f71
@ -122,5 +122,6 @@
|
|||||||
<file>qml/Create/Wizards/CreateWallpaper/NextButton.qml</file>
|
<file>qml/Create/Wizards/CreateWallpaper/NextButton.qml</file>
|
||||||
<file>qml/Screen/Screen.qml</file>
|
<file>qml/Screen/Screen.qml</file>
|
||||||
<file>assets/icons/icon_screen.svg</file>
|
<file>assets/icons/icon_screen.svg</file>
|
||||||
|
<file>qml/Background.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
uniform float time;
|
uniform float time;
|
||||||
|
uniform float shaderOpacity;
|
||||||
uniform vec2 resolution;
|
uniform vec2 resolution;
|
||||||
|
|
||||||
void main( void ) {
|
void main( void ) {
|
||||||
@ -12,6 +13,6 @@ void main( void ) {
|
|||||||
|
|
||||||
vec3 color = mix( color1, color2, mixValue);
|
vec3 color = mix( color1, color2, mixValue);
|
||||||
|
|
||||||
gl_FragColor = vec4(color,mixValue);
|
gl_FragColor = vec4(color,mixValue) * shaderOpacity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ ApplicationWindow {
|
|||||||
minimumHeight: 788
|
minimumHeight: 788
|
||||||
minimumWidth: 1050
|
minimumWidth: 1050
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!screenPlaySettings.autostart) {
|
if (!screenPlaySettings.autostart) {
|
||||||
show()
|
show()
|
||||||
@ -29,27 +27,35 @@ ApplicationWindow {
|
|||||||
|
|
||||||
function switchPage(name) {
|
function switchPage(name) {
|
||||||
if (name === "Create") {
|
if (name === "Create") {
|
||||||
|
bg.state = "create"
|
||||||
pageLoader.visible = false
|
pageLoader.visible = false
|
||||||
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
|
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
|
||||||
pageLoaderCreate.visible = true
|
pageLoaderCreate.visible = true
|
||||||
pageLoaderWorkshop.visible = false
|
pageLoaderWorkshop.visible = false
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
} else if (name === "Workshop") {
|
} else if (name === "Workshop") {
|
||||||
|
bg.state = "init"
|
||||||
pageLoader.visible = false
|
pageLoader.visible = false
|
||||||
pageLoaderCreate.visible = false
|
pageLoaderCreate.visible = false
|
||||||
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
|
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
|
||||||
pageLoaderWorkshop.visible = true
|
pageLoaderWorkshop.visible = true
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
} else {
|
} else {
|
||||||
|
bg.state = "init"
|
||||||
pageLoader.visible = true
|
pageLoader.visible = true
|
||||||
pageLoaderCreate.visible = false
|
pageLoaderCreate.visible = false
|
||||||
pageLoaderWorkshop.visible = false
|
pageLoaderWorkshop.visible = false
|
||||||
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
|
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Background {
|
||||||
|
id: bg
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: screenPlaySettings
|
target: screenPlaySettings
|
||||||
onSetMainWindowVisible: {
|
onSetMainWindowVisible: {
|
||||||
|
75
ScreenPlay/qml/Background.qml
Normal file
75
ScreenPlay/qml/Background.qml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import QtQuick 2.9
|
||||||
|
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick.Particles 2.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: element
|
||||||
|
anchors.fill: parent
|
||||||
|
state: "init"
|
||||||
|
onStateChanged: print(state)
|
||||||
|
|
||||||
|
property var myDate: new Date()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 16
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: colorShaderCreate.time = myDate.getMilliseconds()
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffect {
|
||||||
|
id: colorShaderCreate
|
||||||
|
anchors.fill: parent
|
||||||
|
blending: true
|
||||||
|
property real shaderOpacity: 0
|
||||||
|
property real time: 45
|
||||||
|
property vector2d resolution: Qt.vector2d(parent.width,
|
||||||
|
parent.height * 2)
|
||||||
|
fragmentShader: "qrc:/assets/shader/movingcolorramp.fsh"
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "init"
|
||||||
|
PropertyChanges {
|
||||||
|
target: colorShaderCreate
|
||||||
|
shaderOpacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "create"
|
||||||
|
PropertyChanges {
|
||||||
|
target: colorShaderCreate
|
||||||
|
shaderOpacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: "init"
|
||||||
|
to: "create"
|
||||||
|
reversible: true
|
||||||
|
|
||||||
|
PropertyAnimation {
|
||||||
|
target: colorShaderCreateWrapper
|
||||||
|
property: "shaderOpacity"
|
||||||
|
duration: 200
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "create"
|
||||||
|
to: "*"
|
||||||
|
reversible: true
|
||||||
|
|
||||||
|
PropertyAnimation {
|
||||||
|
target: colorShaderCreateWrapper
|
||||||
|
property: "shaderOpacity"
|
||||||
|
duration: 50
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,13 +1,12 @@
|
|||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
|
|
||||||
import QtGraphicalEffects 1.0
|
|
||||||
import QtQuick.Particles 2.0
|
import QtQuick.Particles 2.0
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
import net.aimber.create 1.0
|
import net.aimber.create 1.0
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: create
|
id: create
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
state: "out"
|
state: "out"
|
||||||
@ -38,15 +37,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connections {
|
|
||||||
// target: screenPlayCreate
|
|
||||||
// onLocalWorkshopCreationStatusChanged: {
|
|
||||||
// if (status === Create.State.Started) {
|
|
||||||
// loader.setSource("CreateImportStatus.qml")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: loader.item
|
target: loader.item
|
||||||
ignoreUnknownSignals: true
|
ignoreUnknownSignals: true
|
||||||
@ -62,24 +52,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var myDate: new Date()
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 1
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: colorShader.time = myDate.getMilliseconds()
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffect {
|
|
||||||
id: colorShader
|
|
||||||
anchors.fill: parent
|
|
||||||
property real time: 45
|
|
||||||
property vector2d resolution: Qt.vector2d(parent.width,
|
|
||||||
parent.height * 2)
|
|
||||||
fragmentShader: "qrc:/assets/shader/movingcolorramp.fsh"
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user