diff options
Diffstat (limited to 'demos/declarative/RoboBounce')
30 files changed, 1333 insertions, 0 deletions
diff --git a/demos/declarative/RoboBounce/Assets/QML3DSign.png b/demos/declarative/RoboBounce/Assets/QML3DSign.png Binary files differnew file mode 100644 index 000000000..b4bfb88b2 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/QML3DSign.png diff --git a/demos/declarative/RoboBounce/Assets/button.png b/demos/declarative/RoboBounce/Assets/button.png Binary files differnew file mode 100644 index 000000000..2943e2403 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/button.png diff --git a/demos/declarative/RoboBounce/Assets/calculatorSign.png b/demos/declarative/RoboBounce/Assets/calculatorSign.png Binary files differnew file mode 100644 index 000000000..3a8fca728 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/calculatorSign.png diff --git a/demos/declarative/RoboBounce/Assets/cubeButton.png b/demos/declarative/RoboBounce/Assets/cubeButton.png Binary files differnew file mode 100644 index 000000000..2ea32a8b2 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/cubeButton.png diff --git a/demos/declarative/RoboBounce/Assets/hazard.png b/demos/declarative/RoboBounce/Assets/hazard.png Binary files differnew file mode 100644 index 000000000..a7c0b7fea --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/hazard.png diff --git a/demos/declarative/RoboBounce/Assets/infobutton.png b/demos/declarative/RoboBounce/Assets/infobutton.png Binary files differnew file mode 100644 index 000000000..e7379f2d2 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/infobutton.png diff --git a/demos/declarative/RoboBounce/Assets/qtlogo.png b/demos/declarative/RoboBounce/Assets/qtlogo.png Binary files differnew file mode 100644 index 000000000..3bf1a77d0 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/qtlogo.png diff --git a/demos/declarative/RoboBounce/Assets/roboInfo.png b/demos/declarative/RoboBounce/Assets/roboInfo.png Binary files differnew file mode 100644 index 000000000..b7bdda199 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/roboInfo.png diff --git a/demos/declarative/RoboBounce/Assets/roboticArms.3ds b/demos/declarative/RoboBounce/Assets/roboticArms.3ds Binary files differnew file mode 100644 index 000000000..478d27bfc --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/roboticArms.3ds diff --git a/demos/declarative/RoboBounce/Assets/roboticBody.3ds b/demos/declarative/RoboBounce/Assets/roboticBody.3ds Binary files differnew file mode 100644 index 000000000..ed872c82a --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/roboticBody.3ds diff --git a/demos/declarative/RoboBounce/Assets/roboticHead.3ds b/demos/declarative/RoboBounce/Assets/roboticHead.3ds Binary files differnew file mode 100644 index 000000000..7a517c2b3 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/roboticHead.3ds diff --git a/demos/declarative/RoboBounce/Assets/rotateButton2.png b/demos/declarative/RoboBounce/Assets/rotateButton2.png Binary files differnew file mode 100644 index 000000000..80a2d82a3 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/rotateButton2.png diff --git a/demos/declarative/RoboBounce/Assets/sQt3D_logo.png b/demos/declarative/RoboBounce/Assets/sQt3D_logo.png Binary files differnew file mode 100644 index 000000000..92a071d36 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/sQt3D_logo.png diff --git a/demos/declarative/RoboBounce/Assets/tronscape.png b/demos/declarative/RoboBounce/Assets/tronscape.png Binary files differnew file mode 100644 index 000000000..325f60e38 --- /dev/null +++ b/demos/declarative/RoboBounce/Assets/tronscape.png diff --git a/demos/declarative/RoboBounce/Calculator/Calculator.qml b/demos/declarative/RoboBounce/Calculator/Calculator.qml new file mode 100644 index 000000000..b4c704986 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/Calculator.qml @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "CalculatorCore" +import "CalculatorCore/calculator.js" as CalcEngine + +Rectangle { + id: window + + width: 640; height: 480 + color: "#282828" + + property string rotateLeft: "\u2939" + property string rotateRight: "\u2935" + property string leftArrow: "\u2190" + property string division : "\u00f7" + property string multiplication : "\u00d7" + property string squareRoot : "\u221a" + property string plusminus : "\u00b1" + + function doOp(operation) { CalcEngine.doOperation(operation) } + + + states: [ + State { + name: "hidden"; + }, + State { + name: "shown"; + } + ] + + transitions: [ + Transition { + from: "*" + to: "hidden" + SequentialAnimation { + NumberAnimation {target: window; property: "opacity"; to : 0.1; duration: 1000; easing.type:"OutQuad" } + PropertyAction {target: window; property: "visible"; value: false} + } + }, + Transition { + from: "*" + to: "shown" + SequentialAnimation { + PropertyAction {target: window; property: "visible"; value: true} + NumberAnimation {target: window; property: "opacity"; to : 1.0; duration: 1000; easing.type:"OutQuad" } + } + } + ] + + Item { + id: main + state: "orientation " + runtime.orientation + + width: parent.width; height: parent.height; anchors.centerIn: parent + + Column { + id: box; spacing: 8 + + anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } + + Display { + id: display + width: box.width-3 + height: 64 + } + + Column { + id: column; spacing: 6 + + property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Row { + spacing: 6 + Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" } + Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } + Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } + Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } + } + + Row { + spacing: 6 + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } + } + + Grid { + id: grid; rows: 5; columns: 5; spacing: 6 + + property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) + + Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: division } + Button { width: grid.w; height: column.h; operation: squareRoot } + Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: multiplication } + Button { width: grid.w; height: column.h; operation: "x^2" } + Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "-" } + Button { width: grid.w; height: column.h; operation: "1/x" } + Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "." } + Button { width: grid.w; height: column.h; operation: plusminus } + Button { width: grid.w; height: column.h; operation: "+" } + Button { width: grid.w; height: column.h; operation: "="; color: 'red' } + } + } + } + + states: [ + State { + name: "orientation " + Orientation.Landscape + PropertyChanges { target: main; rotation: 90; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } + }, + State { + name: "orientation " + Orientation.PortraitInverted + PropertyChanges { target: main; rotation: 180; } + PropertyChanges { target: rotateButton; operation: rotateRight } + }, + State { + name: "orientation " + Orientation.LandscapeInverted + PropertyChanges { target: main; rotation: 270; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } + } + ] + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: rotateButton; property: "operation" } + RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } + NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } + } + } + } +} diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/Button.qml b/demos/declarative/RoboBounce/Calculator/CalculatorCore/Button.qml new file mode 100644 index 000000000..02a0119a5 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: button + + property alias operation: buttonText.text + property string color: "" + + signal clicked + + source: "images/button-" + color + ".png"; clip: true + border { left: 10; top: 10; right: 10; bottom: 10 } + + Rectangle { + id: shade + anchors.fill: button; radius: 10; color: "black"; opacity: 0 + } + + Text { + id: buttonText + anchors.centerIn: parent; anchors.verticalCenterOffset: -1 + font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5 + style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + doOp(operation) + button.clicked() + } + } + + states: State { + name: "pressed"; when: mouseArea.pressed == true + PropertyChanges { target: shade; opacity: .4 } + } + + transitions: [ + Transition { + from: "*" + to: "pressed" + SequentialAnimation { + NumberAnimation {target: button; property: "scale"; to : 0.8; duration: 200; easing.type:"OutQuad" } + } + }, + Transition { + from: "pressed" + to: "*" + SequentialAnimation { + NumberAnimation {target: button; property: "scale"; to : 1.0; duration: 200; easing.type:"OutQuad" } + } + } + ] +} diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/Display.qml b/demos/declarative/RoboBounce/Calculator/CalculatorCore/Display.qml new file mode 100644 index 000000000..6e9e664b4 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/Display.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: image + + property alias text : displayText.text + property alias currentOperation : operationText + + source: "images/display.png" + border { left: 10; top: 10; right: 10; bottom: 10 } + + Text { + id: displayText + anchors { + right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1 + rightMargin: 6; left: operationText.right + } + font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight + color: "#343434"; smooth: true; font.bold: true + } + Text { + id: operationText + font.bold: true; font.pixelSize: parent.height * .7 + color: "#343434"; smooth: true + anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter } + } +} diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/calculator.js b/demos/declarative/RoboBounce/Calculator/CalculatorCore/calculator.js new file mode 100644 index 000000000..7c363c7f3 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/calculator.js @@ -0,0 +1,91 @@ + +var curVal = 0 +var memory = 0 +var lastOp = "" +var timer = 0 + +function disabled(op) { + if (op == "." && display.text.toString().search(/\./) != -1) { + return true + } else if (op == squareRoot && display.text.toString().search(/-/) != -1) { + return true + } else { + return false + } +} + +function doOperation(op) { + if (disabled(op)) { + return + } + + if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { + if (display.text.toString().length >= 14) + return; // No arbitrary length numbers + if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { + display.text = display.text + op.toString() + } else { + display.text = op + } + lastOp = op + return + } + lastOp = op + + if (display.currentOperation.text == "+") { + display.text = Number(display.text.valueOf()) + Number(curVal.valueOf()) + } else if (display.currentOperation.text == "-") { + display.text = Number(curVal) - Number(display.text.valueOf()) + } else if (display.currentOperation.text == multiplication) { + display.text = Number(curVal) * Number(display.text.valueOf()) + } else if (display.currentOperation.text == division) { + display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString() + } else if (display.currentOperation.text == "=") { + } + + if (op == "+" || op == "-" || op == multiplication || op == division) { + display.currentOperation.text = op + curVal = display.text.valueOf() + return + } + + curVal = 0 + display.currentOperation.text = "" + + if (op == "1/x") { + display.text = (1 / display.text.valueOf()).toString() + } else if (op == "x^2") { + display.text = (display.text.valueOf() * display.text.valueOf()).toString() + } else if (op == "Abs") { + display.text = (Math.abs(display.text.valueOf())).toString() + } else if (op == "Int") { + display.text = (Math.floor(display.text.valueOf())).toString() + } else if (op == plusminus) { + display.text = (display.text.valueOf() * -1).toString() + } else if (op == squareRoot) { + display.text = (Math.sqrt(display.text.valueOf())).toString() + } else if (op == "mc") { + memory = 0; + } else if (op == "m+") { + memory += display.text.valueOf() + } else if (op == "mr") { + display.text = memory.toString() + } else if (op == "m-") { + memory = display.text.valueOf() + } else if (op == leftArrow) { + display.text = display.text.toString().slice(0, -1) + if (display.text.length == 0) { + display.text = "0" + } + } else if (op == "Off") { + Qt.quit(); + } else if (op == "C") { + display.text = "0" + } else if (op == "AC") { + curVal = 0 + memory = 0 + lastOp = "" + display.text ="0" + } +} + diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-.png Binary files differnew file mode 100644 index 000000000..544e51453 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-blue.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-blue.png Binary files differnew file mode 100644 index 000000000..5f92de32d --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-blue.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-green.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-green.png Binary files differnew file mode 100644 index 000000000..36c93914c --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-green.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-purple.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-purple.png Binary files differnew file mode 100644 index 000000000..347cbbea9 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-purple.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-red.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-red.png Binary files differnew file mode 100644 index 000000000..3b335891a --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/button-red.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/display.png b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/display.png Binary files differnew file mode 100644 index 000000000..9507f4382 --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/images/display.png diff --git a/demos/declarative/RoboBounce/Calculator/CalculatorCore/qmldir b/demos/declarative/RoboBounce/Calculator/CalculatorCore/qmldir new file mode 100644 index 000000000..a926b93fa --- /dev/null +++ b/demos/declarative/RoboBounce/Calculator/CalculatorCore/qmldir @@ -0,0 +1,2 @@ +Button Button.qml +Display Display.qml diff --git a/demos/declarative/RoboBounce/RobotCore/PushButton.qml b/demos/declarative/RoboBounce/RobotCore/PushButton.qml new file mode 100644 index 000000000..8cc48744f --- /dev/null +++ b/demos/declarative/RoboBounce/RobotCore/PushButton.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Nokia Corporation and its Subsidiary(-ies) 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 Qt 4.7 +import Qt3D 1.0 + +Image { + id: theButton + property bool bounce: false + source: "../Assets/button.png" + width: 40 + height: 40 + + signal pressed + + SequentialAnimation { + running: theButton.bounce + NumberAnimation {target: theButton; property: "scale"; duration: 50; to: 0.8;} + NumberAnimation {target: theButton; property: "scale"; duration: 50; to: 1;} + onCompleted: {theButton.bounce = false} + } + + MouseArea { + anchors.fill: parent + onClicked: { + theButton.bounce=true + theButton.pressed() + } + } +} + + diff --git a/demos/declarative/RoboBounce/RobotCore/QMLPanels.qml b/demos/declarative/RoboBounce/RobotCore/QMLPanels.qml new file mode 100644 index 000000000..874436dd4 --- /dev/null +++ b/demos/declarative/RoboBounce/RobotCore/QMLPanels.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Nokia Corporation and its Subsidiary(-ies) 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 Qt 4.7 +import Qt3D 1.0 + +Item { + Rectangle { + id: buttonBox1 + x: 30 + y: 110 + width: 60 + height: 160 + opacity: 0.5 + color: "black" + border.color: "#2D918D" + border.width: 2 + radius: 5 + } + PushButton { + x: buttonBox1.x+10 + y: buttonBox1.y+10 + } + PushButton { + x: buttonBox1.x+10 + y: buttonBox1.y+60 + } + PushButton { + x: buttonBox1.x+10 + y: buttonBox1.y+110 + } + + Rectangle { + id: buttonBox2 + x: 550 + y: 110 + width: 60 + height: 160 + opacity: 0.5 + color: "black" + border.color: "#2D918D" + border.width: 2 + radius: 5 + } + PushButton { + x: buttonBox2.x+10 + y: buttonBox2.y+10 + } + PushButton { + x: buttonBox2.x+10 + y: buttonBox2.y+60 + } + PushButton { + x: buttonBox2.x+10 + y: buttonBox2.y+110 + } + + states: [ + State {}, + State {} + + ] +} + + diff --git a/demos/declarative/RoboBounce/RobotCore/Robot.qml b/demos/declarative/RoboBounce/RobotCore/Robot.qml new file mode 100644 index 000000000..c696b794b --- /dev/null +++ b/demos/declarative/RoboBounce/RobotCore/Robot.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Nokia Corporation and its Subsidiary(-ies) 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 Qt 4.7 +import Qt3D 1.0 + +Item3D { + id: robot1 + scale: 0.3 + mesh: Mesh { id: roboMesh; source: "../Assets/roboticBody.3ds"; } + effect: Effect {} +} + + diff --git a/demos/declarative/RoboBounce/RobotCore/TronCube.qml b/demos/declarative/RoboBounce/RobotCore/TronCube.qml new file mode 100644 index 000000000..9e352602c --- /dev/null +++ b/demos/declarative/RoboBounce/RobotCore/TronCube.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Nokia Corporation and its Subsidiary(-ies) 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 Qt 4.7 +import Qt3D 1.0 +import Qt3D.Shapes 1.0 + +Cube { + effect: Effect {color: "#aaaaaa"; texture: "../Assets/qtlogo.png"; decal: true} + position: Qt.vector3d(0,-5.01, 0) +} + + diff --git a/demos/declarative/RoboBounce/robobounce.qml b/demos/declarative/RoboBounce/robobounce.qml new file mode 100644 index 000000000..a5b871114 --- /dev/null +++ b/demos/declarative/RoboBounce/robobounce.qml @@ -0,0 +1,616 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Nokia Corporation and its Subsidiary(-ies) 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 Qt 4.7 +import Qt3D 1.0 +import Qt3D.Shapes 1.0 +import "Calculator" +import "RobotCore" + +Image { + property real eyeSeparation: 0.0 //Eye separation: 0.1 for 3d, 0.0 for standard + property real repeatAnimationTimer: 30; //Auto click the 'start' button this often + + id: theBackground + width: 640 + height: 480 + source: "Assets/tronscape.png" + + focus: true + Keys.onSpacePressed: { + heartbeat.restart(); + qt3dButton.bounce = true; + console.log("Hide Calc") + if (calc.state=="hidden") { + calc.state="shown" + + } else { + calc.state = "hidden" + }; + } + Keys.onLeftPressed: { + console.log("Rotate Key Pressed"); + heartbeat.restart(); + room.spinning = true; + } + Keys.onRightPressed: { + console.log("Box Drop Key pressed"); + heartbeat.restart(); + smallCube.fallingCubeAnimation=true; + } + Keys.onUpPressed: { + console.log("Info Key Pressed"); + heartbeat.restart(); + roboInfo.showVisible=true + } + Keys.onPressed: { + heartbeat.restart(); + if (event.key==Qt.Key_A) { + navigator.spindir=1 + } else if (event.key==Qt.Key_D) { + navigator.spindir=2 + } else if (event.key==Qt.Key_W) { + navigator.tiltdir=1 + } else if (event.key==Qt.Key_S) { + navigator.tiltdir=2 + } else if (event.key==Qt.Key_Plus) { + navigator.zoomdir=1 + } else if (event.key==Qt.Key_Minus) { + navigator.zoomdir=2 + } + } + Keys.onReleased: { + heartbeat.restart(); + if (event.key==Qt.Key_A) { + navigator.spindir=0 + } else if (event.key==Qt.Key_D) { + navigator.spindir=0 + } else if (event.key==Qt.Key_W) { + navigator.tiltdir=0 + } else if (event.key==Qt.Key_S) { + navigator.tiltdir=0 + } else if (event.key==Qt.Key_Plus) { + navigator.zoomdir=0 + } else if (event.key==Qt.Key_Minus) { + navigator.zoomdir=0 + } + } + + Timer { + id: navigator; + interval: 5; + running: true + repeat: true + property int tiltdir: 0 //1 is forward, 2 is back + property int spindir: 0 //1 is right, 2 is left + property int zoomdir: 0 //1 is in, 2 is out + onTriggered: { + if (tiltdir==1) {roomTilt.angle=roomTilt.angle+0.5} + else if (tiltdir==2) {roomTilt.angle=roomTilt.angle-0.5} + if (spindir==1) {roomSpin.angle=roomSpin.angle+0.5} + else if (spindir==2) {roomSpin.angle=roomSpin.angle-0.5} + if (spindir==1) {roomSpin.angle=roomSpin.angle+0.5} + else if (spindir==2) {roomSpin.angle=roomSpin.angle-0.5} + if (zoomdir==1) { + if (theCamera.fieldOfView>13) { + theCamera.fieldOfView=theCamera.fieldOfView-0.5 + } + } else if (zoomdir==2) { + if (theCamera.fieldOfView<80) { + theCamera.fieldOfView=theCamera.fieldOfView+0.5 + } + } + } + } + + + Timer { + id: heartbeat; + interval: theBackground.repeatAnimationTimer*1000; + running: true + repeat: true + onTriggered: { + qt3dButton.bounce = true; + console.log("Hide Calc") + if (calc.state=="hidden") { + calc.state="shown" + } else { + calc.state = "hidden" + } + } + } + + StereoView { + id: stereo + width: 640; height: 480 + //layout: StereoView.LeftRight + + Viewport { + id: viewport + width: parent.width + height: parent.height + navigation: true + picking: true + //showPicking: true + + Item { + visible: false + id: buttonPanel + state: "panelUp" + states: [ + State { name: "panelDown";}, + State { name: "panelUp";} + ] + + transitions: [ + Transition { + from: "*" + to: "panelDown" + SequentialAnimation { + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 10} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 10} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 10} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 10} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 10} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + } + }, + Transition { + from: "*" + to: "panelUp" + SequentialAnimation { + onStarted: { console.log("Panel Up"); } + NumberAnimation {target: buttonPanel; property: opacity; to: 0; duration: 2000;} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + } + } + ] + + Rectangle { + id: buttonBox1 + x: viewport.width-175 + y: 10 + width: 160 + height: 60 + opacity: 0.5 + color: "black" + border.color: "#2D918D" + border.width: 2 + radius: 5 + } + PushButton { + source: "Assets/rotateButton2.png" + x: buttonBox1.x+10 + y: buttonBox1.y+10 + onPressed: { + console.log("Rotate Pressed"); + room.spinning = true; + heartbeat.restart(); + } + } + PushButton { + source: "Assets/cubeButton.png" + x: buttonBox1.x+60 + y: buttonBox1.y+10 + onPressed: { + console.log("Box button pressed"); + smallCube.fallingCubeAnimation=true; + heartbeat.restart(); + } + } + PushButton { + source: "Assets/infobutton.png" + x: buttonBox1.x+110 + y: buttonBox1.y+10 + onPressed: { + console.log("Info Button Pressed"); + roboInfo.showVisible=true + heartbeat.restart(); + } + } + } + + Rectangle { + id: roboInfo + x: 5 + y: 85 + width: 150 + height: 175 + opacity: 0.0 + color: "black" + property bool showVisible: false + border.color: "#2D918D" + border.width: 2 + radius: 5 + Image { + source: "Assets/roboInfo.png" + } + + SequentialAnimation { + running: roboInfo.showVisible + loops: Animation.infinite + NumberAnimation {target: roboInfo; property: "opacity"; to: 0.7; duration: 500} + PauseAnimation {duration: 3000} + NumberAnimation {target: roboInfo; property: "opacity"; to: 0.0; duration: 500} + onCompleted: {roboInfo.showVisible=false} + } + } + + Calculator { + id: calc + } + + Image { + id: qt3dButton + source: "Assets/sQt3D_logo.png" + property bool bounce: false + + x: 10 + y: 5 + width: 110 + height: 70 + + SequentialAnimation { + running: qt3dButton.bounce + NumberAnimation {target: qt3dButton; property: "scale"; duration: 100; to: 1.2;} + NumberAnimation {target: qt3dButton; property: "scale"; duration: 100; to: 1;} + onCompleted: {qt3dButton.bounce = false} + } + + MouseArea { + id: qt3dActivate + anchors.fill: parent + onClicked: { + heartbeat.restart(); + qt3dButton.bounce = true; + console.log("Hide Calc") + if (calc.state=="hidden") { + calc.state="shown" + } else { + calc.state = "hidden" + } + } + } + } + + camera: Camera { + id: theCamera + eye: Qt.vector3d(0, 2, 10) + nearPlane:2.5 + center: Qt.vector3d(0,2,0) + fieldOfView: 12 + eyeSeparation: theBackground.eyeSeparation + } + + Item3D { + id: scene + + states: [ + State { name: "qmlView"; when: calc.visible}, + State { name: "threedView"; when: !calc.visible } + ] + + transitions: [ + Transition { + from: "*" + to: "qmlView" + SequentialAnimation { + PropertyAction{target: roomSpin; property: "angle"; value: 0} + PropertyAction{target: roomTilt; property: "angle"; value: 0} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PropertyAction{target: theCamera; property: "eye"; value: Qt.vector3d(0, 2, 10)} + PropertyAction{target: theCamera; property: "fieldOfView"; value: 11.45} + PropertyAction{target: spinSign; property: "angle"; value: 0} + PropertyAction{target: robot; property: "position"; value: Qt.vector3d(0,10,4)} + PropertyAction{target: pitch; property: "angle"; value: 0} + PropertyAction{target: roll; property: "angle"; value: 75} + PropertyAction{target: yaw; property: "angle"; value: 90} + PropertyAction{target: spinSign; property: "angle"; value: 0} + PropertyAction{target: innerCube; property: "scale"; value: 0.95} + PropertyAction{target: signCube; property: "scale"; value: 2.375} + } + }, + Transition { + from: "*" + to: "threedView" + SequentialAnimation { + onStarted: {console.log("start")} + SequentialAnimation { + NumberAnimation { target: theCamera; property: "fieldOfView"; to: 20; duration: 1000; easing.type: "InOutQuad" } + ParallelAnimation { + NumberAnimation { target: spinSign; property: "angle"; to: 720; duration: 500; easing.type: "InOutQuad"} + NumberAnimation { target: innerCube; property: "scale"; to: 1.01; duration: 500} + } + } + PauseAnimation {duration: 1000} + ParallelAnimation { + NumberAnimation {target: theCamera; property: "fieldOfView"; to: 40; + duration: 1000; easing.type: "InOutQuad"} + Vector3dAnimation {target: theCamera; property: "eye"; to: Qt.vector3d(0,4,10); + duration: 2500; easing.type: "InOutQuad" + } + } + PauseAnimation {duration: 1000} + NumberAnimation {target: signCube; property: "scale"; to: 0.0; duration: 2500; easing.type: "InOutQuad"} + Vector3dAnimation {target: robot; property: "position"; to: Qt.vector3d(0,0,4); duration: 1000; easing.type: "OutBounce"} + PauseAnimation {duration: 500} + NumberAnimation { target:roll; property: "angle"; to: 0; duration: 2500; easing.type: "InOutElastic"} + NumberAnimation { target: theCamera; property: "fieldOfView"; to: 20; duration: 1000; easing.type: "InOutQuad" } + NumberAnimation { target: headroll; property: "angle"; to: 0; duration: 500; easing.type: "OutElastic"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 00; duration: 100; easing.type: "OutQuad"} + NumberAnimation { target: theCamera; property: "fieldOfView"; to: 40; duration: 1000; easing.type: "InOutQuad" } + PauseAnimation{duration: 1000} + ParallelAnimation { + SequentialAnimation { + NumberAnimation {target: pitch; property: "angle"; to: -10; duration: 500; easing.type: "InOutBack"} + PauseAnimation{duration: 1000} + NumberAnimation {target: pitch; property: "angle"; to: 0; duration: 500; easing.type: "InOutBack"} + } + Vector3dAnimation {target: robot; property: "position"; to: Qt.vector3d(0,0,0); duration: 2000; easing.type: "InOutBack"} + } + PauseAnimation{duration: 500} + SequentialAnimation { + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 50} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 40} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 100} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 40} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 150} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 40} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + PauseAnimation{duration: 300} + PropertyAction{target: buttonPanel; property: "visible"; value: false} + PauseAnimation{duration: 40} + PropertyAction{target: buttonPanel; property: "visible"; value: true} + } + } + } + ] + + effect: Effect{} + + Light {position: Qt.vector3d(20,5,00)} + + + Item3D { + id: room + property bool spinning: false + transform: [ + Rotation3D{id: roomTilt; angle: 0; axis: Qt.vector3d(1,0,0)}, + Rotation3D{id: roomSpin; angle: 0; axis: Qt.vector3d(0,1,0)} + ] + + + NumberAnimation { + running: room.spinning + loops: Animation.infinite + target: roomSpin + property: "angle" + to: 360 + duration: 3000 + easing.type: "InOutQuad" + onCompleted: { + room.spinning=false + roomSpin.angle=0 + } + } + + TronCube { + id: smallCube + property bool fallingCubeAnimation: false + position: Qt.vector3d(0,5,0) + + onClicked: { + heartbeat.restart(); + console.log("Small cube clicked"); + smallCube.fallingCubeAnimation=true; + } + + transform: [ + Rotation3D {id: spinSmallCube; angle: 0; axis: Qt.vector3d(0,1,0)} + ] + + SequentialAnimation { + running: smallCube.fallingCubeAnimation + loops: Animation.infinite + onCompleted: {smallCube.fallingCubeAnimation=false;} + ParallelAnimation { + NumberAnimation {target: spinSmallCube; property: "angle"; to: 360; easing.type: "InOutQuad"; duration: 1750} + SequentialAnimation { + Vector3dAnimation {target: smallCube; property: "position"; to: Qt.vector3d(0,3.2,0); easing.type: "InQuad"; duration: 250} + PropertyAction {target: robotHead; property: "y"; value: 9.00;} + ParallelAnimation { + NumberAnimation {target: smallCube; property: "x"; to: 2; easing.type: "Linear"; duration: 1500} + SequentialAnimation { + NumberAnimation {target: smallCube; property: "y"; to: 4.5; easing.type: "OutQuad"; duration: 250} + NumberAnimation {target: smallCube; property: "y"; to: 0.5; easing.type: "OutBounce"; duration: 1250} + } + } + } + } + PauseAnimation {duration: 500 } + NumberAnimation { target: robotHead; property: "y"; to: 9.2; easing.type: "OutBounce"; duration: 250 } + PauseAnimation {duration: 500 } + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: -30; duration: 70; easing.type: "InOutQuad"} + NumberAnimation { target: headyaw; property: "angle"; to: 00; duration: 100; easing.type: "OutQuad"} + NumberAnimation { target: yaw; property: "angle"; to: 180; duration: 250; easing.type: "InOutQuad"} + NumberAnimation { target: armBend; property: "angle"; to: -45; duration: 500; easing.type: "InOutQuad"} + ParallelAnimation { + NumberAnimation { target: robot; property: "x"; to: 0.5; duration: 500; easing.type: "InQuad"} + NumberAnimation { target: pitch; property: "angle"; to: 30; duration: 500; easing.type: "InOutQuad"} + } + ParallelAnimation { + NumberAnimation { target: robot; property: "x"; to: 3.5; duration: 1000; easing.type: "Linear"} + NumberAnimation { target: smallCube; property: "x"; to: 5; duration: 1000; easing.type: "Linear"} + } + ParallelAnimation { + NumberAnimation { target: smallCube; property: "x"; to: 8; duration: 1000; easing.type: "Linear"} + SequentialAnimation { + PauseAnimation { duration: 250} + NumberAnimation { target: smallCube; property: "y"; to: -5; duration: 750; easing.type: "InQuad"} + } + ParallelAnimation { + SequentialAnimation { + NumberAnimation {target: pitch; property: "angle"; to: -10; duration: 750; easing.type: "InOutBack"} + PauseAnimation{duration: 1500} + NumberAnimation {target: pitch; property: "angle"; to: 0; duration: 750; easing.type: "InOutBack"} + } + Vector3dAnimation {target: robot; property: "position"; to: Qt.vector3d(0,0,0); duration: 3000; easing.type: "InOutBack"} + } + } + NumberAnimation { target: yaw; property: "angle"; to: 90; duration: 250; easing.type: "InOutQuad"} + NumberAnimation { target: armBend; property: "angle"; to: -90; duration: 500; easing.type: "InOutQuad"} + PauseAnimation { duration: 1000 } + PropertyAction {target: smallCube; property: "position"; value: Qt.vector3d(0,10,0)} + NumberAnimation { target: smallCube; property: "y"; to: 5; duration: 1000; easing.type: "OutQuad"} + } + } + + TronCube { + scale: 10.0 + onClicked: { + heartbeat.restart(); + console.log("Big cube clicked"); + room.spinning = true; + } + } + + Cube { + id: signCube + scale: 2.375 + position: Qt.vector3d(0,2,0) + effect: calcEffect + transform: [ + Rotation3D{id: spinSign; angle: 180; axis:Qt.vector3d(0,1,0)} + ] + + Cube { + id: innerCube + scale: 0.95 + effect: signEffect + } + + Effect { + id: signEffect + color: "#aaca00" + texture: "Assets/QML3DSign.png" + decal: true + } + + Effect { + id: calcEffect + color: "#aaca00" + texture: "Assets/calculatorSign.png" + decal: true + } + } + + Robot { + id: robot + position: Qt.vector3d(0,10,4) + + onClicked: { + heartbeat.restart(); + console.log("robot has been clicked") + roboInfo.showVisible=true + } + + transform: [ + Rotation3D {id: pitch; angle: 0; axis: Qt.vector3d(0,0,1)}, + Rotation3D {id: roll; angle: 75; axis: Qt.vector3d(1,0,0)}, + Rotation3D {id: yaw; angle: 90; axis: Qt.vector3d(0,1,0)} + ] + + Item3D { + id: robotArms + mesh: Mesh { source: "Assets/roboticArms.3ds"} + transform: Rotation3D{id: armBend; angle: -90;axis: Qt.vector3d(0,0,1)} + position: Qt.vector3d(.18, 5.4,0) + + SequentialAnimation { + running: false + loops: 100 + NumberAnimation {target: armBend; property: "angle"; to: 0.0; duration: 1000; easing.type: "OutQuad" } + PauseAnimation {duration: 1000} + NumberAnimation {target: armBend; property: "angle"; to: -90.0; duration: 1000; easing.type: "OutQuad" } + } + } + + Item3D { + id: robotHead + mesh: Mesh { source: "Assets/roboticHead.3ds" } + position: Qt.vector3d(0,9.1,0) + transform: [ + Rotation3D {id: headpitch; angle: 0; axis: Qt.vector3d(0,0,1)}, + Rotation3D {id: headroll; angle: 45; axis: Qt.vector3d(1,0,0)}, + Rotation3D {id: headyaw; angle: 0; axis: Qt.vector3d(0,1,0)} + ] + } + } + } + } + } + } +} |