diff options
Diffstat (limited to 'examples/qt3d/scene3d-loader/AnimatedEntity.qml')
-rw-r--r-- | examples/qt3d/scene3d-loader/AnimatedEntity.qml | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/examples/qt3d/scene3d-loader/AnimatedEntity.qml b/examples/qt3d/scene3d-loader/AnimatedEntity.qml index bf73d6df4..5431db8ea 100644 --- a/examples/qt3d/scene3d-loader/AnimatedEntity.qml +++ b/examples/qt3d/scene3d-loader/AnimatedEntity.qml @@ -36,6 +36,7 @@ import Qt3D.Core 2.0 import Qt3D.Render 2.0 + import QtQuick 2.0 as QQ2 @@ -63,7 +64,7 @@ Entity { activeFrameGraph: Viewport { id: viewport rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left - clearColor: Qt.rgba(0, 0.5, 1, 1) + clearColor: "transparent" CameraSelector { id : cameraSelector @@ -91,10 +92,14 @@ Entity { Transform { id: torusTransform - Scale { scale3D: Qt.vector3d(1.5, 1, 0.5) } - Rotate { - angle: 45 - axis: Qt.vector3d(1, 0, 0) + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.rotate(45, Qt.vector3d(1, 0, 0)) + m.scale(Qt.vector3d(1.5, 1, 0.5)); + return m; } } @@ -110,19 +115,21 @@ Entity { Transform { id: sphereTransform - Translate { - translation: Qt.vector3d(20, 0, 0) - } - - Rotate { - id: sphereRotation - axis: Qt.vector3d(0, 1, 0) + property real userAngle: 0.0 + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.translate(Qt.vector3d(20, 0, 0)); + m.rotate(userAngle, Qt.vector3d(0, 1, 0)) + return m; } } QQ2.NumberAnimation { - target: sphereRotation - property: "angle" + target: sphereTransform + property: "userAngle" duration: 10000 from: 0 to: 360 |