summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-10-03 09:03:21 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-10-03 15:42:28 +0200
commit5c127b4a7c93fbb81e3c6d21c2c0a292ed496375 (patch)
treedb407924bd26c4a11dff4201342a00c22bc24d0a /examples
parent8a1d20430306b4f6a0691c826df538b3b7852b59 (diff)
Shadow Map example: Add plane animations
Change-Id: I3f6a46bf9a5e7e143d5c1fb9596fbb1f984f6cb7 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/shadow-map-qml/Toyplane.qml53
1 files changed, 52 insertions, 1 deletions
diff --git a/examples/shadow-map-qml/Toyplane.qml b/examples/shadow-map-qml/Toyplane.qml
index 3aedf1543..bb0533126 100644
--- a/examples/shadow-map-qml/Toyplane.qml
+++ b/examples/shadow-map-qml/Toyplane.qml
@@ -61,13 +61,28 @@ Entity {
Transform {
id: toyplaneTransform
+ property real rollAngle : 0
+ property real pitchAngle : 15
+ property real altitude : 5
property real angle: 0
property real scaleFactor: 10
+ QQ2.Behavior on rollAngle { QQ2.SpringAnimation { spring: 2; damping: 0.2} }
+
Scale {
scale: 1.0 / toyplaneTransform.scaleFactor
}
+ Rotate { // roll
+ axis : Qt.vector3d(1, 0, 0)
+ angle : toyplaneTransform.rollAngle
+ }
+
+ Rotate { // pitch
+ axis : Qt.vector3d(0, 0, 1)
+ angle : toyplaneTransform.pitchAngle
+ }
+
Rotate {
id: toyplaneRotation
axis: Qt.vector3d(0, 1, 0)
@@ -78,7 +93,7 @@ Entity {
property real translation: 1
dx: Math.sin(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor
- dy: 0
+ dy: toyplaneTransform.altitude
dz: Math.cos(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor
}
}
@@ -95,6 +110,42 @@ Entity {
to: 360
}
+ // Altitude / Pitch animation
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.ParallelAnimation {
+ QQ2.SequentialAnimation {
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 0; to: 30; duration: 2000; easing.type: QQ2.Easing.OutQuad }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 30; to: 0; duration: 2000; easing.type: QQ2.Easing.OutSine }
+ }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "altitude"; to: 5; duration: 4000; easing.type: QQ2.Easing.InOutCubic }
+ }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.ParallelAnimation {
+ QQ2.SequentialAnimation {
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 0; to: -30; duration: 1000; easing.type: QQ2.Easing.OutQuad }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: -30; to: 0; duration: 5000; easing.type: QQ2.Easing.OutSine }
+ }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "altitude"; to: 0; duration: 6000; easing.type: QQ2.Easing.InOutCubic}
+ }
+ QQ2.PauseAnimation { duration: 1500 }
+ }
+
+ // Roll Animation
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; to: 360; duration: 1500; easing.type: QQ2.Easing.InOutQuad }
+ QQ2.PauseAnimation { duration: 1000 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: 0; to: 30; duration: 1000; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: 30; to: -30; duration: 1000; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: -30; to: 0; duration: 750; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 2000 }
+ }
+
components: [
toyplaneMesh,
toyplaneTransform,