mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 19:58:13 +08:00
a67175f8eb
* Run room in lua * handle offline player * Better toast and other * delete useless stuff * todo: edit profile * use pch
57 lines
1.1 KiB
QML
57 lines
1.1 KiB
QML
import QtQuick 2.15
|
|
|
|
Rectangle {
|
|
function show(text, duration) {
|
|
message.text = text;
|
|
time = Math.max(duration, 2 * fadeTime);
|
|
animation.start();
|
|
}
|
|
|
|
id: root
|
|
|
|
readonly property real defaultTime: 3000
|
|
property real time: defaultTime
|
|
readonly property real fadeTime: 300
|
|
|
|
anchors.horizontalCenter: parent != null ? parent.horizontalCenter : undefined
|
|
height: message.height + 20
|
|
width: message.width + 40
|
|
radius: 16
|
|
|
|
opacity: 0
|
|
color: "#F2808A87"
|
|
|
|
Text {
|
|
id: message
|
|
color: "white"
|
|
horizontalAlignment: Text.AlignHCenter
|
|
anchors.centerIn: parent
|
|
}
|
|
|
|
SequentialAnimation on opacity {
|
|
id: animation
|
|
running: false
|
|
|
|
|
|
NumberAnimation {
|
|
to: .9
|
|
duration: fadeTime
|
|
}
|
|
|
|
PauseAnimation {
|
|
duration: time - 2 * fadeTime
|
|
}
|
|
|
|
NumberAnimation {
|
|
to: 0
|
|
duration: fadeTime
|
|
}
|
|
|
|
onRunningChanged: {
|
|
if (!running) {
|
|
toast.model.remove(index);
|
|
}
|
|
}
|
|
}
|
|
}
|