From a1b4c4ad291ff531b6efe8fabe409dfaae3cc854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= Date: Fri, 3 Feb 2017 12:55:13 +0200 Subject: RotationPage added Added a page that has three rotating disks. Current pictures are placeholders for final graphics. SensorTag can be recalibrated. Change-Id: I0666ab06e665d8c40861e170f36b09013b722973 Reviewed-by: Titta Heikkala --- .../iot-sensortag/resources/base/RotationPage.qml | 188 +++++++++++++++++++++ .../iot-sensortag/resources/small/MainSmall.qml | 3 +- .../resources/small/images/Gyro/particle.png | Bin 0 -> 870 bytes .../resources/small/images/Gyro/ring_large.png | Bin 0 -> 387182 bytes .../resources/small/images/Gyro/ring_medium.png | Bin 0 -> 263861 bytes .../resources/small/images/Gyro/ring_outer.png | Bin 0 -> 253803 bytes .../resources/small/images/Gyro/ring_small.png | Bin 0 -> 225215 bytes 7 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 tradeshow/iot-sensortag/resources/base/RotationPage.qml create mode 100644 tradeshow/iot-sensortag/resources/small/images/Gyro/particle.png create mode 100644 tradeshow/iot-sensortag/resources/small/images/Gyro/ring_large.png create mode 100644 tradeshow/iot-sensortag/resources/small/images/Gyro/ring_medium.png create mode 100644 tradeshow/iot-sensortag/resources/small/images/Gyro/ring_outer.png create mode 100644 tradeshow/iot-sensortag/resources/small/images/Gyro/ring_small.png (limited to 'tradeshow/iot-sensortag/resources') diff --git a/tradeshow/iot-sensortag/resources/base/RotationPage.qml b/tradeshow/iot-sensortag/resources/base/RotationPage.qml new file mode 100644 index 0000000..60b2d09 --- /dev/null +++ b/tradeshow/iot-sensortag/resources/base/RotationPage.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.6 +import SensorTag.DataProvider 1.0 +import QtQuick.Particles 2.0 + +Item { + id: dialerRoot + property var sensor: null + anchors.fill: parent + focus: true + + Image { + id: outerRing + anchors.fill: parent + fillMode: Image.PreserveAspectFit + source: pathPrefix + "Gyro/ring_outer.png" + z: parent.z + 1 + } + Image { + id: largeRing + anchors.centerIn: parent + width: outerRing.width * 0.8 + fillMode: Image.PreserveAspectFit + source: pathPrefix + "Gyro/ring_large.png" + rotation: sensor.rotationX + z: parent.z + 2 + Behavior on rotation { + RotationAnimation { + easing.type: Easing.Linear + duration: sensor.rotationUpdateInterval + direction: RotationAnimation.Shortest + } + } + } + Image { + id: mediumRing + anchors.centerIn: parent + width: outerRing.width * 0.6 + fillMode: Image.PreserveAspectFit + source: pathPrefix + "Gyro/ring_medium.png" + rotation: sensor.rotationY + z: parent.z + 3 + Behavior on rotation { + RotationAnimation { + easing.type: Easing.Linear + duration: sensor.rotationUpdateInterval + direction: RotationAnimation.Shortest + } + } + } + Image { + id: centerRing + anchors.centerIn: parent + width: outerRing.width * 0.4 + fillMode: Image.PreserveAspectFit + source: pathPrefix + "Gyro/ring_small.png" + rotation: sensor.rotationZ + z: parent.z + 4 + Behavior on rotation { + RotationAnimation { + easing.type: Easing.Linear + duration: sensor.rotationUpdateInterval + direction: RotationAnimation.Shortest + } + } + } + ParticleSystem { + id: particles + anchors.fill: parent + z: parent.z + 5 + ImageParticle { + source: pathPrefix + "Gyro/particle.png" + alpha: 0 + colorVariation: 0.2 + } + Emitter { + property int rateToEmit: Math.abs(sensor.gyroscopeZ_degPerSec) * 4 + id: centerEmitter + x: centerRing.x + y: centerRing.y + width: centerRing.width + height: centerRing.height + emitRate: rateToEmit > 400 ? rateToEmit : 0 + lifeSpan: 1000 + enabled: true + shape: EllipseShape { + fill: false + } + velocity: AngleDirection{ + magnitude: 100 + angleVariation: 0 + angle: 90 + } + size: particles.width / 200 + sizeVariation: 3 + } + Emitter { + property int rateToEmit: Math.abs(sensor.gyroscopeY_degPerSec) * 4 + id: midEmitter + x: mediumRing.x + y: mediumRing.y + width: mediumRing.width + height: mediumRing.height + emitRate: rateToEmit > 400 ? rateToEmit : 0 + lifeSpan: 1000 + enabled: true + shape: EllipseShape { + fill: false + } + velocity: AngleDirection{ + magnitude: 100 + angleVariation: 0 + angle: 90 + } + size: particles.width / 200 + sizeVariation: 3 + } + Emitter { + property int rateToEmit: Math.abs(sensor.gyroscopeX_degPerSec) * 4 + id: largeEmitter + x: largeRing.x + y: largeRing.y + width: largeRing.width + height: largeRing.height + emitRate: rateToEmit > 400 ? rateToEmit : 0 + lifeSpan: 1000 + enabled: true + shape: EllipseShape { + fill: false + } + velocity: AngleDirection{ + magnitude: 100 + angleVariation: 0 + angle: 90 + } + size: particles.width / 200 + sizeVariation: 3 + } + } +} diff --git a/tradeshow/iot-sensortag/resources/small/MainSmall.qml b/tradeshow/iot-sensortag/resources/small/MainSmall.qml index 7cdc7fe..6d87009 100644 --- a/tradeshow/iot-sensortag/resources/small/MainSmall.qml +++ b/tradeshow/iot-sensortag/resources/small/MainSmall.qml @@ -145,8 +145,9 @@ Item { width: rightPane.width height: rightPane.height * 0.3 - 60 onClicked: { - //mainContainer.source = "../base/GyroPage.qml"; + mainContainer.source = "../base/RotationPage.qml"; gyroConnection.enabled = true; + sensor.recalibrate(); } Connections { diff --git a/tradeshow/iot-sensortag/resources/small/images/Gyro/particle.png b/tradeshow/iot-sensortag/resources/small/images/Gyro/particle.png new file mode 100644 index 0000000..d86fc96 Binary files /dev/null and b/tradeshow/iot-sensortag/resources/small/images/Gyro/particle.png differ diff --git a/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_large.png b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_large.png new file mode 100644 index 0000000..fcd1cdc Binary files /dev/null and b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_large.png differ diff --git a/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_medium.png b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_medium.png new file mode 100644 index 0000000..14924cc Binary files /dev/null and b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_medium.png differ diff --git a/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_outer.png b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_outer.png new file mode 100644 index 0000000..4d4d803 Binary files /dev/null and b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_outer.png differ diff --git a/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_small.png b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_small.png new file mode 100644 index 0000000..d281f93 Binary files /dev/null and b/tradeshow/iot-sensortag/resources/small/images/Gyro/ring_small.png differ -- cgit v1.2.3