2022-04-14 18:22:00 +08:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 15:27:56 +08:00
|
|
|
property point start: Qt.point(0, 0)
|
|
|
|
property var end: []
|
|
|
|
property alias running: pointToAnimation.running
|
|
|
|
property color color: "#96943D"
|
|
|
|
property real ratio: 0
|
|
|
|
property int lineWidth: 6
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
signal finished()
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Repeater {
|
|
|
|
model: end
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Rectangle {
|
|
|
|
width: 6
|
|
|
|
height: Math.sqrt(Math.pow(modelData.x - start.x, 2) + Math.pow(modelData.y - start.y, 2)) * ratio
|
|
|
|
x: start.x
|
|
|
|
y: start.y
|
|
|
|
antialiasing: true
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
|
|
|
position: 0
|
|
|
|
color: Qt.rgba(255, 255, 255, 0)
|
|
|
|
}
|
|
|
|
GradientStop {
|
|
|
|
position: 1
|
|
|
|
color: Qt.rgba(200, 200, 200, 0.12)
|
|
|
|
}
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Rectangle {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 3
|
|
|
|
height: parent.height
|
|
|
|
antialiasing: true
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
|
|
|
position: 0
|
|
|
|
color: Qt.rgba(255, 255, 255, 0)
|
|
|
|
}
|
|
|
|
GradientStop {
|
|
|
|
position: 1
|
|
|
|
color: Qt.lighter(root.color)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
transform: Rotation {
|
|
|
|
angle: 0
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Component.onCompleted: {
|
|
|
|
var dx = modelData.x - start.x;
|
|
|
|
var dy = modelData.y - start.y;
|
|
|
|
if (dx > 0) {
|
|
|
|
angle = Math.atan2(dy, dx) / Math.PI * 180 - 90;
|
|
|
|
} else if (dx < 0) {
|
|
|
|
angle = Math.atan2(dy, dx) / Math.PI * 180 + 270;
|
|
|
|
} else if (dy < 0) {
|
|
|
|
angle = 180;
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
SequentialAnimation {
|
|
|
|
id: pointToAnimation
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
PropertyAnimation {
|
|
|
|
target: root
|
|
|
|
property: "ratio"
|
|
|
|
to: 1
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
duration: 200
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
PauseAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
PropertyAnimation {
|
|
|
|
target: root
|
|
|
|
property: "opacity"
|
|
|
|
to: 0
|
|
|
|
easing.type: Easing.InQuart
|
|
|
|
duration: 300
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
onStopped: {
|
|
|
|
root.visible = false;
|
|
|
|
root.finished();
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|