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
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Item {
|
||||
Layout.leftMargin: 5
|
||||
visible: Player.currentIndex != null
|
||||
color: Colors.primary
|
||||
radius: 5
|
||||
clip: true
|
||||
width: 320
|
||||
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 {
|
||||
anchors.top: parent.top
|
||||
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 {
|
||||
running: Player.currentIndex != null
|
||||
target: nowplaying_root
|
||||
property: "anchors.bottomMargin"
|
||||
from: 42
|
||||
to: 0
|
||||
duration: 160
|
||||
}
|
||||
|
||||
Label {
|
||||
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"
|
||||
NumberAnimation {
|
||||
running: Player.currentIndex == null
|
||||
target: nowplaying_root
|
||||
property: "anchors.bottomMargin"
|
||||
from: 0
|
||||
to: 42
|
||||
duration: 160
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
Label {
|
||||
anchors.top: parent.top
|
||||
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 }
|
||||
NumberAnimation { target: nowplaying_title; property: "anchors.leftMargin"; from: 0; to: 320; duration: 5000 }
|
||||
Label {
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user