aboutsummaryrefslogtreecommitdiffstats
path: root/examples/particles/affectors
diff options
context:
space:
mode:
Diffstat (limited to 'examples/particles/affectors')
-rw-r--r--examples/particles/affectors/age.qml97
-rw-r--r--examples/particles/affectors/attractor.qml213
-rw-r--r--examples/particles/affectors/customaffector.qml173
-rw-r--r--examples/particles/affectors/friction.qml109
-rw-r--r--examples/particles/affectors/gravity.qml103
-rw-r--r--examples/particles/affectors/groupgoal.qml193
-rw-r--r--examples/particles/affectors/move.qml141
-rw-r--r--examples/particles/affectors/spritegoal.qml212
-rw-r--r--examples/particles/affectors/turbulence.qml135
-rw-r--r--examples/particles/affectors/wander.qml95
10 files changed, 1471 insertions, 0 deletions
diff --git a/examples/particles/affectors/age.qml b/examples/particles/affectors/age.qml
new file mode 100644
index 0000000000..1e7774b63b
--- /dev/null
+++ b/examples/particles/affectors/age.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "white"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "../images/snowflake.png"
+ frames: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 8000
+ speed: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 36
+ endSize: 12
+ sizeVariation: 8
+ width: parent.width
+ height: 100
+ }
+
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ Rectangle {
+ color: "#803333AA"
+ border.color: "black"
+ x: ma.mouseX - 36
+ y: ma.mouseY - 36
+ width: 72
+ height: 72
+ Age {
+ anchors.fill: parent
+ system: particles
+ once: true
+ lifeLeft: 1200
+ advancePosition: false
+ }
+ }
+}
diff --git a/examples/particles/affectors/attractor.qml b/examples/particles/affectors/attractor.qml
new file mode 100644
index 0000000000..460a497a92
--- /dev/null
+++ b/examples/particles/affectors/attractor.qml
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ property bool spacePressed: false
+ focus: true
+ Image {
+ source: "../images/finalfrontier.png"
+ anchors.centerIn:parent
+ }
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Space) {
+ spacePressed = true;
+ event.accepted = true;
+ }
+ }
+ Keys.onReleased: {
+ if (event.key == Qt.Key_Space) {
+ spacePressed = false;
+ event.accepted = true;
+ }
+ }
+
+ Emitter {
+ group: "stars"
+ system: particles
+ emitRate: 40
+ lifeSpan: 4000
+ enabled: true
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection { x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ Emitter {
+ group: "roids"
+ system: particles
+ emitRate: 10
+ lifeSpan: 4000
+ enabled: true
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection { x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+ }
+ ImageParticle {
+ id: stars
+ groups: ["stars"]
+ system: particles
+ source: "../images/star.png"
+ color: "white"
+ colorVariation: 0.1
+ alpha: 0
+ }
+ ImageParticle {
+ id: roids
+ groups: ["roids"]
+ system: particles
+ sprites: Sprite {
+ id: spinState
+ name: "spinning"
+ source: "../images/meteor.png"
+ frames: 35
+ frameDuration: 60
+ }
+ }
+ ImageParticle {
+ id: shot
+ groups: ["shot"]
+ system: particles
+ source: "../images/star.png"
+
+ color: "#0FF06600"
+ colorVariation: 0.3
+ }
+ ImageParticle {
+ id: engine
+ groups: ["engine"]
+ system: particles
+ source: "../images/particle4.png"
+
+ color: "orange"
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "red"
+ duration: 1000
+ }
+ }
+
+ colorVariation: 0.2
+ }
+ Attractor {
+ id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000;
+ system: particles
+ affectedParameter: Attractor.Acceleration
+ proportionalToDistance: Attractor.InverseQuadratic
+ }
+ Age {
+ system: particles
+ x: gs.pointX - 8;
+ y: gs.pointY - 8;
+ width: 16
+ height: 16
+ }
+ Rectangle {
+ color: "black"
+ width: 8
+ height: 8
+ radius: 4
+ x: gs.pointX - 4
+ y: gs.pointY - 4
+ }
+
+ Image {
+ source:"../images/rocket2.png"
+ id: ship
+ width: 45
+ height: 22
+ MouseArea {
+ id: ma
+ anchors.fill: parent;
+ drag.axis: Drag.XandYAxis
+ drag.target: ship
+ }
+ }
+ Emitter {
+ group: "engine"
+ system: particles
+ emitRate: 200
+ lifeSpan: 1000
+ size: 10
+ endSize: 4
+ sizeVariation: 4
+ speed: PointDirection { x: -128; xVariation: 32 }
+ height: ship.height
+ y: ship.y
+ x: ship.x
+ width: 20
+ }
+ Emitter {
+ group: "shot"
+ system: particles
+ emitRate: 32
+ lifeSpan: 2000
+ enabled: spacePressed
+ size: 40
+ speed: PointDirection { x: 256; }
+ x: ship.x + ship.width
+ y: ship.y + ship.height/2
+ }
+
+ Text {
+ color: "white"
+ anchors.bottom: parent.bottom
+ text:"Drag the ship, Spacebar to fire."
+ }
+}
+
diff --git a/examples/particles/affectors/customaffector.qml b/examples/particles/affectors/customaffector.qml
new file mode 100644
index 0000000000..3f98cd5b43
--- /dev/null
+++ b/examples/particles/affectors/customaffector.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "../images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem {
+ id: sys
+ }
+ Emitter {
+ system: sys
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ speed: PointDirection { y: 60 }
+ }
+ Wander {
+ system: sys
+ anchors.fill: parent
+ anchors.bottomMargin: 100
+ xVariance: 60
+ pace: 60
+ }
+
+ Affector {
+ system: sys
+ property real coefficient: 0.1
+ property real speed: 1.5
+ width: parent.width
+ height: parent.height - 100
+ onAffectParticles: {
+ /* //Linear movement
+ if (particle.r == 0) {
+ particle.r = Math.random() > 0.5 ? -1 : 1;
+ }else if (particle.r == 1) {
+ particle.rotation += speed * dt;
+ if(particle.rotation >= maxAngle)
+ particle.r = -1;
+ }else if (particle.r == -1) {
+ particle.rotation -= speed * dt;
+ if(particle.rotation <= -1 * maxAngle)
+ particle.r = 1;
+ }
+ */
+ //Wobbly movement
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ if (particle.r == 0.0) {
+ particle.r = Math.random() + 0.01;
+ }
+ particle.rotation += speed * particle.r * dt;
+ particle.r -= particle.rotation * coefficient;
+ if (particle.r == 0.0)
+ particle.r -= particle.rotation * 0.000001;
+ particle.update = 1;
+ }
+ }
+ }
+
+ Affector {//Custom Friction, adds some 'randomness'
+ system: sys
+ //onceOff: true
+ x: -60
+ width: parent.width + 120
+ height: 100
+ anchors.bottom: parent.bottom
+ onAffectParticles: {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
+ var yslow = dt * pseudoRand * 0.5 + 1;
+ var xslow = dt * pseudoRand * 0.05 + 1;
+ if (particle.vy < 1)
+ particle.vy = 0;
+ else
+ particle.vy = (particle.vy / yslow);
+ if (particle.vx < 1)
+ particle.vx = 0;
+ else
+ particle.vx = (particle.vx / xslow);
+ particle.update = true;
+ }
+ }
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ source: "../images/realLeaf1.png"
+ frames: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "../images/realLeaf1.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "../images/realLeaf2.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "../images/realLeaf3.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "../images/realLeaf4.png"
+ frames: 1
+ frameDuration: 10000
+ }
+ ]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+}
diff --git a/examples/particles/affectors/friction.qml b/examples/particles/affectors/friction.qml
new file mode 100644
index 0000000000..4161fd9f02
--- /dev/null
+++ b/examples/particles/affectors/friction.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "../images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem { id: sys }
+ Emitter {
+ system: sys
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ speed: PointDirection { y: 160; yVariation: 80; xVariation: 20 }
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ source: "../images/realLeaf1.png"
+ frames: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "../images/realLeaf1.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "../images/realLeaf2.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "../images/realLeaf3.png"
+ frames: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "../images/realLeaf4.png"
+ frames: 1
+ frameDuration: 10000
+ }
+ ]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+ Friction {
+ anchors.fill: parent
+ anchors.margins: -40
+ system: sys
+ factor: 0.4
+ }
+}
diff --git a/examples/particles/affectors/gravity.qml b/examples/particles/affectors/gravity.qml
new file mode 100644
index 0000000000..b90d83e1c8
--- /dev/null
+++ b/examples/particles/affectors/gravity.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: window
+ width: 480; height: 480
+ Rectangle {
+ id: sky
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: "DeepSkyBlue"
+ }
+ GradientStop {
+ position: 1.0
+ color: "SkyBlue"
+ }
+ }
+ }
+
+ Rectangle {
+ id: ground
+ width: parent.width * 2
+ height: parent.height
+ y: parent.height/2
+ x: -parent.height/2
+ transformOrigin: Item.Top
+ rotation: 0
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "ForestGreen"; }
+ GradientStop { position: 1.0; color: "DarkGreen"; }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPositionChanged: {
+ var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI;
+ ground.rotation = rot;
+ }
+ }
+
+ ParticleSystem { id: sys }
+ Gravity {
+ system: sys
+ magnitude: 32
+ angle: ground.rotation + 90
+ }
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ emitRate: 1
+ lifeSpan: 10000
+ size: 64
+ }
+ ImageParticle {
+ anchors.fill: parent
+ system: sys
+ source: "../images/realLeaf1.png"
+ }
+
+}
diff --git a/examples/particles/affectors/groupgoal.qml b/examples/particles/affectors/groupgoal.qml
new file mode 100644
index 0000000000..273ec1a30c
--- /dev/null
+++ b/examples/particles/affectors/groupgoal.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "black"
+
+ property int score: 0
+ Text {
+ color: "white"
+ anchors.right: parent.right
+ text: score
+ }
+
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+ ParticleGroup {
+ name: "unlit"
+ duration: 1000
+ to: {"lighting":1, "unlit":99}
+ ImageParticle {
+ source: "../images/particleA.png"
+ colorVariation: 0.1
+ color: "#2060160f"
+ }
+ GroupGoal {
+ whenCollidingWith: ["lit"]
+ goalState: "lighting"
+ jump: true
+ }
+ }
+ ParticleGroup {
+ name: "lighting"
+ duration: 100
+ to: {"lit":1}
+ }
+ ParticleGroup {
+ name: "lit"
+ duration: 10000
+ onEntered: score++;
+ TrailEmitter {
+ id: fireballFlame
+ group: "flame"
+
+ emitRatePerParticle: 48
+ lifeSpan: 200
+ emitWidth: 8
+ emitHeight: 8
+
+ size: 24
+ sizeVariation: 8
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireballSmoke
+ group: "smoke"
+
+ emitRatePerParticle: 120
+ lifeSpan: 2000
+ emitWidth: 16
+ emitHeight: 16
+
+ speed: PointDirection {yVariation: 16; xVariation: 16}
+ acceleration: PointDirection {y: -16}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+ }
+
+ ImageParticle {
+ id: smoke
+ anchors.fill: parent
+ groups: ["smoke"]
+ source: "../images/particle.png"
+ colorVariation: 0
+ color: "#00111111"
+ }
+ ImageParticle {
+ id: pilot
+ anchors.fill: parent
+ groups: ["pilot"]
+ source: "../images/particle.png"
+ redVariation: 0.01
+ blueVariation: 0.4
+ color: "#0010004f"
+ }
+ ImageParticle {
+ id: flame
+ anchors.fill: parent
+ groups: ["flame", "lit", "lighting"]
+ source: "../images/particleA.png"
+ colorVariation: 0.1
+ color: "#00ff400f"
+ }
+
+ Emitter {
+ height: parent.height/2
+ emitRate: 4
+ lifeSpan: 4000//TODO: Infinite & kill zone
+ size: 24
+ sizeVariation: 4
+ speed: PointDirection {x:120; xVariation: 80; yVariation: 50}
+ acceleration: PointDirection {y:120}
+ group: "unlit"
+ }
+
+ Emitter {
+ id: flamer
+ x: 100
+ y: 300
+ group: "pilot"
+ emitRate: 80
+ lifeSpan: 600
+ size: 24
+ sizeVariation: 2
+ endSize: 0
+ speed: PointDirection { y:-100; yVariation: 4; xVariation: 4 }
+ GroupGoal {
+ groups: ["unlit"]
+ goalState: "lit"
+ jump: true
+ system: particles
+ x: -15
+ y: -55
+ height: 75
+ width: 30
+ shape: MaskShape {source: "../images/matchmask.png"}
+ }
+ }
+ //Click to enflame
+ GroupGoal {
+ groups: ["unlit"]
+ goalState: "lighting"
+ jump: true
+ enabled: ma.pressed
+ width: 18
+ height: 18
+ x: ma.mouseX - width/2
+ y: ma.mouseY - height/2
+ }
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/examples/particles/affectors/move.qml b/examples/particles/affectors/move.qml
new file mode 100644
index 0000000000..f290173ca8
--- /dev/null
+++ b/examples/particles/affectors/move.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ ImageParticle {
+ groups: ["A"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#FF1010"
+ redVariation: 0.8
+ }
+
+ Emitter {
+ group: "A"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 66; xVariation: 20 }
+ width: 80
+ height: 80
+ }
+
+ Affector {
+ groups: ["A"]
+ x: 120
+ width: 80
+ height: 80
+ once: true
+ position: PointDirection { x: 120; }
+ }
+
+ ImageParticle {
+ groups: ["B"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#10FF10"
+ greenVariation: 0.8
+ }
+
+ Emitter {
+ group: "B"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 240; xVariation: 60 }
+ y: 260
+ width: 10
+ height: 10
+ }
+
+ Affector {
+ groups: ["B"]
+ x: 120
+ y: 240
+ width: 80
+ height: 80
+ once: true
+ speed: AngleDirection { angleVariation:360; magnitude: 72 }
+ }
+
+ ImageParticle {
+ groups: ["C"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#1010FF"
+ blueVariation: 0.8
+ }
+
+ Emitter {
+ group: "C"
+ y: 400
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 80; xVariation: 10 }
+ acceleration: PointDirection { y: 10; x: 20; }
+ width: 80
+ height: 80
+ }
+
+ Affector {
+ groups: ["C"]
+ x: 120
+ y: 400
+ width: 80
+ height: 120
+ once: true
+ relative: false
+ acceleration: PointDirection { y: -80; }
+ }
+
+ }
+}
diff --git a/examples/particles/affectors/spritegoal.qml b/examples/particles/affectors/spritegoal.qml
new file mode 100644
index 0000000000..1ea61442aa
--- /dev/null
+++ b/examples/particles/affectors/spritegoal.qml
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: root
+ width: 360
+ height: 540
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ }
+
+ ParticleSystem { id: sys }
+ Image {
+ source: "../images/finalfrontier.png"
+ transformOrigin: Item.Center
+ anchors.centerIn: parent
+ smooth: true
+ NumberAnimation on rotation {
+ from: 0
+ to: 360
+ duration: 200000
+ loops: Animation.Infinite
+ }
+
+ }
+ ImageParticle {
+ system: sys
+ groups: ["starfield"]
+ source: "../images/star.png"
+ colorVariation: 0.3
+ color: "white"
+ }
+ Emitter {
+ id: starField
+ system: sys
+ group: "starfield"
+
+ emitRate: 80
+ lifeSpan: 2500
+
+ anchors.centerIn: parent
+
+ //acceleration: AngledDirection {angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed?
+ acceleration: PointDirection { xVariation: 200; yVariation: 200; }
+
+ size: 0
+ endSize: 80
+ sizeVariation: 10
+ }
+ Emitter {
+ system: sys
+ group: "meteor"
+ emitRate: 12
+ lifeSpan: 5000
+ acceleration: PointDirection { xVariation: 80; yVariation: 80; }
+ size: 15
+ endSize: 300
+ anchors.centerIn: parent
+ }
+ ImageParticle {
+ system: sys
+ groups: ["meteor"]
+ sprites:[Sprite {
+ id: spinState
+ name: "spinning"
+ source: "../images/meteor.png"
+ frames: 35
+ frameDuration: 40
+ randomStart: true
+ to: {"explode":0, "spinning":1}
+ },Sprite {
+ name: "explode"
+ source: "../images/_explo.png"
+ frames: 22
+ frameDuration: 40
+ to: {"nullFrame":1}
+ },Sprite {//Not sure if this is needed, but seemed easiest
+ name: "nullFrame"
+ source: "../images/nullRock.png"
+ frames: 1
+ frameDuration: 1000
+ }
+ ]
+ }
+ SpriteGoal {
+ groups: ["meteor"]
+ system: sys
+ goalState: "explode"
+ jump: true
+ anchors.centerIn: holder//A bug in affectors currently isn't compensating for relative x,y. when that's fixed this can just anchors.fill: rocketShip
+ width: 60
+ height: 60
+ }
+ Image {
+ id: rocketShip
+ source: "../images/rocket.png"
+ smooth: true
+ anchors.centerIn: holder
+ rotation: (circle.percent+0.25) * 360
+ z: 2
+ }
+ Item {
+ id: holder
+ x: circle.x - Math.sin(circle.percent * 6.28316530714)*200
+ y: circle.y + Math.cos(circle.percent * 6.28316530714)*200
+ z: 1
+ }
+
+ Item {
+ id: circle
+ x: root.width / 1.2
+ y: root.height / 1.7
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ id: circleAnim1
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 4000
+ from: 1
+ to: 0
+ }
+
+ }
+ }
+
+ ImageParticle {
+ z:0
+ system: sys
+ groups: ["exhaust"]
+ source: "../images/particle4.png"
+
+ color: "orange"
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "red"
+ duration: 1000
+ }
+ }
+
+ colorVariation: 0.2
+ }
+
+ Emitter {
+ id: trailsNormal2
+ system: sys
+ group: "exhaust"
+
+ emitRate: 300
+ lifeSpan: 500
+
+ y: holder.y
+ x: holder.x
+
+ speed: PointDirection { xVariation: 40; yVariation: 40; }
+ speedFromMovement: 16
+
+ acceleration: PointDirection { xVariation: 10; yVariation: 10; }
+
+ size: 4
+ sizeVariation: 4
+ }
+}
diff --git a/examples/particles/affectors/turbulence.qml b/examples/particles/affectors/turbulence.qml
new file mode 100644
index 0000000000..f3ad13431f
--- /dev/null
+++ b/examples/particles/affectors/turbulence.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 600
+ color: "#222222"
+ id: root
+ Image {
+ source: "../images/candle.png"
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottomMargin: -8
+ anchors.horizontalCenterOffset: 2
+ }
+ ParticleSystem {
+ id: ps
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: turb.enabled = !turb.enabled
+ }
+
+ Turbulence {
+ id: turb
+ system: ps
+ enabled: true
+ height: (parent.height / 2)
+ width: parent.width / 2
+ x: parent. width / 4
+ anchors.fill: parent
+ strength: 32
+ }
+
+ ImageParticle {
+ groups: ["smoke"]
+ system: ps
+ source: "../images/particle.png"
+ color: "#11111111"
+ colorVariation: 0
+ }
+ ImageParticle {
+ groups: ["flame"]
+ system: ps
+ source: "../images/particle.png"
+ color: "#11ff400f"
+ colorVariation: 0.1
+ }
+ Emitter {
+ anchors.centerIn: parent
+ system: ps
+ group: "flame"
+
+ emitRate: 120
+ lifeSpan: 1200
+ size: 20
+ endSize: 10
+ sizeVariation: 10
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke1
+ width: root.width
+ height: root.height/2 - 20
+ system: ps
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 1
+ lifeSpan: 2400
+ lifeSpanVariation: 400
+ size: 16
+ endSize: 8
+ sizeVariation: 8
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke2
+ width: root.width
+ height: root.height/2 - 40
+ system: ps
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 4
+ lifeSpan: 2400
+ size: 36
+ endSize: 24
+ sizeVariation: 12
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+}
diff --git a/examples/particles/affectors/wander.qml b/examples/particles/affectors/wander.qml
new file mode 100644
index 0000000000..31a0b4a796
--- /dev/null
+++ b/examples/particles/affectors/wander.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "../exampleslauncher/content" as UI
+
+Rectangle {
+ width: 360
+ height: 540
+ ParticleSystem { id: particles }
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "../images/snowflake.png"
+ frames: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ Wander {
+ id: wanderer
+ system: particles
+ anchors.fill: parent
+ xVariance: 360/(wanderer.affectedParameter+1);
+ pace: 100*(wanderer.affectedParameter+1);
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 7000
+ speed: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 20
+ sizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+ Row {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ UI.Button {
+ text:"dx/dt"
+ onClicked: wanderer.affectedParameter = Wander.Position;
+ }
+ UI.Button {
+ text:"dv/dt"
+ onClicked: wanderer.affectedParameter = Wander.Velocity;
+ }
+ UI.Button {
+ text:"da/dt"
+ onClicked: wanderer.affectedParameter = Wander.Acceleration;
+ }
+ }
+}