| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.4 as QQ2 |
| 5 |
import Qt3D.Core 2.0 |
| 6 |
import Qt3D.Render 2.0 |
| 7 |
import Qt3D.Extras 2.0 |
| 8 |
|
| 9 |
Entity { |
| 10 |
components: [ mesh, phongMaterial, transform ] |
| 11 |
|
| 12 |
CuboidMesh { |
| 13 |
id: mesh |
| 14 |
yzMeshResolution: Qt.size(2, 2) |
| 15 |
xzMeshResolution: Qt.size(2, 2) |
| 16 |
xyMeshResolution: Qt.size(2, 2) |
| 17 |
} |
| 18 |
|
| 19 |
GoochMaterial { |
| 20 |
id: phongMaterial |
| 21 |
} |
| 22 |
|
| 23 |
Transform { |
| 24 |
id: transform |
| 25 |
property real userAngle: 0.0 |
| 26 |
scale: 4 |
| 27 |
rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle) |
| 28 |
} |
| 29 |
|
| 30 |
QQ2.ColorAnimation { |
| 31 |
target: phongMaterial |
| 32 |
property: "warm" |
| 33 |
from: "red" |
| 34 |
to: "blue" |
| 35 |
duration: 2500 |
| 36 |
loops: QQ2.Animation.Infinite |
| 37 |
running: true |
| 38 |
} |
| 39 |
|
| 40 |
QQ2.NumberAnimation { |
| 41 |
target: transform |
| 42 |
property: "userAngle" |
| 43 |
duration: 750 |
| 44 |
loops: QQ2.Animation.Infinite |
| 45 |
running: true |
| 46 |
easing.type: QQ2.Easing.InOutQuad |
| 47 |
from: 0 |
| 48 |
to: 360 |
| 49 |
} |
| 50 |
} |