aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigorii Zimin <gzimin@luxoft.com>2020-02-27 09:30:19 +0300
committerGrigorii Zimin <gzimin@luxoft.com>2020-02-28 03:38:39 +0000
commit3e145f9ae2fe7685229c505356f23efae18e105d (patch)
treecdd10d93e5f417f36720ddc93917c8fd31a66eb3
parent4739f346d0f01dd207dae438ffaa05f0002b168e (diff)
[vehicle] add smooth transitions
Change-Id: Ibd2211893db857ae970746a6c745fa97461f22d8 Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
-rw-r--r--apps/com.luxoft.vehicle/panels/Vehicle3DPanel.qml19
-rw-r--r--apps/com.luxoft.vehicle/views/VehicleView.qml10
2 files changed, 22 insertions, 7 deletions
diff --git a/apps/com.luxoft.vehicle/panels/Vehicle3DPanel.qml b/apps/com.luxoft.vehicle/panels/Vehicle3DPanel.qml
index 669365ac..56767e24 100644
--- a/apps/com.luxoft.vehicle/panels/Vehicle3DPanel.qml
+++ b/apps/com.luxoft.vehicle/panels/Vehicle3DPanel.qml
@@ -136,7 +136,23 @@ Item {
id: inputSettings
}
- components: [inputSettings, renderSettings]
+ FrameAction {
+ id: frameCounter
+ }
+
+ components: [inputSettings, renderSettings, frameCounter]
+
+ Connections {
+ id: readyToChangeConnection
+ target: frameCounter
+ enabled: !root.readyToChanges
+ property int fc: 0
+ onTriggered: {
+ if (++fc == 3) {
+ root.readyToChanges = true;
+ }
+ }
+ }
Camera {
id: camera
@@ -248,7 +264,6 @@ Item {
version: root.modelVersion
onBodyLoadedChanged: {
if (bodyLoaded) {
- root.readyToChanges = true;
var angle = getCurrentAngle()
if (angle !== lastCameraAngle) {
camera.panAboutViewCenter(angle - lastCameraAngle, Qt.vector3d(0, 1, 0));
diff --git a/apps/com.luxoft.vehicle/views/VehicleView.qml b/apps/com.luxoft.vehicle/views/VehicleView.qml
index ea305b05..9e5a68b0 100644
--- a/apps/com.luxoft.vehicle/views/VehicleView.qml
+++ b/apps/com.luxoft.vehicle/views/VehicleView.qml
@@ -105,17 +105,17 @@ Item {
VehicleProxyPanel {
id: vehicleProxyPanel
z: 9999
+ visible: opacity != 0.0
+ Behavior on opacity {
+ DefaultNumberAnimation {}
+ }
}
Loader {
id: vehicle3DPanelLoader
anchors.fill: parent
active: false
- opacity: active ? 1.0 : 0.0
asynchronous: true
- Behavior on opacity {
- DefaultNumberAnimation {}
- }
onItemChanged: {
if (item) {
@@ -126,7 +126,7 @@ Item {
item.vehicleColor = Qt.binding( function() {return root.store.vehicle3DstudioColor});
}
- vehicleProxyPanel.visible = Qt.binding( function() {return !item.readyToChanges} );
+ vehicleProxyPanel.opacity = Qt.binding(() => item.readyToChanges ? 0.0 : 1.0);
item.leftDoorOpen = Qt.binding( function() {return root.store.leftDoorOpened} );
item.rightDoorOpen = Qt.binding( function() {return root.store.rightDoorOpened});