mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NScrollText: add fade in/out effect
This commit is contained in:
@@ -254,6 +254,8 @@ Item {
|
||||
|
||||
NScrollText {
|
||||
id: titleContainer
|
||||
showGradientMasks: true
|
||||
gradientColor: Style.capsuleColor
|
||||
text: windowTitle
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
maxWidth: {
|
||||
|
||||
@@ -322,6 +322,8 @@ Item {
|
||||
// Scrolling title
|
||||
NScrollText {
|
||||
id: titleContainer
|
||||
showGradientMasks: true
|
||||
gradientColor: Style.capsuleColor
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: capsuleHeight
|
||||
|
||||
@@ -285,6 +285,8 @@ SmartPanel {
|
||||
spacing: 0
|
||||
|
||||
NScrollText {
|
||||
showGradientMasks: true
|
||||
gradientColor: Color.mSurfaceVariant
|
||||
Layout.fillWidth: true
|
||||
maxWidth: parent.width
|
||||
text: {
|
||||
@@ -314,6 +316,8 @@ SmartPanel {
|
||||
}
|
||||
|
||||
NScrollText {
|
||||
showGradientMasks: true
|
||||
gradientColor: Color.mSurfaceVariant
|
||||
Layout.fillWidth: true
|
||||
maxWidth: parent.width
|
||||
text: {
|
||||
|
||||
@@ -785,6 +785,8 @@ SmartPanel {
|
||||
text: isBrowseMode ? currentBrowsePath : WallpaperService.getMonitorDirectory(targetScreen?.name ?? "")
|
||||
Layout.fillWidth: true
|
||||
scrollMode: NScrollText.ScrollMode.Hover
|
||||
showGradientMasks: true
|
||||
gradientColor: Color.mSurfaceVariant
|
||||
NText {
|
||||
text: isBrowseMode ? currentBrowsePath : WallpaperService.getMonitorDirectory(targetScreen?.name ?? "")
|
||||
pointSize: Style.fontSizeS
|
||||
|
||||
@@ -123,6 +123,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
property bool showGradientMasks: false
|
||||
property color gradientColor: "transparent"
|
||||
property real gradientWidth: 12
|
||||
|
||||
RowLayout {
|
||||
id: scrollContainer
|
||||
height: parent.height
|
||||
@@ -170,4 +174,45 @@ Item {
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
width: root.gradientWidth
|
||||
z: 1
|
||||
visible: root.showGradientMasks && (root.contentWidth > root.width)
|
||||
opacity: root.state === NScrollText.ScrollState.Scrolling ? Math.min(1.0, -scrollContainer.x / (root.gradientWidth * 1.5)) : 0
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: root.gradientColor
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.0
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
width: root.gradientWidth
|
||||
z: 1
|
||||
visible: root.showGradientMasks && (root.contentWidth > root.width)
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: "transparent"
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.0
|
||||
color: root.gradientColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user