| 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.1 as QQ2 |
| 5 |
import Qt3D.Core 2.0 |
| 6 |
import Qt3D.Render 2.0 |
| 7 |
import Qt3D.Extras 2.0 |
| 8 |
|
| 9 |
Entity { |
| 10 |
id: root |
| 11 |
property real hue: 0.0 |
| 12 |
property alias animateColors: hueAnim.running |
| 13 |
property Layer layer: null |
| 14 |
|
| 15 |
QQ2.NumberAnimation { |
| 16 |
id: hueAnim |
| 17 |
target: root |
| 18 |
property: "hue" |
| 19 |
from: 0.0; to: 1.0 |
| 20 |
duration: 200000 |
| 21 |
running: false |
| 22 |
loops: QQ2.Animation.Infinite |
| 23 |
} |
| 24 |
|
| 25 |
Entity { |
| 26 |
id: _private |
| 27 |
property color color1: Qt.hsla( (hue + 0.59) % 1, 0.53, 0.59 ) |
| 28 |
property color color2: Qt.hsla( (hue + 0.59) % 1, 1.0, 0.15 ) |
| 29 |
} |
| 30 |
|
| 31 |
components: [ layer, mesh, transform, material ] |
| 32 |
|
| 33 |
PlaneMesh { |
| 34 |
id: mesh |
| 35 |
width: 2.0 |
| 36 |
height: 2.0 |
| 37 |
meshResolution: Qt.size( 2, 2 ) |
| 38 |
} |
| 39 |
|
| 40 |
Transform { |
| 41 |
id: transform |
| 42 |
// Rotate the plane so that it faces us |
| 43 |
rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90) |
| 44 |
} |
| 45 |
|
| 46 |
Material { |
| 47 |
id: material |
| 48 |
effect: BackgroundEffect {} |
| 49 |
parameters: [ |
| 50 |
Parameter { name: "color1"; value: Qt.vector3d( _private.color1.r, _private.color1.g, _private.color1.b ) }, |
| 51 |
Parameter { name: "color2"; value: Qt.vector3d( _private.color2.r, _private.color2.g, _private.color2.b ) } |
| 52 |
] |
| 53 |
} |
| 54 |
} |