Improve title pan animation, add slideout animation
This commit is contained in:
86
Main.qml
86
Main.qml
@@ -31,43 +31,69 @@ ApplicationWindow {
|
|||||||
// font.bold: true
|
// font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
Layout.leftMargin: 5
|
Layout.leftMargin: 5
|
||||||
visible: Player.currentIndex != null
|
|
||||||
color: Colors.primary
|
|
||||||
radius: 5
|
|
||||||
clip: true
|
|
||||||
width: 320
|
width: 320
|
||||||
height: 36
|
height: 36
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
id: nowplaying_root
|
||||||
|
// visible: Player.currentIndex != null
|
||||||
|
visible: anchors.bottomMargin < 42
|
||||||
|
color: Colors.primary
|
||||||
|
radius: 5
|
||||||
|
clip: true
|
||||||
|
|
||||||
Label {
|
NumberAnimation {
|
||||||
anchors.top: parent.top
|
running: Player.currentIndex != null
|
||||||
anchors.left: parent.left
|
target: nowplaying_root
|
||||||
anchors.right: parent.right
|
property: "anchors.bottomMargin"
|
||||||
anchors.topMargin: 1
|
from: 42
|
||||||
anchors.leftMargin: 4
|
to: 0
|
||||||
anchors.rightMargin: 4
|
duration: 160
|
||||||
text: (Player.loading ? "Loading " : "Playing ") + (Player.currentIndex != null ? qsTr(Player.currentStream.name) : "")
|
}
|
||||||
heading: "h5"
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
NumberAnimation {
|
||||||
id: nowplaying_title
|
running: Player.currentIndex == null
|
||||||
anchors.bottom: parent.bottom
|
target: nowplaying_root
|
||||||
anchors.left: parent.left
|
property: "anchors.bottomMargin"
|
||||||
anchors.right: parent.right
|
from: 0
|
||||||
anchors.bottomMargin: 1
|
to: 42
|
||||||
anchors.leftMargin: 4
|
duration: 160
|
||||||
anchors.rightMargin: 4
|
}
|
||||||
text: (Player.currentIndex != null ? qsTr(Player.currentStream.title) : "")
|
|
||||||
heading: "h3"
|
|
||||||
|
|
||||||
SequentialAnimation {
|
Label {
|
||||||
running: true
|
anchors.top: parent.top
|
||||||
loops: Animation.Infinite
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: 1
|
||||||
|
anchors.leftMargin: 4
|
||||||
|
anchors.rightMargin: 4
|
||||||
|
text: (Player.loading ? "Loading " : "Playing ") + (Player.currentIndex != null ? qsTr(Player.currentStream.name) : "")
|
||||||
|
heading: "h5"
|
||||||
|
}
|
||||||
|
|
||||||
NumberAnimation { target: nowplaying_title; property: "anchors.rightMargin"; from: 0; to: 320; duration: 5000 }
|
Label {
|
||||||
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: 0; to: 320; duration: 5000 }
|
id: nowplaying_title
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
// anchors.right: parent.right
|
||||||
|
anchors.bottomMargin: 1
|
||||||
|
anchors.leftMargin: 4
|
||||||
|
// anchors.rightMargin: 4
|
||||||
|
text: (Player.currentIndex != null ? qsTr(Player.currentStream.title) : "")
|
||||||
|
heading: "h3"
|
||||||
|
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
running: nowplaying_title.width > 320
|
||||||
|
loops: Animation.Infinite
|
||||||
|
|
||||||
|
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: 4; to: 4; duration: 10000 }
|
||||||
|
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: 4; to: -nowplaying_title.width + 324; duration: nowplaying_title.width * 4 }
|
||||||
|
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: -nowplaying_title.width + 324; to: -nowplaying_title.width + 324; duration: 10000 }
|
||||||
|
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: -nowplaying_title.width + 324; to: 4; duration: nowplaying_title.width * 4 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Item {
|
|||||||
|
|
||||||
property alias playing: player.playing
|
property alias playing: player.playing
|
||||||
property alias volume: output.volume
|
property alias volume: output.volume
|
||||||
readonly property var loading: player.mediaStatus == Qt.LoadingMedia
|
property var loading: player.mediaStatus == Qt.LoadingMedia
|
||||||
|
|
||||||
property var currentIndex: null
|
property var currentIndex: null
|
||||||
property var currentStream: null
|
property var currentStream: null
|
||||||
@@ -71,7 +71,7 @@ Item {
|
|||||||
|
|
||||||
audioOutput: AudioOutput {
|
audioOutput: AudioOutput {
|
||||||
id: output
|
id: output
|
||||||
volume: 0.4
|
volume: 0.3
|
||||||
}
|
}
|
||||||
|
|
||||||
onErrorOccurred: function(error, errorString) {
|
onErrorOccurred: function(error, errorString) {
|
||||||
@@ -99,11 +99,10 @@ Item {
|
|||||||
console.warn("Unknown slug encountered in metadata: " + station.server_name);
|
console.warn("Unknown slug encountered in metadata: " + station.server_name);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
parent.streams[index].title = station.title;
|
parent.streams[index].title = station.title.replace(/\[[a-zA-Z0-9]{11}\]/, "");
|
||||||
parent.streams[index].listeners = station.listeners;
|
parent.streams[index].listeners = station.listeners;
|
||||||
if (index == parent.currentIndex) {
|
if (index == parent.currentIndex) {
|
||||||
parent.currentStream.title = station.title;
|
parent.currentStream = parent.streams[index];
|
||||||
parent.currentStream.listeners = station.listeners;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// } catch {
|
// } catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user