QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
AnimatedPropeller.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick3D
3
4Node {
5 id: root
6
7 required property url meshSource
8 required property vector3d pivotPoint
9 property int flightMode: 0
10 property real rotationTarget: 360
11
12 readonly property int _armedDuration: 1000
13 readonly property int _flyingDuration: 300
14
15 position: pivotPoint
16
17 onFlightModeChanged: {
18 switch (flightMode) {
19 case 1:
20 propAnimation.duration = _armedDuration;
21 break;
22 case 2:
23 propAnimation.duration = _flyingDuration;
24 break;
25 }
26 if (flightMode)
27 propAnimation.restart();
28 }
29
30 Node {
31 id: innerNode
32
33 pivot: root.pivotPoint
34
35 Model {
36 source: root.meshSource
37 materials: PrincipledMaterial {
38 baseColor: "gray"
39 indexOfRefraction: 1.0
40 metalness: 0.1
41 opacity: 1.0
42 roughness: 0.1
43 specularAmount: 1.0
44 }
45 }
46
47 PropertyAnimation {
48 id: propAnimation
49
50 target: innerNode
51 properties: "eulerRotation.y"
52 from: 0
53 to: root.rotationTarget
54 duration: 1000
55 loops: Animation.Infinite
56 running: root.flightMode > 0
57 }
58 }
59}