mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Background: add startup wallpaper transition
This commit is contained in:
@@ -120,6 +120,7 @@
|
|||||||
"randomIntervalSec": 300,
|
"randomIntervalSec": 300,
|
||||||
"transitionDuration": 1500,
|
"transitionDuration": 1500,
|
||||||
"transitionType": "random",
|
"transitionType": "random",
|
||||||
|
"startupTransitionType": "disc",
|
||||||
"transitionEdgeSmoothness": 0.05,
|
"transitionEdgeSmoothness": 0.05,
|
||||||
"monitors": [],
|
"monitors": [],
|
||||||
"panelPosition": "follow_bar"
|
"panelPosition": "follow_bar"
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ Singleton {
|
|||||||
property int randomIntervalSec: 300 // 5 min
|
property int randomIntervalSec: 300 // 5 min
|
||||||
property int transitionDuration: 1500 // 1500 ms
|
property int transitionDuration: 1500 // 1500 ms
|
||||||
property string transitionType: "random"
|
property string transitionType: "random"
|
||||||
|
property string startupTransitionType: "disc"
|
||||||
property real transitionEdgeSmoothness: 0.05
|
property real transitionEdgeSmoothness: 0.05
|
||||||
property list<var> monitors: []
|
property list<var> monitors: []
|
||||||
property string panelPosition: "follow_bar"
|
property string panelPosition: "follow_bar"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Variants {
|
|||||||
// Internal state management
|
// Internal state management
|
||||||
property string transitionType: "fade"
|
property string transitionType: "fade"
|
||||||
property real transitionProgress: 0
|
property real transitionProgress: 0
|
||||||
|
property bool isStartupTransition: true
|
||||||
|
|
||||||
readonly property real edgeSmoothness: Settings.data.wallpaper.transitionEdgeSmoothness
|
readonly property real edgeSmoothness: Settings.data.wallpaper.transitionEdgeSmoothness
|
||||||
readonly property var allTransitions: WallpaperService.allTransitions
|
readonly property var allTransitions: WallpaperService.allTransitions
|
||||||
@@ -77,7 +78,11 @@ Variants {
|
|||||||
Connections {
|
Connections {
|
||||||
target: CompositorService
|
target: CompositorService
|
||||||
function onDisplayScalesChanged() {
|
function onDisplayScalesChanged() {
|
||||||
setWallpaperInitial()
|
// Recalculate image sizes without interrupting startup transition
|
||||||
|
if (isStartupTransition) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
recalculateImageSizes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +365,10 @@ Variants {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setWallpaperImmediate(WallpaperService.getWallpaper(modelData.name))
|
const wallpaperPath = WallpaperService.getWallpaper(modelData.name)
|
||||||
|
|
||||||
|
futureWallpaper = wallpaperPath
|
||||||
|
performStartupTransition()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
@@ -453,6 +461,53 @@ Variants {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------
|
||||||
|
// Dedicated function for startup animation
|
||||||
|
function performStartupTransition() {
|
||||||
|
// Get the transitionType from the settings
|
||||||
|
var transitionSettingType = Settings.data.wallpaper.startupTransitionType
|
||||||
|
|
||||||
|
if (transitionSettingType == "random") {
|
||||||
|
var idx = Math.floor(Math.random() * allTransitions.length)
|
||||||
|
transitionSettingType = allTransitions[idx]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the transition type really exists
|
||||||
|
if (transitionSettingType !== "none" && !allTransitions.includes(transitionSettingType)) {
|
||||||
|
transitionSettingType = "fade"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply transitionType so the shader loader picks the correct shader
|
||||||
|
this.transitionType = transitionSettingType
|
||||||
|
|
||||||
|
// Perform the chosen transition; for startup prefer centered disc when disc selected
|
||||||
|
switch (transitionSettingType) {
|
||||||
|
case "none":
|
||||||
|
setWallpaperImmediate(futureWallpaper)
|
||||||
|
break
|
||||||
|
case "wipe":
|
||||||
|
wipeDirection = Math.random() * 4
|
||||||
|
setWallpaperWithTransition(futureWallpaper)
|
||||||
|
break
|
||||||
|
case "disc":
|
||||||
|
// Force center origin for elegant startup animation
|
||||||
|
discCenterX = 0.5
|
||||||
|
discCenterY = 0.5
|
||||||
|
setWallpaperWithTransition(futureWallpaper)
|
||||||
|
break
|
||||||
|
case "stripes":
|
||||||
|
stripesCount = Math.round(Math.random() * 20 + 4)
|
||||||
|
stripesAngle = Math.random() * 360
|
||||||
|
setWallpaperWithTransition(futureWallpaper)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
setWallpaperWithTransition(futureWallpaper)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// Mark startup transition complete
|
||||||
|
isStartupTransition = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,15 @@ ColumnLayout {
|
|||||||
onSelected: key => Settings.data.wallpaper.transitionType = key
|
onSelected: key => Settings.data.wallpaper.transitionType = key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Startup Transition Type
|
||||||
|
NComboBox {
|
||||||
|
label: I18n.tr("settings.wallpaper.look-feel.startup-transition-type.label")
|
||||||
|
description: I18n.tr("settings.wallpaper.look-feel.startup-transition-type.description")
|
||||||
|
model: WallpaperService.transitionsModel
|
||||||
|
currentKey: Settings.data.wallpaper.startupTransitionType
|
||||||
|
onSelected: key => Settings.data.wallpaper.startupTransitionType = key
|
||||||
|
}
|
||||||
|
|
||||||
// Transition Duration
|
// Transition Duration
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
NLabel {
|
NLabel {
|
||||||
|
|||||||
Reference in New Issue
Block a user