diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-07-10 14:56:00 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-07-12 19:15:43 +0000 |
commit | 2390fbeac2cb38d68b08a8fda1141cf713b32e4b (patch) | |
tree | 87c8dd88abd96e9515765fdc71f9c4170146af43 /examples | |
parent | 80f0e379b3fdce0ae77ba31bf2b9fa97c6687d97 (diff) |
Lights: Fix animation in example and add another
Looks like QML doesn't like animating only a single element of a 3d
vector. It seems to default the non-animating elements to 0. Instead
use a Vector3DAnimation.
Also added another animation to the transformation to make the
spotlight move back and forth in addition to sweeping it's local
direction angle.
Change-Id: Ief490752107b2b618dcf8500cb87561b3baea0bb
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qt3d/lights/main.qml | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml index 0d9b2b182..8f1c603cf 100644 --- a/examples/qt3d/lights/main.qml +++ b/examples/qt3d/lights/main.qml @@ -145,21 +145,30 @@ Entity radius: 1 }, Transform { - translation: Qt.vector3d(-5.0, 40.0, -5.0) + translation: Qt.vector3d(-20.0, 40.0, 0.0) + + Quick.SequentialAnimation on translation { + loops: Quick.Animation.Infinite + running: true + Quick.Vector3dAnimation { from: Qt.vector3d(-40.0, 40.0, 0.0); to: Qt.vector3d(40.0, 40.0, 0.0); duration: 5000 } + Quick.Vector3dAnimation { from: Qt.vector3d(40.0, 40.0, 0.0); to: Qt.vector3d(-40.0, 40.0, 0.0); duration: 5000 } + } }, PhongMaterial { diffuse: "white" }, SpotLight { - localDirection: Qt.vector3d(1.0, -4.0, 0.0) - Quick.SequentialAnimation on localDirection.x { - Quick.NumberAnimation { from: -4.0; to: 4.0; duration: 5000 } - Quick.NumberAnimation { from: 4.0; to: -4.0; duration: 5000 } + localDirection: Qt.vector3d(0.0, -4.0, 0.0) + Quick.SequentialAnimation on localDirection { loops: Quick.Animation.Infinite + running: true + Quick.Vector3dAnimation { from: Qt.vector3d(0.0, -4.0, -4.0); to: Qt.vector3d(0.0, -4.0, 4.0); duration: 1000 } + Quick.Vector3dAnimation { from: Qt.vector3d(0.0, -4.0, 4.0); to: Qt.vector3d(0.0, -4.0, -4.0); duration: 1000 } } + color: "white" cutOffAngle: 30 constantAttenuation: 1 - intensity: 4 + intensity: 2.5 } ] } |