summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/scene2d/main.qml
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-05-09 15:14:00 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2017-05-10 04:12:59 +0000
commitb35237bfee04ae38cc35bdb333ab1ef8a74ffaae (patch)
tree16f5771babba5108553765aecd22e61d891c68aa /examples/qt3d/scene2d/main.qml
parent2eb53d735488cd2fb609e51c036c5ee3554557c7 (diff)
Scene2D example: highlight that QtQuick is a Texture on a Mesh
Change-Id: Ibc78cc120ceed26c8521fa116e1794500b47c2dd Task-number: QTBUG-60695 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/scene2d/main.qml')
-rw-r--r--examples/qt3d/scene2d/main.qml40
1 files changed, 28 insertions, 12 deletions
diff --git a/examples/qt3d/scene2d/main.qml b/examples/qt3d/scene2d/main.qml
index d9d4676c2..35b8f3eb6 100644
--- a/examples/qt3d/scene2d/main.qml
+++ b/examples/qt3d/scene2d/main.qml
@@ -108,25 +108,41 @@ Entity {
}
Entity {
- id: plane
+ id: cube
- components: [planeTransform, planeMaterial, planeMesh, planePicker]
+ components: [cubeTransform, cubeMaterial, cubeMesh, cubePicker]
+
+ property real rotationAngle: 0
+
+ Behavior on rotationAngle {
+ enabled: logoControls.enabled
+ RotationAnimation {
+ direction: RotationAnimation.Shortest
+ duration: 450
+ }
+ }
+
+ RotationAnimation on rotationAngle {
+ running: !logoControls.enabled
+ loops: Animation.Infinite
+ from: 0; to: 360
+ duration: 4000
+ onStopped: cube.rotationAngle = 0
+ }
Transform {
- id: planeTransform
+ id: cubeTransform
translation: Qt.vector3d(2, 0, 10)
- rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90)
+ scale3D: Qt.vector3d(1, 4, 1)
+ rotation: fromAxisAndAngle(Qt.vector3d(0,1,0), cube.rotationAngle)
}
- PlaneMesh {
- id: planeMesh
- width: 1
- height: 4
- mirrored: true // Align OpenGL and Qt window coordinates by flipping texture coordinates
+ CuboidMesh {
+ id: cubeMesh
}
ObjectPicker {
- id: planePicker
+ id: cubePicker
hoverEnabled: true
dragEnabled: true
@@ -141,7 +157,7 @@ Entity {
}
TextureMaterial {
- id: planeMaterial
+ id: cubeMaterial
texture: offscreenTexture
}
@@ -164,7 +180,7 @@ Entity {
}
}
- entities: [ plane ]
+ entities: [ cube ]
mouseEnabled: false
LogoControls {