2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2022-04-14 10:22:00 +00:00
|
|
|
|
|
|
|
Item {
|
2022-04-30 07:27:56 +00: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 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
signal finished()
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Repeater {
|
|
|
|
model: end
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00: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 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00: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 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Rectangle {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 3
|
|
|
|
height: parent.height
|
|
|
|
antialiasing: true
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
|
|
|
position: 0
|
|
|
|
color: Qt.rgba(255, 255, 255, 0)
|
|
|
|
}
|
|
|
|
GradientStop {
|
|
|
|
position: 1
|
|
|
|
color: Qt.lighter(root.color)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
transform: Rotation {
|
|
|
|
angle: 0
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00: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 10:22:00 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
SequentialAnimation {
|
|
|
|
id: pointToAnimation
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
PropertyAnimation {
|
|
|
|
target: root
|
|
|
|
property: "ratio"
|
|
|
|
to: 1
|
|
|
|
easing.type: Easing.OutCubic
|
|
|
|
duration: 200
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
PauseAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
PropertyAnimation {
|
|
|
|
target: root
|
|
|
|
property: "opacity"
|
|
|
|
to: 0
|
|
|
|
easing.type: Easing.InQuart
|
|
|
|
duration: 300
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
onStopped: {
|
|
|
|
root.visible = false;
|
|
|
|
root.finished();
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|