aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/particles
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/particles')
-rw-r--r--examples/qml/particles/affectors/age.qml97
-rw-r--r--examples/qml/particles/affectors/attractor.qml213
-rw-r--r--examples/qml/particles/affectors/customaffector.qml173
-rw-r--r--examples/qml/particles/affectors/friction.qml109
-rw-r--r--examples/qml/particles/affectors/gravity.qml103
-rw-r--r--examples/qml/particles/affectors/groupgoal.qml193
-rw-r--r--examples/qml/particles/affectors/move.qml141
-rw-r--r--examples/qml/particles/affectors/spritegoal.qml212
-rw-r--r--examples/qml/particles/affectors/turbulence.qml135
-rw-r--r--examples/qml/particles/affectors/wander.qml95
-rw-r--r--examples/qml/particles/customparticle/blurparticles.qml140
-rw-r--r--examples/qml/particles/customparticle/fragmentshader.qml115
-rw-r--r--examples/qml/particles/customparticle/imagecolors.qml118
-rw-r--r--examples/qml/particles/emitters/burstandpulse.qml84
-rw-r--r--examples/qml/particles/emitters/customemitter.qml92
-rw-r--r--examples/qml/particles/emitters/emitmask.qml72
-rw-r--r--examples/qml/particles/emitters/maximumemitted.qml81
-rw-r--r--examples/qml/particles/emitters/shapeanddirection.qml112
-rw-r--r--examples/qml/particles/emitters/timedgroupchanges.qml121
-rw-r--r--examples/qml/particles/emitters/trailemitter.qml175
-rw-r--r--examples/qml/particles/emitters/velocityfrommotion.qml311
-rw-r--r--examples/qml/particles/exampleslauncher/content/Button.qml73
-rw-r--r--examples/qml/particles/exampleslauncher/content/Shell.qml78
-rw-r--r--examples/qml/particles/exampleslauncher/content/launcher.js8
-rw-r--r--examples/qml/particles/exampleslauncher/exampleslauncher.qml116
-rw-r--r--examples/qml/particles/imageparticle/allatonce.qml98
-rw-r--r--examples/qml/particles/imageparticle/colored.qml86
-rw-r--r--examples/qml/particles/imageparticle/colortable.qml84
-rw-r--r--examples/qml/particles/imageparticle/deformation.qml121
-rw-r--r--examples/qml/particles/imageparticle/rotation.qml71
-rw-r--r--examples/qml/particles/imageparticle/sharing.qml199
-rw-r--r--examples/qml/particles/imageparticle/sprites.qml116
-rw-r--r--examples/qml/particles/images/_explo.pngbin0 -> 81528 bytes
-rwxr-xr-xexamples/qml/particles/images/backgroundLeaves.jpgbin0 -> 78665 bytes
-rw-r--r--examples/qml/particles/images/bear_tiles.pngbin0 -> 40349 bytes
-rw-r--r--examples/qml/particles/images/candle.pngbin0 -> 1348 bytes
-rw-r--r--examples/qml/particles/images/colortable.pngbin0 -> 704 bytes
-rw-r--r--examples/qml/particles/images/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/qml/particles/images/flower.pngbin0 -> 4683 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/allatonce.pngbin0 -> 7075 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/attractor.pngbin0 -> 31296 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/blurparticles.pngbin0 -> 19109 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/close.pngbin0 -> 2144 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/colortable.pngbin0 -> 6538 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/customaffector.pngbin0 -> 10350 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/customemitter.pngbin0 -> 22967 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/deformation.pngbin0 -> 2870 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/delegates.pngbin0 -> 1892 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/dynamicemitters.pngbin0 -> 9347 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/emitmask.pngbin0 -> 45055 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/flickr.pngbin0 -> 10542 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/fragmentshader.pngbin0 -> 22294 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/gridsplosion.pngbin0 -> 8154 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/groupgoal.pngbin0 -> 7173 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/imagecolors.pngbin0 -> 56647 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/list.pngbin0 -> 32912 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/maximumemitted.pngbin0 -> 1019 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/multiplepainters.pngbin0 -> 8572 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/package.pngbin0 -> 3163 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/particleview.pngbin0 -> 26560 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/plasmapatrol.pngbin0 -> 9839 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/remove.pngbin0 -> 2144 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/rotation.pngbin0 -> 20661 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/samegame.pngbin0 -> 8647 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/shapeanddirection.pngbin0 -> 11359 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/spaceexplorer.pngbin0 -> 9152 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/spritegoal.pngbin0 -> 35579 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/sprites.pngbin0 -> 17009 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/spritevariedparticles.pngbin0 -> 2569 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/startstop.pngbin0 -> 13670 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/timedgroupchanges.pngbin0 -> 16139 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/trailemitter.pngbin0 -> 5371 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/trails.pngbin0 -> 23168 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/turbulence.pngbin0 -> 9684 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/velocityfrommotion.pngbin0 -> 36360 bytes
-rw-r--r--examples/qml/particles/images/launcherIcons/wander.pngbin0 -> 5858 bytes
-rw-r--r--examples/qml/particles/images/matchmask.pngbin0 -> 2369 bytes
-rw-r--r--examples/qml/particles/images/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/qml/particles/images/meteor_explo.pngbin0 -> 219946 bytes
-rw-r--r--examples/qml/particles/images/meteors.pngbin0 -> 132137 bytes
-rw-r--r--examples/qml/particles/images/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/qml/particles/images/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/qml/particles/images/particle2.pngbin0 -> 3909 bytes
-rw-r--r--examples/qml/particles/images/particle3.pngbin0 -> 3186 bytes
-rw-r--r--examples/qml/particles/images/particle4.pngbin0 -> 1799 bytes
-rw-r--r--examples/qml/particles/images/particleA.pngbin0 -> 3541 bytes
-rw-r--r--examples/qml/particles/images/portal_bg.pngbin0 -> 96858 bytes
-rw-r--r--examples/qml/particles/images/realLeaf1.pngbin0 -> 15625 bytes
-rw-r--r--examples/qml/particles/images/realLeaf2.pngbin0 -> 13660 bytes
-rw-r--r--examples/qml/particles/images/realLeaf3.pngbin0 -> 23809 bytes
-rw-r--r--examples/qml/particles/images/realLeaf4.pngbin0 -> 23655 bytes
-rw-r--r--examples/qml/particles/images/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/qml/particles/images/rocket2.pngbin0 -> 1918 bytes
-rw-r--r--examples/qml/particles/images/sizeInOut.pngbin0 -> 251 bytes
-rw-r--r--examples/qml/particles/images/snowflake.pngbin0 -> 189327 bytes
-rw-r--r--examples/qml/particles/images/sparkleSize.pngbin0 -> 378 bytes
-rw-r--r--examples/qml/particles/images/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/qml/particles/images/starfish_0.pngbin0 -> 15972 bytes
-rw-r--r--examples/qml/particles/images/starfish_1.pngbin0 -> 15746 bytes
-rw-r--r--examples/qml/particles/images/starfish_2.pngbin0 -> 16067 bytes
-rw-r--r--examples/qml/particles/images/starfish_3.pngbin0 -> 16201 bytes
-rw-r--r--examples/qml/particles/images/starfish_4.pngbin0 -> 14698 bytes
-rw-r--r--examples/qml/particles/images/starfish_mask.pngbin0 -> 11301 bytes
-rw-r--r--examples/qml/particles/itemparticle/content/Delegate.qml88
-rw-r--r--examples/qml/particles/itemparticle/content/Delegate2.qml79
-rw-r--r--examples/qml/particles/itemparticle/content/ExpandingDelegate.qml204
-rw-r--r--examples/qml/particles/itemparticle/content/RssModel.qml56
-rw-r--r--examples/qml/particles/itemparticle/content/bubble.pngbin0 -> 3413 bytes
-rw-r--r--examples/qml/particles/itemparticle/content/script.js27
-rw-r--r--examples/qml/particles/itemparticle/delegates.qml91
-rw-r--r--examples/qml/particles/itemparticle/particleview.qml274
-rw-r--r--examples/qml/particles/plasmapatrol/PlasmaPatrol.qmlproject19
-rw-r--r--examples/qml/particles/plasmapatrol/TODO10
-rw-r--r--examples/qml/particles/plasmapatrol/content/BlasterHardpoint.qml133
-rw-r--r--examples/qml/particles/plasmapatrol/content/Button.qml66
-rw-r--r--examples/qml/particles/plasmapatrol/content/CannonHardpoint.qml97
-rw-r--r--examples/qml/particles/plasmapatrol/content/ChoiceBox.qml105
-rw-r--r--examples/qml/particles/plasmapatrol/content/Cruiser.qml146
-rw-r--r--examples/qml/particles/plasmapatrol/content/Frigate.qml114
-rw-r--r--examples/qml/particles/plasmapatrol/content/Hardpoint.qml114
-rw-r--r--examples/qml/particles/plasmapatrol/content/HelpScreens.qml268
-rw-r--r--examples/qml/particles/plasmapatrol/content/LaserHardpoint.qml108
-rw-r--r--examples/qml/particles/plasmapatrol/content/PlasmaPatrolParticles.qml173
-rw-r--r--examples/qml/particles/plasmapatrol/content/SequentialLoader.qml54
-rw-r--r--examples/qml/particles/plasmapatrol/content/Ship.qml114
-rw-r--r--examples/qml/particles/plasmapatrol/content/Sloop.qml108
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/TitleText.pngbin0 -> 1109 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/blur-circle2.pngbin0 -> 3627 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/blur-circle3.pngbin0 -> 5148 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/meteor_explo.pngbin0 -> 81528 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/star2.pngbin0 -> 6507 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/content/pics/star3.pngbin0 -> 4602 bytes
-rw-r--r--examples/qml/particles/plasmapatrol/plasmapatrol.qml386
-rw-r--r--examples/qml/particles/simple/dynamiccomparison.qml126
-rw-r--r--examples/qml/particles/simple/dynamicemitters.qml122
-rw-r--r--examples/qml/particles/simple/multiplepainters.qml90
-rw-r--r--examples/qml/particles/simple/startstop.qml81
142 files changed, 7195 insertions, 0 deletions
diff --git a/examples/qml/particles/affectors/age.qml b/examples/qml/particles/affectors/age.qml
new file mode 100644
index 0000000000..1e7774b63b
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/attractor.qml b/examples/qml/particles/affectors/attractor.qml
new file mode 100644
index 0000000000..460a497a92
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/customaffector.qml b/examples/qml/particles/affectors/customaffector.qml
new file mode 100644
index 0000000000..3f98cd5b43
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/friction.qml b/examples/qml/particles/affectors/friction.qml
new file mode 100644
index 0000000000..4161fd9f02
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/gravity.qml b/examples/qml/particles/affectors/gravity.qml
new file mode 100644
index 0000000000..b90d83e1c8
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/groupgoal.qml b/examples/qml/particles/affectors/groupgoal.qml
new file mode 100644
index 0000000000..273ec1a30c
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/move.qml b/examples/qml/particles/affectors/move.qml
new file mode 100644
index 0000000000..f290173ca8
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/spritegoal.qml b/examples/qml/particles/affectors/spritegoal.qml
new file mode 100644
index 0000000000..1ea61442aa
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/turbulence.qml b/examples/qml/particles/affectors/turbulence.qml
new file mode 100644
index 0000000000..f3ad13431f
--- /dev/null
+++ b/examples/qml/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/qml/particles/affectors/wander.qml b/examples/qml/particles/affectors/wander.qml
new file mode 100644
index 0000000000..31a0b4a796
--- /dev/null
+++ b/examples/qml/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;
+ }
+ }
+}
diff --git a/examples/qml/particles/customparticle/blurparticles.qml b/examples/qml/particles/customparticle/blurparticles.qml
new file mode 100644
index 0000000000..3d72425655
--- /dev/null
+++ b/examples/qml/particles/customparticle/blurparticles.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 {
+ color: "white"
+ width: 240
+ height: 360
+ ParticleSystem {
+ id: sys
+ }
+ Emitter {
+ system:sys
+ height: parent.height
+ emitRate: 1
+ lifeSpan: 12000
+ speed: PointDirection {x:20;}
+ size: 128
+ }
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ hideSource: true
+ }
+ Image {
+ id: theItem
+ source: "../images/starfish_1.png"
+ }
+
+ CustomParticle {
+ system: sys
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying lowp float fBlur;
+
+ void main() {
+ defaultMain();
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fBlur = max(0.2 * t, t * qt_ParticleR);
+ }
+ "
+ property variant source: theSource
+ property variant blurred: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform sampler2D blurred;
+ varying highp vec2 qt_TexCoord0;
+ varying highp float fBlur;
+ varying highp float fFade;
+ void main() {
+ gl_FragColor = mix(texture2D(source, qt_TexCoord0), texture2D(blurred, qt_TexCoord0), min(1.0,fBlur*3.0)) * fFade;
+ }"
+
+ }
+}
+
diff --git a/examples/qml/particles/customparticle/fragmentshader.qml b/examples/qml/particles/customparticle/fragmentshader.qml
new file mode 100644
index 0000000000..34acb1bd7c
--- /dev/null
+++ b/examples/qml/particles/customparticle/fragmentshader.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** 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
+
+ParticleSystem {
+ id: root
+ width: 1024
+ height: 768
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 36
+ color: "white"
+ text: "It's all in the fragment shader."
+ }
+ }
+
+ Emitter {
+ emitRate: 400
+ lifeSpan: 8000
+ size: 24
+ sizeVariation: 16
+ speed: PointDirection {x: root.width/10; y: root.height/10;}
+ //acceleration: AngledDirection {angle:225; magnitude: root.width/36; angleVariation: 45; magnitudeVariation: 80}
+ acceleration: PointDirection {x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20}
+ }
+
+ CustomParticle {
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying highp vec2 fPos;
+
+ void main() {
+ qt_TexCoord0 = qt_ParticleTex;
+ highp float size = qt_ParticleData.z;
+ highp float endSize = qt_ParticleData.w;
+
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = qt_ParticlePos
+ - currentSize / 2. + currentSize * qt_ParticleTex // adjust size
+ + qt_ParticleVec.xy * t * qt_ParticleData.y // apply speed vector..
+ + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.);
+
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 20., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fPos = vec2(pos.x/1024., pos.y/768.);
+ }
+ "
+ fragmentShader: "
+ varying highp vec2 fPos;
+ varying lowp float fFade;
+ varying highp vec2 qt_TexCoord0;
+ void main() {//*2 because this generates dark colors mostly
+ highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0);
+ highp float dist = length(circlePos);
+ highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0);
+ gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade;
+ }"
+
+ }
+}
diff --git a/examples/qml/particles/customparticle/imagecolors.qml b/examples/qml/particles/customparticle/imagecolors.qml
new file mode 100644
index 0000000000..94e5123a0c
--- /dev/null
+++ b/examples/qml/particles/customparticle/imagecolors.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** 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: 400
+ height: 400
+ Rectangle {
+ id: root
+ color: "white"
+ width: 310
+ height: 300
+ anchors.centerIn: parent
+ ParticleSystem { id: sys }
+ CustomParticle {
+ system: sys
+ property real maxWidth: root.width
+ property real maxHeight: root.height
+ ShaderEffectSource {
+ id: pictureSource
+ sourceItem: picture
+ hideSource: true
+ }
+ Image {
+ id: picture
+ source: "../images/starfish_3.png"
+ }
+ ShaderEffectSource {
+ id: particleSource
+ sourceItem: particle
+ hideSource: true
+ }
+ Image {
+ id: particle
+ source: "../images/particle4.png"
+ }
+ vertexShader:"
+ uniform highp float maxWidth;
+ uniform highp float maxHeight;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ uniform lowp float qt_Opacity;
+
+ void main() {
+ fTex2 = vec2(qt_ParticlePos.x / maxWidth, qt_ParticlePos.y / maxHeight);
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity;
+ defaultMain();
+ }
+ "
+ property variant particleTexture: particleSource
+ property variant pictureTexture: pictureSource
+ fragmentShader: "
+ uniform sampler2D particleTexture;
+ uniform sampler2D pictureTexture;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ void main() {
+ gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade;
+ }"
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ enabled: false
+ lifeSpan: 8000
+ maximumEmitted: 4000
+ anchors.fill: parent
+ size: 16
+ acceleration: PointDirection { xVariation: 12; yVariation: 12 }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(4000);
+ }
+ }
+}
diff --git a/examples/qml/particles/emitters/burstandpulse.qml b/examples/qml/particles/emitters/burstandpulse.qml
new file mode 100644
index 0000000000..1b1c2a60c9
--- /dev/null
+++ b/examples/qml/particles/emitters/burstandpulse.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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"
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.LeftButton)
+ emitter.burst(1000);
+ else
+ emitter.pulse(500);
+ }
+ }
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/star.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ id: emitter
+ x: ma.mouseX
+ y: ma.mouseY
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ enabled: false
+ speed: AngleDirection{magnitude: 64; angleVariation: 360}
+ size: 24
+ sizeVariation: 8
+ }
+}
diff --git a/examples/qml/particles/emitters/customemitter.qml b/examples/qml/particles/emitters/customemitter.qml
new file mode 100644
index 0000000000..757c836106
--- /dev/null
+++ b/examples/qml/particles/emitters/customemitter.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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
+
+ParticleSystem {
+ id: sys
+ width: 360
+ height: 600
+ running: true
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ }
+
+ property real petalLength: 180
+ property real petalRotation: 0
+ NumberAnimation on petalRotation {
+ from: 0;
+ to: 360;
+ loops: -1;
+ running: true
+ duration: 24000
+ }
+
+ function convert(a) {return a*(Math.PI/180);}
+ Emitter {
+ lifeSpan: 4000
+ emitRate: 120
+ size: 12
+ anchors.centerIn: parent
+ onEmitParticles: {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
+ var theta = Math.floor(Math.random() * 6.0) / 6.0;
+ theta *= 2.0*Math.PI;
+ theta += sys.convert(sys.petalRotation);
+ particle.initialVX = petalLength * Math.cos(theta);
+ particle.initialVY = petalLength * Math.sin(theta);
+ particle.initialAX = particle.initialVX * -0.5;
+ particle.initialAY = particle.initialVY * -0.5;
+ }
+ }
+ }
+
+ ImageParticle {
+ source: "../images/particle4.png"
+ alpha: 0.0
+ redVariation: 0.6
+ color: "white"
+ }
+}
diff --git a/examples/qml/particles/emitters/emitmask.qml b/examples/qml/particles/emitters/emitmask.qml
new file mode 100644
index 0000000000..9c02f6a213
--- /dev/null
+++ b/examples/qml/particles/emitters/emitmask.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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 {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {
+ width: 300
+ height: 300
+ anchors.centerIn: parent
+
+ ImageParticle {
+ source: "../images/particle.png"
+ z: 2
+ anchors.fill: parent
+ color: "#336666CC"
+ colorVariation: 0.0
+ }
+
+ Emitter {
+ anchors.fill: parent
+ emitRate: 6000
+ lifeSpan: 720
+ size: 10
+ shape: MaskShape {
+ source: "../images/starfish_mask.png"
+ }
+ }
+
+ }
+}
diff --git a/examples/qml/particles/emitters/maximumemitted.qml b/examples/qml/particles/emitters/maximumemitted.qml
new file mode 100644
index 0000000000..6dbdf8db61
--- /dev/null
+++ b/examples/qml/particles/emitters/maximumemitted.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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 {
+ color: "black"
+ width: 360
+ height: 540
+ ParticleSystem {
+ id: sys
+ onEmptyChanged: if (empty) sys.pause();
+ }
+
+ ImageParticle {
+ system: sys
+ id: cp
+ source: "../images/particle.png"
+ colorVariation: 0.4
+ color: "#000000FF"
+ }
+
+ Emitter {
+ //burst on click
+ id: bursty
+ system: sys
+ enabled: ma.pressed
+ x: ma.mouseX
+ y: ma.mouseY
+ emitRate: 16000
+ maximumEmitted: 4000
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 360; }
+ size: 8
+ endSize: 16
+ sizeVariation: 4
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: sys.resume()
+ id: ma
+ }
+}
diff --git a/examples/qml/particles/emitters/shapeanddirection.qml b/examples/qml/particles/emitters/shapeanddirection.qml
new file mode 100644
index 0000000000..43623427b6
--- /dev/null
+++ b/examples/qml/particles/emitters/shapeanddirection.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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"
+ Image {
+ anchors.fill: parent
+ source: "../images/portal_bg.png"
+ }
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ groups: ["center","edge"]
+ anchors.fill: parent
+ system: particles
+ source: "../images/particle.png"
+ colorVariation: 0.1
+ color: "#009999FF"
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "center"
+ system: particles
+ emitRate: 400
+ lifeSpan: 2000
+ size: 20
+ sizeVariation: 2
+ endSize: 0
+ shape: EllipseShape {fill: false}
+ speed: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.5
+ }
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "edge"
+ startTime: 2000
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 28
+ sizeVariation: 2
+ endSize: 16
+ shape: EllipseShape {fill: false}
+ speed: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ acceleration: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ targetVariation: 200
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ }
+}
diff --git a/examples/qml/particles/emitters/timedgroupchanges.qml b/examples/qml/particles/emitters/timedgroupchanges.qml
new file mode 100644
index 0000000000..699e7eb066
--- /dev/null
+++ b/examples/qml/particles/emitters/timedgroupchanges.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ id: syssy
+ ParticleGroup {
+ name: "fire"
+ duration: 2000
+ durationVariation: 2000
+ to: {"splode":1}
+ }
+ ParticleGroup {
+ name: "splode"
+ duration: 400
+ to: {"dead":1}
+ TrailEmitter {
+ group: "works"
+ emitRatePerParticle: 100
+ lifeSpan: 1000
+ maximumEmitted: 1200
+ size: 8
+ speed: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;}
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+ }
+ ParticleGroup {
+ name: "dead"
+ duration: 1000
+ Affector {
+ once: true
+ onAffected: worksEmitter.burst(400,x,y)
+ }
+ }
+
+ Timer {
+ interval: 6000
+ running: true
+ triggeredOnStart: true
+ repeat: true
+ onTriggered:startingEmitter.pulse(100);
+ }
+ Emitter {
+ id: startingEmitter
+ group: "fire"
+ width: parent.width
+ y: parent.height
+ enabled: false
+ emitRate: 80
+ lifeSpan: 6000
+ speed: PointDirection {y:-100;}
+ size: 32
+ }
+
+ Emitter {
+ id: worksEmitter
+ group: "works"
+ enabled: false
+ emitRate: 100
+ lifeSpan: 1600
+ maximumEmitted: 6400
+ size: 8
+ speed: CumulativeDirection {
+ PointDirection {y:-100}
+ AngleDirection {angleVariation: 360; magnitudeVariation: 80;}
+ }
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+
+ ImageParticle {
+ groups: ["works", "fire", "splode"]
+ source: "../images/particle.png"
+ entryEffect: ImageParticle.Scale
+ }
+ }
+}
+
diff --git a/examples/qml/particles/emitters/trailemitter.qml b/examples/qml/particles/emitters/trailemitter.qml
new file mode 100644
index 0000000000..e896329ca1
--- /dev/null
+++ b/examples/qml/particles/emitters/trailemitter.qml
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** 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"
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ id: smoke
+ system: particles
+ anchors.fill: parent
+ groups: ["A", "B"]
+ source: "../images/particle.png"
+ colorVariation: 0
+ color: "#00111111"
+ }
+ ImageParticle {
+ id: flame
+ anchors.fill: parent
+ system: particles
+ groups: ["C", "D"]
+ source: "../images/particle.png"
+ colorVariation: 0.1
+ color: "#00ff400f"
+ }
+
+ Emitter {
+ id: fire
+ system: particles
+ group: "C"
+
+ y: parent.height
+ width: parent.width
+
+ emitRate: 350
+ lifeSpan: 3500
+
+ acceleration: PointDirection { y: -17; xVariation: 3 }
+ speed: PointDirection {xVariation: 3}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireSmoke
+ group: "B"
+ system: particles
+ follow: "C"
+ width: root.width
+ height: root.height - 68
+
+ emitRatePerParticle: 1
+ lifeSpan: 2000
+
+ speed: PointDirection {y:-17*6; yVariation: -17; xVariation: 3}
+ acceleration: PointDirection {xVariation: 3}
+
+ size: 36
+ sizeVariation: 8
+ endSize: 16
+ }
+
+ TrailEmitter {
+ id: fireballFlame
+ anchors.fill: parent
+ system: particles
+ group: "D"
+ follow: "E"
+
+ emitRatePerParticle: 120
+ lifeSpan: 180
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
+
+ size: 16
+ sizeVariation: 4
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireballSmoke
+ anchors.fill: parent
+ system: particles
+ group: "A"
+ follow: "E"
+
+ emitRatePerParticle: 128
+ lifeSpan: 2400
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
+
+ speed: PointDirection {yVariation: 16; xVariation: 16}
+ acceleration: PointDirection {y: -16}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+
+ Emitter {
+ id: balls
+ system: particles
+ group: "E"
+
+ y: parent.height
+ width: parent.width
+
+ emitRate: 2
+ lifeSpan: 7000
+
+ speed: PointDirection {y:-17*4*2; xVariation: 6*6}
+ acceleration: PointDirection {y: 17*2; xVariation: 6*6}
+
+ size: 8
+ sizeVariation: 4
+ }
+
+ Turbulence { //A bit of turbulence makes the smoke look better
+ anchors.fill: parent
+ groups: ["A","B"]
+ strength: 32
+ system: particles
+ }
+}
+
diff --git a/examples/qml/particles/emitters/velocityfrommotion.qml b/examples/qml/particles/emitters/velocityfrommotion.qml
new file mode 100644
index 0000000000..7ad2b4d6c4
--- /dev/null
+++ b/examples/qml/particles/emitters/velocityfrommotion.qml
@@ -0,0 +1,311 @@
+/****************************************************************************
+**
+** 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
+
+ height: 540
+ width: 360
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#000020" }
+ GradientStop { position: 1; color: "#000000" }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: root
+ }
+
+ ParticleSystem { id: sys1 }
+ ImageParticle {
+ system: sys1
+ source: "../images/particle.png"
+ color: "cyan"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "cyan"
+ to: "magenta"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "magenta"
+ to: "blue"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "blue"
+ to: "violet"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "violet"
+ to: "cyan"
+ duration: 2000
+ }
+ }
+ colorVariation: 0.3
+ }
+ Emitter {
+ id: trailsNormal
+ system: sys1
+
+ emitRate: 500
+ lifeSpan: 2000
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ size: 8
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys2 }
+ ImageParticle {
+ color: "cyan"
+ system: sys2
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "magenta"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "magenta"
+ duration: 2000
+ }
+ }
+ colorVariation: 0.5
+ source: "../images/star.png"
+ }
+ Emitter {
+ id: trailsStars
+ system: sys2
+
+ emitRate: 100
+ lifeSpan: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ size: 22
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys3; }
+ ImageParticle {
+ source: "../images/particle.png"
+ system: sys3
+ color: "orange"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "green"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "green"
+ to: "red"
+ duration: 2000
+ }
+ }
+
+ colorVariation: 0.2
+
+ }
+ Emitter {
+ id: trailsNormal2
+ system: sys3
+
+ emitRate: 300
+ lifeSpan: 2000
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+
+ size: 12
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys4; }
+ ImageParticle {
+ system: sys4
+ source: "../images/star.png"
+ color: "green"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "green"
+ to: "red"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "red"
+ to: "green"
+ duration: 2000
+ }
+ }
+
+ colorVariation: 0.5
+ }
+ Emitter {
+ id: trailsStars2
+ system: sys4
+
+ emitRate: 50
+ lifeSpan: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+ speed: PointDirection {xVariation: 2; yVariation: 2;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+
+ size: 22
+ sizeVariation: 4
+ }
+
+
+
+ color: "white"
+
+ Item {
+ id: circle
+ //anchors.fill: parent
+ property real radius: 0
+ property real dx: root.width / 2
+ property real dy: root.height / 2
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 1000
+ from: 1
+ to: 0
+ loops: 8
+ }
+ NumberAnimation {
+ duration: 1000
+ from: 0
+ to: 1
+ loops: 8
+ }
+
+ }
+
+ SequentialAnimation on radius {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 4000
+ from: 0
+ to: 100
+ }
+ NumberAnimation {
+ duration: 4000
+ from: 100
+ to: 0
+ }
+ }
+ }
+
+ Item {
+ id: circle3
+ property real radius: 100
+ property real dx: root.width / 2
+ property real dy: root.height / 2
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation { from: 0.0; to: 1 ; duration: 10000; }
+ }
+ }
+
+ Item {
+ id: circle2
+ property real radius: 30
+ property real dx: circle3.cx
+ property real dy: circle3.cy
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation { from: 0.0; to: 1 ; duration: 1000; }
+ }
+ }
+
+}
diff --git a/examples/qml/particles/exampleslauncher/content/Button.qml b/examples/qml/particles/exampleslauncher/content/Button.qml
new file mode 100644
index 0000000000..e51a9be003
--- /dev/null
+++ b/examples/qml/particles/exampleslauncher/content/Button.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 20
+ smooth: true
+ property color myCol: "#999999"
+ border { width: 1; color: Qt.darker(myCol) }
+ radius: 8
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return Qt.darker(myCol)
+ else
+ return Qt.lighter(myCol)
+ }
+ }
+ GradientStop { position: 1.0; color: myCol }
+ }
+
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: buttonLabel; text: container.text; anchors.centerIn: container; color: "black"; font.pixelSize: 24
+ }
+}
diff --git a/examples/qml/particles/exampleslauncher/content/Shell.qml b/examples/qml/particles/exampleslauncher/content/Shell.qml
new file mode 100644
index 0000000000..afab77485f
--- /dev/null
+++ b/examples/qml/particles/exampleslauncher/content/Shell.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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
+
+Loader {
+ id: ldr
+ visible: false
+ focus: visible
+ onVisibleChanged: source = ""
+ opacity: visible?1:0
+ Behavior on opacity {NumberAnimation {}}
+
+ function setDemo(str) {
+ visible = true;
+ source = str;
+ }
+ Image {//TODO: Augment with PARTICLES
+ z: 1
+ source: "../../images/launcherIcons/close.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: ldr.visible = false;
+ }
+ }
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color:"black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: ldr.Status == Loader.Error ? "Error :(" : "Loading..."
+ }
+ MouseArea {
+ id: graball
+ anchors.fill: parent
+ onClicked:;
+ }
+ }
+}
diff --git a/examples/qml/particles/exampleslauncher/content/launcher.js b/examples/qml/particles/exampleslauncher/content/launcher.js
new file mode 100644
index 0000000000..a296dbd6a6
--- /dev/null
+++ b/examples/qml/particles/exampleslauncher/content/launcher.js
@@ -0,0 +1,8 @@
+function nameFromPath(path){
+ var ret = path.split('/');
+ return ret[ret.length-1].split('.')[0];
+}
+function iconFromPath(path){
+ var ret = path.split('/');
+ return "../images/launcherIcons/" + ret[ret.length-1].split('.')[0] + ".png";
+}
diff --git a/examples/qml/particles/exampleslauncher/exampleslauncher.qml b/examples/qml/particles/exampleslauncher/exampleslauncher.qml
new file mode 100644
index 0000000000..22914343ba
--- /dev/null
+++ b/examples/qml/particles/exampleslauncher/exampleslauncher.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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 "content/launcher.js" as Util
+import "content"
+
+Rectangle {
+ color: "black"
+ width: 360
+ height: 600
+ Shell {
+ z: 1
+ id: shell
+ anchors.fill: parent
+ }
+
+ VisualDataModel {//TODO: Transitions between modes (and a second mode...)
+ id: vdm
+ model: [
+ "../../affectors/attractor.qml",
+ "../../affectors/customaffector.qml",
+ "../../affectors/groupgoal.qml",
+ "../../affectors/spritegoal.qml",
+ "../../affectors/turbulence.qml",
+ "../../affectors/wander.qml",
+ "../../customparticle/blurparticles.qml",
+ "../../customparticle/fragmentshader.qml",
+ "../../customparticle/imagecolors.qml",
+ "../../emitters/customemitter.qml",
+ "../../emitters/emitmask.qml",
+ "../../emitters/maximumemitted.qml",
+ "../../emitters/shapeanddirection.qml",
+ "../../emitters/timedgroupchanges.qml",
+ "../../emitters/trailemitter.qml",
+ "../../emitters/velocityfrommotion.qml",
+ "../../imageparticle/allatonce.qml",
+ "../../imageparticle/colortable.qml",
+ "../../imageparticle/deformation.qml",
+ "../../imageparticle/rotation.qml",
+ "../../imageparticle/sprites.qml",
+ "../../itemparticle/delegates.qml",
+ "../../itemparticle/particleview.qml",
+ "../../simple/dynamicemitters.qml",
+ "../../simple/multiplepainters.qml",
+ "../../simple/startstop.qml",
+ "../../plasmapatrol/plasmapatrol.qml"
+ ]
+ delegate: Rectangle {
+ color: "white"
+ width: 96
+ height: 96
+ Image {
+ width: 72
+ height: 72
+ anchors.centerIn: parent
+ source: Util.iconFromPath(modelData)
+ }
+ Text {
+ text: Util.nameFromPath(modelData)
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 8
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: shell.setDemo(modelData)
+ }
+ }
+ }
+
+ GridView {
+ anchors.fill: parent
+ cellWidth: 120
+ cellHeight: 120
+ model: vdm
+ }
+}
diff --git a/examples/qml/particles/imageparticle/allatonce.qml b/examples/qml/particles/imageparticle/allatonce.qml
new file mode 100644
index 0000000000..fbc634ec9a
--- /dev/null
+++ b/examples/qml/particles/imageparticle/allatonce.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** 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 {
+ color: "white"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ sprites: [
+ Sprite {
+ name: "bear"
+ source: "../images/bear_tiles.png"
+ frames: 13
+ frameDuration: 120
+ }
+ ]
+ colorVariation: 0.5
+ rotationSpeedVariation: 360
+ system: sys
+ colorTable: "../trails/../images/colortable.png"
+ }
+
+ Friction {
+ factor: 0.1
+ system: sys
+ }
+
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ id: particles
+ emitRate: 200
+ lifeSpan: 6000
+ speed: AngleDirection {angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
+ size: 60
+ endSize: 120
+ }
+
+ Text {
+ x: 16
+ y: 16
+ text: "QML..."
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: 32
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.margins: 16
+ text: "... can you be trusted with the power?"
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: width > 400 ? 32 : 16
+ }
+}
diff --git a/examples/qml/particles/imageparticle/colored.qml b/examples/qml/particles/imageparticle/colored.qml
new file mode 100644
index 0000000000..ac760b6219
--- /dev/null
+++ b/examples/qml/particles/imageparticle/colored.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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: ["stars"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ }
+ Emitter {
+ group: "stars"
+ emitRate: 800
+ lifeSpan: 2400
+ size: 24
+ sizeVariation: 8
+ anchors.fill: parent
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ source: "../images/star.png"
+ alpha: 0
+ alphaVariation: 0.2
+ colorVariation: 1.0
+ }
+
+ Emitter {
+ anchors.centerIn: parent
+ emitRate: 400
+ lifeSpan: 2400
+ size: 48
+ sizeVariation: 8
+ speed: AngleDirection {angleVariation: 180; magnitude: 60}
+ }
+
+ Turbulence {
+ anchors.fill: parent
+ strength: 2
+ }
+ }
+}
diff --git a/examples/qml/particles/imageparticle/colortable.qml b/examples/qml/particles/imageparticle/colortable.qml
new file mode 100644
index 0000000000..623029dae0
--- /dev/null
+++ b/examples/qml/particles/imageparticle/colortable.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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.Particles 2.0
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ colorVariation: 0.5
+ alpha: 0
+
+ source: "../images/particle.png"
+ colorTable: "../images/colortable.png"
+ sizeTable: "../images/colortable.png"
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 500
+ lifeSpan: 2000
+
+ y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3
+ x: root.width / 2 + Math.cos(t) * root.width * 0.3
+ property real t;
+
+ NumberAnimation on t {
+ from: 0; to: Math.PI * 2; duration: 10000; loops: Animation.Infinite
+ }
+
+ speedFromMovement: 20
+
+ speed: PointDirection { xVariation: 5; yVariation: 5;}
+ acceleration: PointDirection { xVariation: 5; yVariation: 5;}
+
+ size: 16
+ //endSize: 8
+ //sizeVariation: 8
+ }
+}
diff --git a/examples/qml/particles/imageparticle/deformation.qml b/examples/qml/particles/imageparticle/deformation.qml
new file mode 100644
index 0000000000..e282927e78
--- /dev/null
+++ b/examples/qml/particles/imageparticle/deformation.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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 {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {id:sys}
+
+ ImageParticle {
+ system: sys
+ groups: ["goingLeft", "goingRight"]
+ source: "../images/starfish_4.png"
+ rotation: 90
+ rotationSpeed: 90
+ autoRotation: true
+ }
+ ImageParticle {
+ system: sys
+ groups: ["goingDown"]
+ source: "../images/starfish_0.png"
+ rotation: 180
+ yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
+ }
+
+ Timer {
+ running: true
+ repeat: false
+ interval: 100
+ onTriggered: emitA.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 4200
+ onTriggered: emitB.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 8400
+ onTriggered: emitC.enabled = true;
+ }
+
+ Emitter {
+ id: emitA
+ x: 0
+ y: 120
+ system: sys
+ enabled: false
+ group: "goingRight"
+ speed: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitB
+ x: 400
+ y: 240
+ system: sys
+ enabled: false
+ group: "goingLeft"
+ speed: PointDirection { x: -100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitC
+ x: 0
+ y: 360
+ system: sys
+ enabled: false
+ group: "goingDown"
+ speed: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+}
diff --git a/examples/qml/particles/imageparticle/rotation.qml b/examples/qml/particles/imageparticle/rotation.qml
new file mode 100644
index 0000000000..3a75c379ed
--- /dev/null
+++ b/examples/qml/particles/imageparticle/rotation.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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 {
+ color: "goldenrod"
+ width: 2000
+ height: 2000
+ ParticleSystem {id: sys}
+ ImageParticle {
+ id: up
+ system: sys
+ source: "../images/starfish_2.png"
+ }
+
+ Emitter {
+ anchors.centerIn: parent
+ system: sys
+ emitRate: 10
+ size: 200
+ lifeSpan: 10000
+ speed: AngleDirection {angleVariation: 360; magnitudeVariation: 100;}
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ up.autoRotation = !up.autoRotation
+ up.rotation = up.autoRotation ? -90 : 0
+ }
+ }
+}
diff --git a/examples/qml/particles/imageparticle/sharing.qml b/examples/qml/particles/imageparticle/sharing.qml
new file mode 100644
index 0000000000..27e08322d9
--- /dev/null
+++ b/examples/qml/particles/imageparticle/sharing.qml
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// This example shows how to create your own highlight delegate for a ListView
+// that uses a SpringAnimation to provide custom movement when the
+// highlight bar is moved between items.
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ property real delegateHeight: 65
+ width: 200; height: 300
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#EEEEFF" }
+ GradientStop { position: 1.0; color: "lightblue" }
+ }
+
+ // Define a delegate component. A component will be
+ // instantiated for each visible item in the list.
+ Component {
+ id: petDelegate
+ Item {
+ id: wrapper
+ width: 200; height: delegateHeight
+ z: 10
+ Column {
+ Text {color: "white"; text: name; font.pixelSize: 18 }
+ Text {color: "white"; text: 'Type: ' + type; font.pixelSize: 14 }
+ Text {color: "white"; text: 'Age: ' + age; font.pixelSize: 14 }
+ }
+ // indent the item if it is the current item
+ states: State {
+ name: "Current"
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 20 }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 200 }
+ }
+ }
+ }
+
+ // Define a highlight with customised movement between items.
+ Component {
+ id: highlightBar
+ Rectangle {
+ z: 0
+ width: 200; height: delegateHeight
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#99FF99" }
+ GradientStop { position: 1.0; color: "#88FF88" }
+ }
+ y: listView.currentItem.y;
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/flower.png"
+ color: "red"
+ clip: true
+ alpha: 1.0
+ }
+ }
+ }
+
+ ListView {
+ id: listView
+ width: 200; height: parent.height
+
+ model: petsModel
+ delegate: petDelegate
+ focus: true
+
+ // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem
+ // to false so the highlight delegate can control how the highlight is moved.
+ highlight: highlightBar
+ highlightFollowsCurrentItem: false
+
+ ParticleSystem { id: particles }
+ Emitter {
+ system: particles
+ anchors.fill: parent
+ emitRate: 1
+ lifeSpan: 10000
+ size: 24
+ sizeVariation: 8
+ speed: AngleDirection { angleVariation: 360; magnitude: 3 }
+ maximumEmitted: 10
+ startTime: 5000
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/flower.png"
+ alpha: 0.1
+ color: "white"
+ rotationVariation: 180
+ z: -1
+ }
+ }
+
+ ListModel {
+ id: petsModel
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+ }
+
+}
diff --git a/examples/qml/particles/imageparticle/sprites.qml b/examples/qml/particles/imageparticle/sprites.qml
new file mode 100644
index 0000000000..0fe4f31ea3
--- /dev/null
+++ b/examples/qml/particles/imageparticle/sprites.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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 {
+ color: "lightsteelblue"
+ width: 800
+ height: 800
+ id: root
+
+ SpriteImage {
+ sprites: Sprite {
+ name: "bear"
+ source: "../images/bear_tiles.png"
+ frames: 13
+ frameDuration: 120
+ }
+ width: 250
+ height: 250
+ x: 20
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ z:4
+ }
+
+ ParticleSystem { id: sys }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ name: "happy"
+ source: "../images/starfish_1.png"
+ frames: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "angry"
+ source: "../images/starfish_0.png"
+ frames: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "silly"
+ source: "../images/starfish_2.png"
+ frames: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "noticedbear": 0}
+ }, Sprite {
+ name: "noticedbear"
+ source: "../images/starfish_3.png"
+ frames: 1
+ frameDuration: 2600
+ }]
+ }
+
+ Emitter {
+ system: sys
+ emitRate: 2
+ lifeSpan: 10000
+ speed: AngleDirection {angle: 90; magnitude: 60; angleVariation: 5}
+ acceleration: PointDirection { y: 10 }
+ size: 160
+ sizeVariation: 40
+ width: parent.width
+ height: 100
+ }
+
+ SpriteGoal {
+ system: sys
+ width: root.width;
+ height: root.height/2;
+ y: root.height/2;
+ goalState:"noticedbear"
+ }
+}
diff --git a/examples/qml/particles/images/_explo.png b/examples/qml/particles/images/_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/qml/particles/images/_explo.png
Binary files differ
diff --git a/examples/qml/particles/images/backgroundLeaves.jpg b/examples/qml/particles/images/backgroundLeaves.jpg
new file mode 100755
index 0000000000..08be16751d
--- /dev/null
+++ b/examples/qml/particles/images/backgroundLeaves.jpg
Binary files differ
diff --git a/examples/qml/particles/images/bear_tiles.png b/examples/qml/particles/images/bear_tiles.png
new file mode 100644
index 0000000000..6bbb2a9b6d
--- /dev/null
+++ b/examples/qml/particles/images/bear_tiles.png
Binary files differ
diff --git a/examples/qml/particles/images/candle.png b/examples/qml/particles/images/candle.png
new file mode 100644
index 0000000000..8fa3193719
--- /dev/null
+++ b/examples/qml/particles/images/candle.png
Binary files differ
diff --git a/examples/qml/particles/images/colortable.png b/examples/qml/particles/images/colortable.png
new file mode 100644
index 0000000000..a62ceeb4a0
--- /dev/null
+++ b/examples/qml/particles/images/colortable.png
Binary files differ
diff --git a/examples/qml/particles/images/finalfrontier.png b/examples/qml/particles/images/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/qml/particles/images/finalfrontier.png
Binary files differ
diff --git a/examples/qml/particles/images/flower.png b/examples/qml/particles/images/flower.png
new file mode 100644
index 0000000000..b5c606210e
--- /dev/null
+++ b/examples/qml/particles/images/flower.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/allatonce.png b/examples/qml/particles/images/launcherIcons/allatonce.png
new file mode 100644
index 0000000000..b61d2d50d8
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/allatonce.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/attractor.png b/examples/qml/particles/images/launcherIcons/attractor.png
new file mode 100644
index 0000000000..4bd8040c3b
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/attractor.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/blurparticles.png b/examples/qml/particles/images/launcherIcons/blurparticles.png
new file mode 100644
index 0000000000..4337f979cb
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/blurparticles.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/close.png b/examples/qml/particles/images/launcherIcons/close.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/close.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/colortable.png b/examples/qml/particles/images/launcherIcons/colortable.png
new file mode 100644
index 0000000000..8841ea30f9
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/colortable.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/customaffector.png b/examples/qml/particles/images/launcherIcons/customaffector.png
new file mode 100644
index 0000000000..d02e7918fa
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/customaffector.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/customemitter.png b/examples/qml/particles/images/launcherIcons/customemitter.png
new file mode 100644
index 0000000000..6d492573d1
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/customemitter.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/deformation.png b/examples/qml/particles/images/launcherIcons/deformation.png
new file mode 100644
index 0000000000..d1b722df01
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/deformation.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/delegates.png b/examples/qml/particles/images/launcherIcons/delegates.png
new file mode 100644
index 0000000000..929414cd0e
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/delegates.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/dynamicemitters.png b/examples/qml/particles/images/launcherIcons/dynamicemitters.png
new file mode 100644
index 0000000000..0cdef9d21e
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/dynamicemitters.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/emitmask.png b/examples/qml/particles/images/launcherIcons/emitmask.png
new file mode 100644
index 0000000000..e943a4adb9
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/emitmask.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/flickr.png b/examples/qml/particles/images/launcherIcons/flickr.png
new file mode 100644
index 0000000000..4de2650280
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/flickr.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/fragmentshader.png b/examples/qml/particles/images/launcherIcons/fragmentshader.png
new file mode 100644
index 0000000000..7c6de498d5
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/fragmentshader.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/gridsplosion.png b/examples/qml/particles/images/launcherIcons/gridsplosion.png
new file mode 100644
index 0000000000..ec75453df6
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/gridsplosion.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/groupgoal.png b/examples/qml/particles/images/launcherIcons/groupgoal.png
new file mode 100644
index 0000000000..69c6f64e54
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/groupgoal.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/imagecolors.png b/examples/qml/particles/images/launcherIcons/imagecolors.png
new file mode 100644
index 0000000000..0ff13a346e
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/imagecolors.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/list.png b/examples/qml/particles/images/launcherIcons/list.png
new file mode 100644
index 0000000000..bc13263cff
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/list.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/maximumemitted.png b/examples/qml/particles/images/launcherIcons/maximumemitted.png
new file mode 100644
index 0000000000..4ef0435991
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/maximumemitted.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/multiplepainters.png b/examples/qml/particles/images/launcherIcons/multiplepainters.png
new file mode 100644
index 0000000000..a28e3c4f02
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/multiplepainters.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/package.png b/examples/qml/particles/images/launcherIcons/package.png
new file mode 100644
index 0000000000..eba8951c26
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/package.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/particleview.png b/examples/qml/particles/images/launcherIcons/particleview.png
new file mode 100644
index 0000000000..a74f9a0340
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/particleview.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/plasmapatrol.png b/examples/qml/particles/images/launcherIcons/plasmapatrol.png
new file mode 100644
index 0000000000..fda852b420
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/plasmapatrol.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/remove.png b/examples/qml/particles/images/launcherIcons/remove.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/remove.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/rotation.png b/examples/qml/particles/images/launcherIcons/rotation.png
new file mode 100644
index 0000000000..6a8dbea236
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/rotation.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/samegame.png b/examples/qml/particles/images/launcherIcons/samegame.png
new file mode 100644
index 0000000000..d00698264b
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/samegame.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/shapeanddirection.png b/examples/qml/particles/images/launcherIcons/shapeanddirection.png
new file mode 100644
index 0000000000..9c1f910d0c
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/shapeanddirection.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/spaceexplorer.png b/examples/qml/particles/images/launcherIcons/spaceexplorer.png
new file mode 100644
index 0000000000..770584a0fa
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/spaceexplorer.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/spritegoal.png b/examples/qml/particles/images/launcherIcons/spritegoal.png
new file mode 100644
index 0000000000..77480c6f09
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/spritegoal.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/sprites.png b/examples/qml/particles/images/launcherIcons/sprites.png
new file mode 100644
index 0000000000..144216ac7c
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/sprites.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/spritevariedparticles.png b/examples/qml/particles/images/launcherIcons/spritevariedparticles.png
new file mode 100644
index 0000000000..495bb6beee
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/spritevariedparticles.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/startstop.png b/examples/qml/particles/images/launcherIcons/startstop.png
new file mode 100644
index 0000000000..0ff53196a6
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/startstop.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/timedgroupchanges.png b/examples/qml/particles/images/launcherIcons/timedgroupchanges.png
new file mode 100644
index 0000000000..ec9f826495
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/timedgroupchanges.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/trailemitter.png b/examples/qml/particles/images/launcherIcons/trailemitter.png
new file mode 100644
index 0000000000..39acf8b40d
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/trailemitter.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/trails.png b/examples/qml/particles/images/launcherIcons/trails.png
new file mode 100644
index 0000000000..0337ebcfd8
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/trails.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/turbulence.png b/examples/qml/particles/images/launcherIcons/turbulence.png
new file mode 100644
index 0000000000..2b9446ea90
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/turbulence.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/velocityfrommotion.png b/examples/qml/particles/images/launcherIcons/velocityfrommotion.png
new file mode 100644
index 0000000000..79baa08293
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/velocityfrommotion.png
Binary files differ
diff --git a/examples/qml/particles/images/launcherIcons/wander.png b/examples/qml/particles/images/launcherIcons/wander.png
new file mode 100644
index 0000000000..d98e14b8ae
--- /dev/null
+++ b/examples/qml/particles/images/launcherIcons/wander.png
Binary files differ
diff --git a/examples/qml/particles/images/matchmask.png b/examples/qml/particles/images/matchmask.png
new file mode 100644
index 0000000000..e575875c55
--- /dev/null
+++ b/examples/qml/particles/images/matchmask.png
Binary files differ
diff --git a/examples/qml/particles/images/meteor.png b/examples/qml/particles/images/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/qml/particles/images/meteor.png
Binary files differ
diff --git a/examples/qml/particles/images/meteor_explo.png b/examples/qml/particles/images/meteor_explo.png
new file mode 100644
index 0000000000..e659bfe2cf
--- /dev/null
+++ b/examples/qml/particles/images/meteor_explo.png
Binary files differ
diff --git a/examples/qml/particles/images/meteors.png b/examples/qml/particles/images/meteors.png
new file mode 100644
index 0000000000..bada8a1407
--- /dev/null
+++ b/examples/qml/particles/images/meteors.png
Binary files differ
diff --git a/examples/qml/particles/images/nullRock.png b/examples/qml/particles/images/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/qml/particles/images/nullRock.png
Binary files differ
diff --git a/examples/qml/particles/images/particle.png b/examples/qml/particles/images/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/qml/particles/images/particle.png
Binary files differ
diff --git a/examples/qml/particles/images/particle2.png b/examples/qml/particles/images/particle2.png
new file mode 100644
index 0000000000..36349c6c6e
--- /dev/null
+++ b/examples/qml/particles/images/particle2.png
Binary files differ
diff --git a/examples/qml/particles/images/particle3.png b/examples/qml/particles/images/particle3.png
new file mode 100644
index 0000000000..905d8f37b8
--- /dev/null
+++ b/examples/qml/particles/images/particle3.png
Binary files differ
diff --git a/examples/qml/particles/images/particle4.png b/examples/qml/particles/images/particle4.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/examples/qml/particles/images/particle4.png
Binary files differ
diff --git a/examples/qml/particles/images/particleA.png b/examples/qml/particles/images/particleA.png
new file mode 100644
index 0000000000..c63acdee1f
--- /dev/null
+++ b/examples/qml/particles/images/particleA.png
Binary files differ
diff --git a/examples/qml/particles/images/portal_bg.png b/examples/qml/particles/images/portal_bg.png
new file mode 100644
index 0000000000..3c59eeabb9
--- /dev/null
+++ b/examples/qml/particles/images/portal_bg.png
Binary files differ
diff --git a/examples/qml/particles/images/realLeaf1.png b/examples/qml/particles/images/realLeaf1.png
new file mode 100644
index 0000000000..6cabf29efd
--- /dev/null
+++ b/examples/qml/particles/images/realLeaf1.png
Binary files differ
diff --git a/examples/qml/particles/images/realLeaf2.png b/examples/qml/particles/images/realLeaf2.png
new file mode 100644
index 0000000000..bfeca861d5
--- /dev/null
+++ b/examples/qml/particles/images/realLeaf2.png
Binary files differ
diff --git a/examples/qml/particles/images/realLeaf3.png b/examples/qml/particles/images/realLeaf3.png
new file mode 100644
index 0000000000..b1071e862b
--- /dev/null
+++ b/examples/qml/particles/images/realLeaf3.png
Binary files differ
diff --git a/examples/qml/particles/images/realLeaf4.png b/examples/qml/particles/images/realLeaf4.png
new file mode 100644
index 0000000000..d61d53d10e
--- /dev/null
+++ b/examples/qml/particles/images/realLeaf4.png
Binary files differ
diff --git a/examples/qml/particles/images/rocket.png b/examples/qml/particles/images/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/qml/particles/images/rocket.png
Binary files differ
diff --git a/examples/qml/particles/images/rocket2.png b/examples/qml/particles/images/rocket2.png
new file mode 100644
index 0000000000..7110f8fdc6
--- /dev/null
+++ b/examples/qml/particles/images/rocket2.png
Binary files differ
diff --git a/examples/qml/particles/images/sizeInOut.png b/examples/qml/particles/images/sizeInOut.png
new file mode 100644
index 0000000000..0a306ea21a
--- /dev/null
+++ b/examples/qml/particles/images/sizeInOut.png
Binary files differ
diff --git a/examples/qml/particles/images/snowflake.png b/examples/qml/particles/images/snowflake.png
new file mode 100644
index 0000000000..490887a82f
--- /dev/null
+++ b/examples/qml/particles/images/snowflake.png
Binary files differ
diff --git a/examples/qml/particles/images/sparkleSize.png b/examples/qml/particles/images/sparkleSize.png
new file mode 100644
index 0000000000..752056541b
--- /dev/null
+++ b/examples/qml/particles/images/sparkleSize.png
Binary files differ
diff --git a/examples/qml/particles/images/star.png b/examples/qml/particles/images/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/qml/particles/images/star.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_0.png b/examples/qml/particles/images/starfish_0.png
new file mode 100644
index 0000000000..8747f0236e
--- /dev/null
+++ b/examples/qml/particles/images/starfish_0.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_1.png b/examples/qml/particles/images/starfish_1.png
new file mode 100644
index 0000000000..1f3f159d5e
--- /dev/null
+++ b/examples/qml/particles/images/starfish_1.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_2.png b/examples/qml/particles/images/starfish_2.png
new file mode 100644
index 0000000000..c6c7e5a676
--- /dev/null
+++ b/examples/qml/particles/images/starfish_2.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_3.png b/examples/qml/particles/images/starfish_3.png
new file mode 100644
index 0000000000..307a89f815
--- /dev/null
+++ b/examples/qml/particles/images/starfish_3.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_4.png b/examples/qml/particles/images/starfish_4.png
new file mode 100644
index 0000000000..d61c26545a
--- /dev/null
+++ b/examples/qml/particles/images/starfish_4.png
Binary files differ
diff --git a/examples/qml/particles/images/starfish_mask.png b/examples/qml/particles/images/starfish_mask.png
new file mode 100644
index 0000000000..2ef74f902b
--- /dev/null
+++ b/examples/qml/particles/images/starfish_mask.png
Binary files differ
diff --git a/examples/qml/particles/itemparticle/content/Delegate.qml b/examples/qml/particles/itemparticle/content/Delegate.qml
new file mode 100644
index 0000000000..97c7840cb4
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/Delegate.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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
+
+//![0]
+Package {
+ Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
+ Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
+
+ Rectangle {
+ id: wrapper
+ width: 200; height: 25
+ color: 'lightsteelblue'
+
+ Text { text: display; anchors.centerIn: parent }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (wrapper.state == 'inList')
+ wrapper.state = 'inGrid';
+ else
+ wrapper.state = 'inList';
+ }
+ }
+
+ state: 'inList'
+ states: [
+ State {
+ name: 'inList'
+ ParentChange { target: wrapper; parent: listDelegate }
+ },
+ State {
+ name: 'inGrid'
+ ParentChange {
+ target: wrapper; parent: gridDelegate
+ x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+}
+//![0]
diff --git a/examples/qml/particles/itemparticle/content/Delegate2.qml b/examples/qml/particles/itemparticle/content/Delegate2.qml
new file mode 100644
index 0000000000..cf60d43dc2
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/Delegate2.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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
+
+//![0]
+Package {
+ Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' }
+ Item { id: particleDelegate; width: w; height: h; Package.name: 'particles'
+
+ Rectangle {
+ id: wrapper
+ width: w; height: h;
+ color: col
+ rotation: Math.random()*360
+ Behavior on rotation {RotationAnimation {}}
+
+ states: State {
+ name: "gridded"
+ when: root.inGrid
+ PropertyChanges {
+ target: wrapper
+ rotation: 0
+ }
+ ParentChange {
+ target: wrapper
+ parent: gridDelegate
+ x:0
+ y:0
+ }
+ }
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+ }
+}
+//![0]
diff --git a/examples/qml/particles/itemparticle/content/ExpandingDelegate.qml b/examples/qml/particles/itemparticle/content/ExpandingDelegate.qml
new file mode 100644
index 0000000000..87f723d3f7
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/ExpandingDelegate.qml
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** 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 "../../../modelviews/listview/content"
+
+// This example illustrates expanding a list item to show a more detailed view.
+
+ // Delegate for the recipes. This delegate has two modes:
+ // 1. List mode (default), which just shows the picture and title of the recipe.
+ // 2. Details mode, which also shows the ingredients and method.
+ Component {
+ id: recipeDelegate
+
+ Item {
+ id: recipe
+
+ // Create a property to contain the visibility of the details.
+ // We can bind multiple element's opacity to this one property,
+ // rather than having a "PropertyChanges" line for each element we
+ // want to fade.
+ property real detailsOpacity : 0
+
+ //this bit changed for aesthetics
+ width: 70
+ height: 70
+ // A simple rounded rectangle for the background
+ Rectangle {
+ id: background
+ x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
+ color: "ivory"
+ border.color: "orange"
+ radius: 5
+ }
+ Image {
+ anchors.fill:parent
+ anchors.margins: -32
+ source: "bubble.png"
+ }
+
+
+ // This mouse region covers the entire delegate.
+ // When clicked it changes mode to 'Details'. If we are already
+ // in Details mode, then no change will happen.
+ MouseArea {
+ anchors.fill: parent
+ onClicked: recipe.state = 'Details';
+ }
+
+ // Lay out the page: picture, title and ingredients at the top, and method at the
+ // bottom. Note that elements that should not be visible in the list
+ // mode have their opacity set to recipe.detailsOpacity.
+ Row {
+ id: topLayout
+ x: 10; y: 10; height: recipeImage.height; width: parent.width
+ spacing: 10
+
+ Image {
+ id: recipeImage
+ width: 50; height: 50
+ source: "../../modelviews/listview/" + picture
+ }
+
+ Column {
+ width: background.width - recipeImage.width - 20; height: recipeImage.height
+ spacing: 5
+
+ Text {
+ text: title
+ font.bold: true; font.pointSize: 16
+ }
+
+ Text {
+ text: "Ingredients"
+ font.pointSize: 12; font.bold: true
+ opacity: recipe.detailsOpacity
+ }
+
+ Text {
+ text: ingredients
+ wrapMode: Text.WordWrap
+ width: parent.width
+ opacity: recipe.detailsOpacity
+ }
+ }
+ }
+
+ Item {
+ id: details
+ x: 10; width: parent.width - 20
+ anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
+ opacity: recipe.detailsOpacity
+
+ Text {
+ id: methodTitle
+ anchors.top: parent.top
+ text: "Method"
+ font.pointSize: 12; font.bold: true
+ }
+
+ Flickable {
+ id: flick
+ width: parent.width
+ anchors { top: methodTitle.bottom; bottom: parent.bottom }
+ contentHeight: methodText.height
+ clip: true
+
+ Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
+ }
+
+ Image {
+ anchors { right: flick.right; top: flick.top }
+ source: "../../modelviews/listview/" + "content/pics/moreUp.png"
+ opacity: flick.atYBeginning ? 0 : 1
+ }
+
+ Image {
+ anchors { right: flick.right; bottom: flick.bottom }
+ source: "../../modelviews/listview/" + "content/pics/moreDown.png"
+ opacity: flick.atYEnd ? 0 : 1
+ }
+ }
+
+ // A button to close the detailed view, i.e. set the state back to default ('').
+ TextButton {
+ y: 10
+ anchors { right: background.right; rightMargin: 10 }
+ opacity: recipe.detailsOpacity
+ text: "Close"
+
+ onClicked: recipe.state = '';
+ }
+
+ states: State {
+ name: "Details"
+
+ PropertyChanges { target: background; color: "white" }
+ PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger
+ PropertyChanges { target: recipe; detailsOpacity: 1; x: 0; opacity: 1 } // Make details visible
+ PropertyChanges { target: recipe; height: root.height; width: root.height; x:0; y:0; z:100} // Fill the entire list area with the detailed view
+
+ // Move the list so that this item is at the top.
+ //PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y }
+
+ // Disallow flicking while we're in detailed view
+ //PropertyChanges { target: recipe.ListView.view; interactive: false }
+ }
+
+ transitions: Transition {
+ //The only strictly necessary particle specific lines
+ to: "Details"
+ reversible: true
+ ScriptAction {script: {
+ if(state == "Details")
+ mp.freeze(index);
+ else
+ mp.unfreeze(index);
+ }
+ }
+ // Make the state changes smooth
+ ParallelAnimation {
+ ColorAnimation { property: "color"; duration: 500 }
+ NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" }
+ }
+ }
+ }
+ }
diff --git a/examples/qml/particles/itemparticle/content/RssModel.qml b/examples/qml/particles/itemparticle/content/RssModel.qml
new file mode 100644
index 0000000000..46027600b3
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/RssModel.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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.XmlListModel 2.0
+
+XmlListModel {
+ property string tags : ""
+
+ function encodeTags(x) { return encodeURIComponent(x.replace(' ',',')); }
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+encodeTags(tags)+"&" : "")
+ query: "/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "content"; query: "content/string()" }
+ XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" }
+}
diff --git a/examples/qml/particles/itemparticle/content/bubble.png b/examples/qml/particles/itemparticle/content/bubble.png
new file mode 100644
index 0000000000..c7f479e9e3
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/bubble.png
Binary files differ
diff --git a/examples/qml/particles/itemparticle/content/script.js b/examples/qml/particles/itemparticle/content/script.js
new file mode 100644
index 0000000000..e8ef93a847
--- /dev/null
+++ b/examples/qml/particles/itemparticle/content/script.js
@@ -0,0 +1,27 @@
+.pragma library
+
+function getWidth(string) {
+ return (string.match(/width=\"([0-9]+)\"/))[1]
+}
+
+function getHeight(string) {
+ return (string.match(/height=\"([0-9]+)\"/))[1]
+}
+
+function getImagePath(string) {
+ var pattern = /src=\"http:\/\/(\S+)\"/
+ return (string.match(pattern))[1]
+}
+
+function calculateScale(width, height, cellSize) {
+ var widthScale = (cellSize * 1.0) / width
+ var heightScale = (cellSize * 1.0) / height
+ var scale = 0
+
+ if (widthScale <= heightScale) {
+ scale = widthScale;
+ } else if (heightScale < widthScale) {
+ scale = heightScale;
+ }
+ return scale;
+}
diff --git a/examples/qml/particles/itemparticle/delegates.qml b/examples/qml/particles/itemparticle/delegates.qml
new file mode 100644
index 0000000000..58734d320a
--- /dev/null
+++ b/examples/qml/particles/itemparticle/delegates.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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"
+
+ function newPithySaying() {
+ switch (Math.floor(Math.random()*16)) {
+ case 0: return "Hello World";
+ case 1: return "G'day Mate";
+ case 2: return "Code Less";
+ case 3: return "Create More";
+ case 4: return "Deploy Everywhere";
+ case 5: return "Qt Meta-object Language";
+ case 6: return "Qt Magic Language";
+ case 7: return "Fluid UIs";
+ case 8: return "Touchable";
+ case 9: return "How's it going?";
+ case 10: return "Do you like text?";
+ case 11: return "Enjoy!";
+ case 12: return "ERROR: Out of pith";
+ case 13: return "Punctuation Failure";
+ case 14: return "I can go faster";
+ case 15: return "I can go slower";
+ default: return "OMGWTFBBQ";
+ }
+ }
+
+ ParticleSystem {
+ anchors.fill: parent
+ id: syssy
+ Emitter {
+ anchors.centerIn: parent
+ emitRate: 1
+ lifeSpan: 4800
+ lifeSpanVariation: 1600
+ speed: AngleDirection {angleVariation: 360; magnitude: 40; magnitudeVariation: 20}
+ }
+ ItemParticle {
+ delegate: Text {
+ text: root.newPithySaying();
+ color: "white"
+ font.pixelSize: 18
+ font.bold: true
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/itemparticle/particleview.qml b/examples/qml/particles/itemparticle/particleview.qml
new file mode 100644
index 0000000000..774539a958
--- /dev/null
+++ b/examples/qml/particles/itemparticle/particleview.qml
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** 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 "content/script.js" as Script
+import "content"
+
+Item {
+ id: root
+ width: 640
+ height: 480
+ Rectangle {
+ anchors.fill: parent
+ color: "black"
+ z: -1
+ }
+ Item {
+ id: loading
+ Behavior on opacity {NumberAnimation {}}
+ anchors.fill: parent
+ Text {
+ anchors.centerIn: parent
+ text: "Loading"
+ color: "white"
+ }
+ }
+ ParticleSystem {
+ id: sys;
+ running: true
+ }
+ Emitter {
+ id: emitter
+ system: sys
+ height: parent.height - 132/2
+ x: -132/2
+ y: 132/2
+ speed: PointDirection { x: 32; xVariation: 8 }
+ emitRate: 0.5
+ lifeSpan: Emitter.InfiniteLife
+ group: "photos"
+ }
+ Age {
+ system: sys
+ x: parent.width + 132/2
+ height: parent.height
+ width: 1000
+ }
+ ImageParticle {
+ system: sys
+ groups: ["fireworks"]
+ source: "../trails/../images/star.png"
+ color: "lightsteelblue"
+ alpha: 0
+ colorVariation: 0
+ z: 1000
+ }
+ ItemParticle {
+ id: mp
+ z: 0
+ system: sys
+ fade: false
+ groups: ["photos"]
+ }
+ Component {
+ id: alertDelegate
+ Rectangle {
+ width: 132
+ height: 132
+ NumberAnimation on scale {
+ running: true
+ loops: 1
+ from: 0.2
+ to: 1
+ }
+ Image {
+ source: "../asteroid/../images/rocket.png"
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "A new ship has arrived!"
+ }
+ }
+ }
+ property Item alertItem;
+ function alert() {
+ //resetter.active = false
+ force.active = true;
+ alertItem = alertDelegate.createObject(root);
+ alertItem.x = root.width/2 - alertItem.width/2
+ alertItem.y = root.height/2 - alertItem.height/2
+ spawnFireworks.pulse(200);
+ stopAlert.start();
+ }
+ focus: true
+ Keys.onSpacePressed: alert();
+ Timer {
+ id: stopAlert
+ running: false
+ repeat: false
+ interval: 800
+ onTriggered: {
+ force.active = false
+ //resetter.active = true;
+ mp.take(alertItem, true);
+ centerEmitter.burst(1);
+ }
+ }
+ Attractor {
+ id: force
+ system: sys
+ pointX: root.width/2
+ pointY: root.height/2
+ strength: -10000
+ enabled: false
+ anchors.centerIn: parent
+ width: parent.width/2
+ height: parent.height/2
+ groups:["photos"]
+ affectedParameter: Attractor.Position
+ }
+ Emitter {
+ id: centerEmitter
+ speed: PointDirection { x: 32; xVariation: 8;}
+ emitRate: 0.5
+ lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
+ maximumEmitted: 20
+ group: "photos"
+ system: sys
+ anchors.centerIn: parent
+ enabled: false
+
+ //TODO: Zoom in effect
+ }
+ Emitter {
+ id: spawnFireworks
+ group: "fireworks"
+ system: sys
+ maximumEmitted: 400
+ emitRate: 400
+ lifeSpan: 2800
+ x: parent.width/2
+ y: parent.height/2 - 64
+ width: 8
+ height: 8
+ enabled: false
+ size: 32
+ endSize: 8
+ speed: AngleDirection { magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
+ acceleration: PointDirection { y: 160 }
+ }
+ Item { x: -1000; y: -1000 //offscreen
+ Repeater {//Load them here, add to system on completed
+ model: theModel
+ delegate: theDelegate
+ }
+ }
+ RssModel {id: theModel; tags:"particle,particles"}
+ Component {
+ id: theDelegate
+ Rectangle {
+ id: container
+ border.width: 2
+ property real myRand: Math.random();//'depth'
+ z: Math.floor(myRand * 100)
+ scale: (myRand + 1.0)/2;
+ //TODO: Darken based on 'depth'
+ width: 132
+ height: 132
+ //ItemParticle.onAttached: console.log("I'm in" + x + "," + y + ":" + opacity);
+ ItemParticle.onDetached: mp.take(container);//respawns
+ function manage()
+ {
+ if (state == "selected") {
+ console.log("Taking " + index);
+ mp.freeze(container);
+ } else {
+ console.log("Returning " +index);
+ mp.unfreeze(container);
+ }
+ }
+ Image {
+ id: img
+ anchors.centerIn: parent
+ smooth: true; source: "http://" + Script.getImagePath(content); cache: true
+ fillMode: Image.PreserveAspectFit;
+ width: parent.width-4; height: parent.height-4
+ onStatusChanged: if (img.status == Image.Ready) {
+ loading.opacity = 0;
+ mp.take(container);
+ }
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: title
+ color: "black"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.state == "selected" ? container.state = "" : container.state = "selected"
+ }
+ states: State {
+ name: "selected"
+ ParentChange {
+ target: container
+ parent: root
+ x: 0
+ y: 0
+ }
+ PropertyChanges {
+ target: container
+ width: root.width
+ height: root.height
+ z: 101
+ opacity: 1
+ rotation: 0
+ }
+ }
+ transitions: Transition {
+ to: "selected"
+ reversible: true
+ SequentialAnimation {
+ ScriptAction {script: container.manage();}
+ ParallelAnimation {
+ ParentAnimation {NumberAnimation { properties: "x,y" }}//Doesn't work, particles takes control of x,y instantly
+ NumberAnimation { properties: "width, height, z, rotation" }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/PlasmaPatrol.qmlproject b/examples/qml/particles/plasmapatrol/PlasmaPatrol.qmlproject
new file mode 100644
index 0000000000..548295243d
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/PlasmaPatrol.qmlproject
@@ -0,0 +1,19 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "plasmapatrol.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ Files {
+ paths: ["TODO"]
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/TODO b/examples/qml/particles/plasmapatrol/TODO
new file mode 100644
index 0000000000..ef9d21a73d
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/TODO
@@ -0,0 +1,10 @@
+Realistic Tasks:
+Particle explosions on ship death.
+Better help text (both content and styled a little nicer).
+Hardpoint help showing them firing across the screen.
+Endless Demo Mode
+
+Nice-but-i-doubt-it-will-get-done Tasks:
+Particle Text for the winner.
+Particle-based buttons.
+Single player mode that is challenges (known opponents) to master the game with and earn achievements (in addition to 'skirmish').
diff --git a/examples/qml/particles/plasmapatrol/content/BlasterHardpoint.qml b/examples/qml/particles/plasmapatrol/content/BlasterHardpoint.qml
new file mode 100644
index 0000000000..10c50d43c8
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/BlasterHardpoint.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property Item targetObj: container
+ property Item hardpoint: container
+ property ParticleSystem system
+ property int blasts: 16
+ property int bonusBlasts: 12
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "blaster"
+ system: container.system
+ enabled: show
+ anchors.fill: parent
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true}
+ lifeSpan: 1000
+ emitRate: 64
+
+ size: 24
+ sizeVariation: 24
+ endSize: 0
+ }
+
+ property int blastsLeft: 0
+ function fireAt(targetArg, container) {
+ target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
+ targetObj = targetArg;
+ hardpoint = container;
+ blastsLeft = blasts;
+ rofTimer.repeat = true;
+ rofTimer.start();
+ }
+ Timer {
+ id: rofTimer
+ interval: 30;//Has to be greater than 1 frame or they stack up
+ running: false
+ repeat: false
+ onTriggered: {
+ if (targetObj.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var hit;
+ if (blastsLeft >= bonusBlasts)
+ hit = Math.random() > targetObj.dodge;
+ else
+ hit = false; //purely aesthetic shots, because the damage isn't that fine grained
+ if (hit == true) {
+ switch (targetObj.shipType) {
+ case 1: hardpoint.damageDealt += 4; break;
+ case 2: hardpoint.damageDealt += 5; break;
+ case 3: hardpoint.damageDealt += 1; break;
+ default: hardpoint.damageDealt += 100;
+ }
+ }
+ blastVector.targetX = target.x;
+ blastVector.targetY = target.y;
+ if (!hit) {//TODO: Actual targetVariation
+ blastVector.targetX += (128 * Math.random() - 64);
+ blastVector.targetY += (128 * Math.random() - 64);
+ }
+ emitter.burst(1);
+ blastsLeft--;
+ if (!blastsLeft)
+ rofTimer.repeat = false;
+ }
+ }
+ Emitter {
+ id: emitter
+ group: "blaster"
+ enabled: false
+ system: container.system
+ anchors.centerIn: parent
+
+ lifeSpan: 1000
+ emitRate: 16
+ maximumEmitted: blasts
+ size: 24
+ endSize:16
+ sizeVariation: 8
+ speed: TargetDirection {
+ id: blastVector
+ targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Button.qml b/examples/qml/particles/plasmapatrol/content/Button.qml
new file mode 100644
index 0000000000..992be295fc
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Button.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+//TODO: Add particles to this component too
+Rectangle {
+ id: container
+ property alias text: txt.text
+ signal clicked
+ //color: "lightsteelblue"
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "steelblue" }
+ }
+ height: 64
+ radius: 16
+ width: 128
+ Text {
+ id: txt
+ anchors.centerIn: parent
+ font.pixelSize: 24
+ color: "white"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.clicked()
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/CannonHardpoint.qml b/examples/qml/particles/plasmapatrol/content/CannonHardpoint.qml
new file mode 100644
index 0000000000..48eb9d171a
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/CannonHardpoint.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 QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "cannon"
+ enabled: container.show
+ system: container.system
+ anchors.centerIn: parent
+ lifeSpan: 2000
+ emitRate: 1
+
+ size: 4
+ endSize: 0
+ }
+
+ function fireAt(targetArg, hardpoint) {
+ target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
+ if (container.hp <= 0 || targetArg.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var hit = Math.random() > targetArg.dodge
+ if (hit) {
+ switch (targetArg.shipType) {
+ case 1: hardpoint.damageDealt += 8; break;
+ case 2: hardpoint.damageDealt += 10; break;
+ case 3: hardpoint.damageDealt += 16; break;
+ default: hardpoint.damageDealt += 1000;
+ }
+ }
+ emitter.burst(1);
+ }
+ Emitter {
+ id: emitter
+ group: "cannon"
+ enabled: false
+ system: container.system
+ anchors.centerIn: parent
+
+ lifeSpan: 1000
+ emitRate: 1
+ size: 8
+ endSize: 4
+ speed: TargetDirection {
+ id: blastVector
+ targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/ChoiceBox.qml b/examples/qml/particles/plasmapatrol/content/ChoiceBox.qml
new file mode 100644
index 0000000000..6e21101f2e
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/ChoiceBox.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ width: 360
+ height: 160
+ property ParticleSystem system
+ Ship {
+ id: nully
+ system: system
+ }
+ property Item target: nully
+ /*
+ Component.onCompleted: {
+ container.target.shipType = 1
+ container.target.gunType = 1
+ }
+ */
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height
+ spacing: 8
+ Button {
+ width: 80
+ height: 80
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Cycle\nShip"
+ onClicked: {
+ var nextVal = container.target.shipType;
+ if(nextVal == 3)
+ nextVal = 1;
+ else
+ nextVal++;
+ container.target.shipType = nextVal;
+ }
+ }
+ Item {
+ width: 128
+ height: 128
+ anchors.verticalCenter: parent.verticalCenter
+ Ship {
+ hp: 20
+ anchors.centerIn: parent
+ shipType: container.target.shipType
+ gunType: container.target.gunType
+ system: container.system
+ }
+ }
+ Button {
+ width: 80
+ height: 80
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Cycle\nGun"
+ onClicked: {
+ var nextVal = container.target.gunType;
+ if(nextVal == 3)
+ nextVal = 1;
+ else
+ nextVal++;
+ container.target.gunType = nextVal;
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Cruiser.qml b/examples/qml/particles/plasmapatrol/content/Cruiser.qml
new file mode 100644
index 0000000000..c469eb46d2
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Cruiser.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.01
+ property real dodge: initialDodge
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ //TODO: Cooler would be an 'orbiting' affector
+ //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
+ system: container.system
+ group: container.shipParticle
+ anchors.centerIn: parent
+ width: 64
+ height: 64
+ shape: EllipseShape {}
+
+ emitRate: hp > 0 ? hp * 1 + 20 : 0
+ lifeSpan: 2400
+ maximumEmitted: (maxHP * 1 + 20)*2.4
+
+ size: 48
+ sizeVariation: 16
+ endSize: 16
+
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 32}
+ }
+ Emitter {
+ system: container.system
+ group: "cruiserArmor"
+ anchors.fill: parent
+ shape: EllipseShape { fill: false }
+ enabled: hp>0
+
+ emitRate: 16
+ lifeSpan: 2000
+
+ size: 48
+ sizeVariation: 24
+
+ SpriteGoal {
+ id: destructor
+ system: container.system
+ enabled: container.hp <=0
+ anchors.fill: parent
+ groups: ["cruiserArmor"]
+ goalState: "death"
+// jump: true
+ once: true
+ }
+ }
+
+ Timer {
+ id: fireControl
+ property int next: Math.floor(Math.random() * 3) + 1
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ if (next == 1) {
+ gun1.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ } else if (next == 2) {
+ gun2.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ } else if (next == 3) {
+ gun3.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ }
+ }
+ }
+
+ Hardpoint {//TODO: Hardpoint abstraction
+ x: 112 - 12 - 8*2
+ y: 128 - 12 - 12*2
+ id: gun1
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 64 - 12
+ y: 0 - 12 + 12*2
+ id: gun2
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 16 - 12 + 8*2
+ y: 128 - 12 - 12*2
+ id: gun3
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Frigate.qml b/examples/qml/particles/plasmapatrol/content/Frigate.qml
new file mode 100644
index 0000000000..92c63b87d1
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Frigate.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.2
+ property real dodge: initialDodge
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ system: container.system
+ group: "frigateShield"
+ anchors.centerIn: parent
+ size: 92
+ emitRate: 1
+ lifeSpan: 4800
+ enabled: hp > 0
+ }
+ Emitter {
+ system: container.system
+ group: container.shipParticle
+ anchors.centerIn: parent
+ width: 64
+ height: 16
+ shape: EllipseShape {}
+
+ size: 16
+ sizeVariation: 8
+ endSize: 8
+ emitRate: hp > 0 ? hp * 1 + 20 : 0
+ lifeSpan: 1200
+ maximumEmitted: (maxHP * 1 + 20)*2
+ }
+ Timer {
+ id: fireControl
+ property int next: Math.floor(Math.random() * 2) + 1
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ if (next == 1) {
+ gun1.fireAt(container.target);
+ next = Math.floor(Math.random() * 2) + 1;
+ } else if (next == 2) {
+ gun2.fireAt(container.target);
+ next = Math.floor(Math.random() * 2) + 1;
+ }
+ }
+ }
+
+ Hardpoint {
+ x: 128 - 32 - 12
+ y: 64 - 12
+ id: gun1
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 0 + 32 - 12
+ y: 64 - 12
+ id: gun2
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Hardpoint.qml b/examples/qml/particles/plasmapatrol/content/Hardpoint.qml
new file mode 100644
index 0000000000..9e6057057d
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Hardpoint.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ //ReflectiveProperties
+ //TransferredProperties
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+ property int hardpointType: 0 //default is pea shooter - always bad.
+
+ property Item targetObj: null
+ property int damageDealt: 0
+ onDamageDealtChanged: dealDamageTimer.start();
+ Timer {
+ id: dealDamageTimer
+ interval: 16
+ running: false
+ repeat: false
+ onTriggered: {targetObj.hp -= damageDealt; damageDealt = 0;}
+ }
+ width: 24
+ height: 24
+ function fireAt(targetArg) {//Each implement own
+ if (targetArg != null) {
+ hardpointLoader.item.fireAt(targetArg, container);
+ targetObj = targetArg;
+ }
+ }
+ Loader {
+ id: hardpointLoader
+ sourceComponent: {
+ switch (hardpointType) {
+ case 1: laserComponent; break;
+ case 2: blasterComponent; break;
+ case 3: cannonComponent; break;
+ default: emptyComponent;
+ }
+ }
+ }
+ Component {
+ id: laserComponent
+ LaserHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: blasterComponent
+ BlasterHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: cannonComponent
+ CannonHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: emptyComponent
+ Item {
+ function fireAt(obj) {
+ console.log("Firing null weapon. It hurts.");
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/HelpScreens.qml b/examples/qml/particles/plasmapatrol/content/HelpScreens.qml
new file mode 100644
index 0000000000..db70c6ee90
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/HelpScreens.qml
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+SequentialLoader {
+ id: hLdr
+ signal exitDesired
+ Component.onCompleted: advance();
+ ParticleSystem { id: helpSystem }
+ PlasmaPatrolParticles { sys: helpSystem }
+ pages: [
+ Component {Item {
+ id: story
+ Text {
+ color: "white"
+ text: "Story"
+ font.pixelSize: 48
+ }
+ /*
+ Flickable {
+ y: 60
+ width: 360
+ height: 500
+ contentHeight: txt1.height
+ contentWidth: 360//TODO: Less magic numbers?
+ */
+ Text {
+ id: txt1
+ color: "white"
+ y: 60
+ font.pixelSize: 18
+ text: "
+In a remote nebula, a race of energy beings formed and lived prosperous lives for millenia. Until the schism - when they became constantly at each other's energy-throats. War soon followed, crippling both sides, until a truce was formed. But while governments knew the desparate need for peace, the soldiers in the ion-field were still filled with rampant bloodlust. On the border, patrols are constantly engaging in minor skirmishes whenever they cross paths.
+
+You must select one such patrol unit for the border, heading into an inevitable skirmish, in Plasma Patrol: the game of energy being spaceship combat!
+ "
+ width: 360
+ wrapMode: Text.WordWrap
+ }
+ // }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: ships
+ Text {
+ color: "white"
+ text: "Vessels"
+ font.pixelSize: 48
+ }
+ Column {
+ spacing: 16
+ y: 60
+ Row {
+ height: 128
+ Sloop {
+ system: helpSystem
+ }
+ Text {
+ text: "The nimble sloop"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ Frigate {
+ system: helpSystem
+ }
+ Text {
+ text: "The versitile shield frigate"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ Cruiser {
+ system: helpSystem
+ }
+ Text {
+ text: "The armored cruiser"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: guns
+ Text {
+ color: "white"
+ text: "Hardpoints"
+ font.pixelSize: 48
+ }
+ Column {
+ spacing: 16
+ y: 60
+ Row {
+ height: 128
+ LaserHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ BlasterHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ CannonHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: strategy
+ Text {
+ color: "white"
+ text: "Strategy"
+ font.pixelSize: 48
+ }
+ Flickable {
+ y: 60
+ width: 360
+ height: 500
+ contentHeight: txt1.height
+ contentWidth: 360//TODO: Less magic numbers?
+ Text {
+ id: txt1
+ color: "white"
+ font.pixelSize: 18
+ text: "
+Basic Strategy: Good luck, have fun - don't die.
+More to come after thorough playtesting.
+ "
+ width: 360
+ wrapMode: Text.WordWrap
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Story"
+ onClicked: {hLdr.at=0; hLdr.advance();}
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }}
+ ]
+}
diff --git a/examples/qml/particles/plasmapatrol/content/LaserHardpoint.qml b/examples/qml/particles/plasmapatrol/content/LaserHardpoint.qml
new file mode 100644
index 0000000000..a7baed604b
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/LaserHardpoint.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "laser"
+ system: container.system
+ anchors.fill: parent
+ enabled: container.show
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true }
+ lifeSpan: 1000
+ emitRate: 64
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+
+ function fireAt(targetArg, hardpoint) {
+ if (targetArg.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var offset = 0;
+ if (Math.random() < 0.99) {
+ switch (targetArg.shipType) {
+ case 1: hardpoint.damageDealt += 16; break;
+ case 2: hardpoint.damageDealt += 4; break;
+ case 3: hardpoint.damageDealt += 8; break;
+ default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels
+ }
+ } else {//Misses with Lasers are really rare
+ offset = Math.random() * 100;
+ }
+ target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2);
+ emitter.pulse(100);
+ // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y)));
+ }
+ Emitter {
+ id: emitter
+ group: "laser"
+ enabled: false
+ system: container.system
+ x: Math.min(container.width/2, target.x);
+ width: Math.max(container.width/2, target.x) - x;
+ y: Math.min(container.height/2, target.y);
+ height: Math.max(container.height/2, target.y) - y;
+ shape: LineShape {
+ mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR
+ }
+
+ lifeSpan: 1000
+ emitRate: 8000
+ maximumEmitted: 800
+ size: 16
+ endSize: 0
+
+ speed: PointDirection {xVariation: 4; yVariation: 4}
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/qml/particles/plasmapatrol/content/PlasmaPatrolParticles.qml
new file mode 100644
index 0000000000..87809965b2
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/PlasmaPatrolParticles.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 QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ property ParticleSystem sys
+ ImageParticle {
+ system: sys
+ groups: ["default"]
+ source: "pics/blur-circle3.png"
+ color: "#003A3A3A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["redTeam"]
+ source: "pics/blur-circle3.png"
+ color: "#0028060A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["greenTeam"]
+ source: "pics/blur-circle3.png"
+ color: "#0006280A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["blaster"]
+ source: "pics/star2.png"
+ //color: "#0F282406"
+ color: "#0F484416"
+ colorVariation: 0.2
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["laser"]
+ source: "pics/star3.png"
+ //color: "#00123F68"
+ color: "#00428FF8"
+ colorVariation: 0.2
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannon"]
+ source: "pics/particle.png"
+ color: "#80FFAAFF"
+ colorVariation: 0.1
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannonCore"]
+ source: "pics/particle.png"
+ color: "#00666666"
+ colorVariation: 0.8
+ z: 1
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannonWake"]
+ source: "pics/star.png"
+ color: "#00CCCCCC"
+ colorVariation: 0.2
+ z: 1
+ }
+ ImageParticle {
+ system: sys
+ groups: ["frigateShield"]
+ source: "pics/blur-circle2.png"
+ color: "#00000000"
+ colorVariation: 0.05
+ blueVariation: 0.5
+ greenVariation: 0.1
+ z: 3
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cruiserArmor"]
+ z: 1
+ sprites:[Sprite {
+ id: spinState
+ name: "spinning"
+ source: "pics/meteor.png"
+ frames: 35
+ frameDuration: 40
+ to: {"death":0, "spinning":1}
+ },Sprite {
+ name: "death"
+ source: "pics/meteor_explo.png"
+ frames: 22
+ frameDuration: 40
+ to: {"null":1}
+ }, Sprite {
+ name: "null"
+ source: "pics/nullRock.png"
+ frames: 1
+ frameDuration: 1000
+ }
+ ]
+ }
+ TrailEmitter {
+ system: sys
+ group: "cannonWake"
+ follow: "cannon"
+ emitRatePerParticle: 64
+ lifeSpan: 600
+ speed: AngleDirection { angleVariation: 360; magnitude: 48}
+ size: 16
+ endSize: 8
+ sizeVariation: 2
+ enabled: true
+ width: 1000//XXX: Terrible hack
+ height: 1000
+ }
+ TrailEmitter {
+ system: sys
+ group: "cannonCore"
+ follow: "cannon"
+ emitRatePerParticle: 256
+ lifeSpan: 128
+ size: 24
+ endSize: 8
+ enabled: true
+ width: 1000//XXX: Terrible hack
+ height: 1000
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/SequentialLoader.qml b/examples/qml/particles/plasmapatrol/content/SequentialLoader.qml
new file mode 100644
index 0000000000..3707759ce3
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/SequentialLoader.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: container
+ //TODO: Somehow get particles into this?
+ property list<Component> pages
+ property Item cur: null
+ property int at: 0
+ function advance() {
+ if(cur != null)
+ cur.destroy();
+ cur = pages[at++].createObject(container);
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Ship.qml b/examples/qml/particles/plasmapatrol/content/Ship.qml
new file mode 100644
index 0000000000..bd023b1dc2
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Ship.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: me
+ //Reflective Properties
+ width: shipLoader.width
+ height: shipLoader.height
+ //Transfered Properties
+ property int hp: 100//shipLoader.item.maxHP
+ property real dodge: shipLoader.item.initialDodge
+ property ParticleSystem system
+ property int targetIdx: 0
+ property Item target: targets[targetIdx] == undefined?null:targets[targetIdx]
+ Connections {
+ target: me.target
+ onHpChanged: if (me.target.hp<=0) me.targetIdx++;
+ }
+ property list<Item> targets
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ property int shipType: 0
+ Component {
+ id: sloopComp
+ Sloop {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: frigateComp
+ Frigate {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: cruiserComp
+ Cruiser {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: dumbComp
+ Item {
+ property int maxHP: 0
+ property int initialDodge: 0
+ }
+ }
+ Loader {
+ id: shipLoader
+ sourceComponent: {
+ switch (shipType) {
+ case 1: sloopComp; break;
+ case 2: frigateComp; break;
+ case 3: cruiserComp; break;
+ default: dumbComp;
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/plasmapatrol/content/Sloop.qml b/examples/qml/particles/plasmapatrol/content/Sloop.qml
new file mode 100644
index 0000000000..3bc58a28b0
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/Sloop.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.5
+ property real dodge: initialDodge
+ property int blinkInterval: 800
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ id: emitter
+ //TODO: Cooler would be an 'orbiting' affector
+ //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
+ system: container.system
+ group: container.shipParticle
+ shape: EllipseShape {}
+
+ emitRate: hp > 0 ? hp + 20 : 0
+ lifeSpan: blinkInterval
+ maximumEmitted: (maxHP + 20)
+
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 8}
+
+ size: 24
+ endSize: 4
+ sizeVariation: 8
+ width: 16
+ height: 16
+ x: 64
+ y: 64
+ Behavior on x {NumberAnimation {duration:blinkInterval}}
+ Behavior on y {NumberAnimation {duration:blinkInterval}}
+ Timer {
+ interval: blinkInterval
+ running: true
+ repeat: true
+ onTriggered: {
+ emitter.x = Math.random() * 48 + 32
+ emitter.y = Math.random() * 48 + 32
+ }
+ }
+ }
+ Hardpoint {
+ anchors.centerIn: parent
+ id: gun2
+ system: container.system
+ show: container.hp > 0
+ hardpointType: gunType
+ }
+ Timer {
+ id: fireControl
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ gun2.fireAt(container.target);
+ }
+ }
+
+}
diff --git a/examples/qml/particles/plasmapatrol/content/pics/TitleText.png b/examples/qml/particles/plasmapatrol/content/pics/TitleText.png
new file mode 100644
index 0000000000..dc3acebe39
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/TitleText.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/blur-circle2.png b/examples/qml/particles/plasmapatrol/content/pics/blur-circle2.png
new file mode 100644
index 0000000000..f7c9f3e98e
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/blur-circle2.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/blur-circle3.png b/examples/qml/particles/plasmapatrol/content/pics/blur-circle3.png
new file mode 100644
index 0000000000..dbc39cb16e
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/blur-circle3.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/finalfrontier.png b/examples/qml/particles/plasmapatrol/content/pics/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/finalfrontier.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/meteor.png b/examples/qml/particles/plasmapatrol/content/pics/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/meteor.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/meteor_explo.png b/examples/qml/particles/plasmapatrol/content/pics/meteor_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/meteor_explo.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/nullRock.png b/examples/qml/particles/plasmapatrol/content/pics/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/nullRock.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/particle.png b/examples/qml/particles/plasmapatrol/content/pics/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/particle.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/star.png b/examples/qml/particles/plasmapatrol/content/pics/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/star.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/star2.png b/examples/qml/particles/plasmapatrol/content/pics/star2.png
new file mode 100644
index 0000000000..bb55c44788
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/star2.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/content/pics/star3.png b/examples/qml/particles/plasmapatrol/content/pics/star3.png
new file mode 100644
index 0000000000..636a25f480
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/content/pics/star3.png
Binary files differ
diff --git a/examples/qml/particles/plasmapatrol/plasmapatrol.qml b/examples/qml/particles/plasmapatrol/plasmapatrol.qml
new file mode 100644
index 0000000000..b14ac6385b
--- /dev/null
+++ b/examples/qml/particles/plasmapatrol/plasmapatrol.qml
@@ -0,0 +1,386 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+
+Rectangle {
+ id: root
+ property bool readySetGo: false
+ //Debugging
+ property int hits: 0
+ property int misses: 0
+ property real ratio: hits/(misses?misses:1)
+ //Move to JS file?
+ property Ship redVar1: Ship {shipType: 1; gunType: 1}
+ property Ship redVar2: Ship {shipType: 1; gunType: 2}
+ property Ship redVar3: Ship {shipType: 1; gunType: 3}
+ property Ship greenVar1: Ship {shipType: 3; gunType: 1}
+ property Ship greenVar2: Ship {shipType: 2; gunType: 2}
+ property Ship greenVar3: Ship {shipType: 1; gunType: 3}
+ property string winner: "0"
+ property int players: 0
+ function aiSet(ship) {
+ ship.gunType = Math.floor(Math.random() * 3) + 1
+ ship.shipType = Math.floor(Math.random() * 3) + 1
+ }
+
+ width: 360
+ height: 600
+ color: "black"
+ SequentialLoader {
+ anchors.fill: parent
+ //General Children
+ Image {
+ anchors.centerIn: parent
+ source: "../images/finalfrontier.png"
+ }
+ ParticleSystem {
+ id: particles
+ }
+ PlasmaPatrolParticles { sys: particles; z: 100 }//Renders all particles on the one plane
+ //Component parts
+ id: pageControl
+ Component.onCompleted: advance();
+ pages:[
+ Component {Item {
+ id: menu
+ width: root.width
+ height: root.height
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width
+ spacing: 8
+ Item {
+ id: title
+ width: root.width
+ height: 240
+ Emitter {
+ anchors.fill: parent
+ system: particles
+ enabled: true
+ group: "default"
+ emitRate: 1200
+ lifeSpan: 1200
+ shape: MaskShape {source:"content/pics/TitleText.png"}
+ size: 16
+ endSize: 0
+ sizeVariation: 8
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 6}
+ }
+ }
+ Button {
+ text: "1P"
+ onClicked: {root.players = 1; pageControl.advance();}
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Button {
+ text: "2P"
+ onClicked: {root.players = 2; pageControl.advance();}
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Button {
+ text: "Demo"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {root.players = 0;
+ aiSet(redVar1);
+ aiSet(redVar2);
+ aiSet(redVar3);
+ aiSet(greenVar1);
+ aiSet(greenVar2);
+ aiSet(greenVar3);
+ pageControl.at = 5;//TODO: Not a magic number
+ pageControl.advance();}
+ }
+ Button {
+ text: "Help"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ pageControl.at = 7;//TODO: Not a magic number
+ pageControl.advance();
+ }
+ }
+ Button {
+ text: "Quit"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: Qt.quit();
+ }
+ }
+ }},
+ Component {Item {
+ id: p1Screen
+ z: 101
+ width: root.width
+ height: root.height
+ Rectangle {
+ anchors.fill: parent
+ color: "red"
+ }
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player\n 1"
+ horizontalAlignment: Text.AlignHCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageControl.advance()
+ }
+ }},
+ Component {Item {
+ id: p1Choices
+ z: 3
+ width: root.width
+ height: root.height
+ Rectangle {
+ color: "black"
+ anchors.fill: parent
+ }
+ Column {
+ spacing: 16
+ width: root.width
+ anchors.horizontalCenter: parent.horizontalCenter
+ ChoiceBox {
+ target: redVar1
+ system: particles
+ }
+ ChoiceBox {
+ target: redVar2
+ system: particles
+ }
+ ChoiceBox {
+ target: redVar3
+ system: particles
+ }
+ Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Next"
+ onClicked: {
+ if (root.players < 2) {
+ aiSet(greenVar1);
+ aiSet(greenVar2);
+ aiSet(greenVar3);
+ pageControl.at = 5;//TODO: Not a magic number
+ }
+ pageControl.advance();
+ }
+ }
+ }
+ }},
+ Component {Item {
+ id: p2Screen
+ z: 101
+ width: root.width
+ height: root.height
+ Rectangle {
+ anchors.fill: parent
+ color: "green"
+ }
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player\n 2"
+ horizontalAlignment: Text.AlignHCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageControl.advance()
+ }
+ }},
+ Component {Item {
+ id: p2Choices
+ z: 1
+ width: root.width
+ height: root.height
+ Rectangle {
+ color: "black"
+ anchors.fill: parent
+ }
+ Column {
+ spacing: 16
+ width: root.width
+ anchors.horizontalCenter: parent.horizontalCenter
+ ChoiceBox {
+ target: greenVar1
+ system: particles
+ }
+ ChoiceBox {
+ target: greenVar2
+ system: particles
+ }
+ ChoiceBox {
+ target: greenVar3
+ system: particles
+ }
+ Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Next"
+ onClicked: pageControl.advance()
+ }
+ }
+ }},
+ Component {Item {
+ id: arena
+ width: root.width
+ height: root.height
+ z: 0
+ Component.onCompleted: root.readySetGo = true
+ Component.onDestruction: root.readySetGo = false
+ property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0
+ onVictoryChanged: {
+ if (redShip3.hp <= 0) {
+ if (greenShip3.hp <= 0) {
+ root.winner = "1&2"
+ }else {
+ root.winner = "2"
+ }
+ } else {
+ root.winner = "1"
+ }
+ winTimer.start()
+ }
+ Timer {
+ id: winTimer
+ interval: 1200
+ repeat: false
+ running: false
+ onTriggered: pageControl.advance();
+ }
+ Ship {
+ id: redShip1
+ shipParticle: "redTeam"
+ system: particles
+ x: 180-64
+ y: 128
+ shipType: redVar1.shipType
+ gunType: redVar1.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+ Ship {
+ id: redShip2
+ shipParticle: "redTeam"
+ system: particles
+ x: 0
+ y: 0
+ shipType: redVar2.shipType
+ gunType: redVar2.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+ Ship {
+ id: redShip3
+ shipParticle: "redTeam"
+ system: particles
+ x: 360-128
+ y: 0
+ shipType: redVar3.shipType
+ gunType: redVar3.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+
+ Ship {
+ id: greenShip1
+ shipParticle: "greenTeam"
+ system: particles
+ x: 180-64
+ y: 600 - 128 - 128
+ shipType: greenVar1.shipType
+ gunType: greenVar1.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ Ship {
+ id: greenShip2
+ shipParticle: "greenTeam"
+ system: particles
+ x: 0
+ y: 600-128
+ shipType: greenVar2.shipType
+ gunType: greenVar2.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ Ship {
+ id: greenShip3
+ shipParticle: "greenTeam"
+ system: particles
+ x: 360 - 128
+ y: 600 - 128
+ shipType: greenVar3.shipType
+ gunType: greenVar3.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ }},
+ Component {Item {
+ id: winScreen
+ z: 101
+ width: root.width
+ height: root.height
+ /*
+ Rectangle {
+ anchors.fill: parent
+ color: "black"
+ }
+ */
+ Text {//TODO: Particle Text?
+ anchors.fill: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player " + root.winner + " wins!"
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {pageControl.at = 0; pageControl.advance();}
+ }
+ }},
+ Component {
+ HelpScreens {
+ onExitDesired: {pageControl.at = 0; pageControl.advance();}
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/qml/particles/simple/dynamiccomparison.qml b/examples/qml/particles/simple/dynamiccomparison.qml
new file mode 100644
index 0000000000..a7cdb9b32a
--- /dev/null
+++ b/examples/qml/particles/simple/dynamiccomparison.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** 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
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ system: sys
+ source: "../images/particle.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ entryEffect: ImageParticle.None
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ width: parent.width/2
+ speed: PointDirection {y: 72; yVariation: 24}
+ lifeSpan: 10000
+ emitRate: 1000
+ enabled: false
+ size: 32
+ }
+
+ Item {
+ id: fakeEmitter
+ function burst(number) {
+ while (number > 0) {
+ var item = fakeParticle.createObject(root);
+ item.lifeSpan = Math.random() * 5000 + 5000;
+ item.x = Math.random() * 320 + 320;
+ item.y = 0;
+ number--;
+ }
+ }
+
+ Component {
+ id: fakeParticle
+ Image {
+ id: container
+ property int lifeSpan: 10000
+ width: 32
+ height: 32
+ source: "../images/particle.png"
+ y: 0
+ PropertyAnimation on y {from: -16; to: 480-16; duration: container.lifeSpan; running: true}
+ SequentialAnimation on opacity {
+ running: true
+ NumberAnimation { from:0; to: 1; duration: 500}
+ PauseAnimation { duration: container.lifeSpan - 1000}
+ NumberAnimation { from:1; to: 0; duration: 500}
+ ScriptAction { script: container.destroy(); }
+ }
+ }
+ }
+ }
+
+ Text {
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ text: "1000 particles"
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(1000);
+ }
+ }
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: "1000 items"
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fakeEmitter.burst(1000);
+ }
+ }
+}
diff --git a/examples/qml/particles/simple/dynamicemitters.qml b/examples/qml/particles/simple/dynamicemitters.qml
new file mode 100644
index 0000000000..4431ebe82e
--- /dev/null
+++ b/examples/qml/particles/simple/dynamicemitters.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+ ImageParticle {
+ system: sys
+ source: "../images/particle.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ }
+
+ Component {
+ id: emitterComp
+ Emitter {
+ id: container
+ Emitter {
+ id: emitMore
+ system: sys
+ emitRate: 128
+ lifeSpan: 600
+ size: 16
+ endSize: 8
+ speed: AngleDirection {angleVariation:360; magnitude: 60}
+ }
+
+ property int life: 2600
+ property real targetX: 0
+ property real targetY: 0
+ function go() {
+ xAnim.start();
+ yAnim.start();
+ container.enabled = true
+ }
+ system: sys
+ emitRate: 32
+ lifeSpan: 600
+ size: 24
+ endSize: 8
+ NumberAnimation on x {
+ id: xAnim;
+ to: targetX
+ duration: life
+ running: false
+ }
+ NumberAnimation on y {
+ id: yAnim;
+ to: targetY
+ duration: life
+ running: false
+ }
+ Timer {
+ interval: life
+ running: true
+ onTriggered: container.destroy();
+ }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ for (var i=0; i<8; i++) {
+ var obj = emitterComp.createObject(root);
+ obj.x = mouse.x
+ obj.y = mouse.y
+ obj.targetX = Math.random() * 240 - 120 + obj.x
+ obj.targetY = Math.random() * 240 - 120 + obj.y
+ obj.life = Math.round(Math.random() * 2400) + 200
+ obj.emitRate = Math.round(Math.random() * 32) + 32
+ obj.go();
+ }
+ }
+ }
+}
diff --git a/examples/qml/particles/simple/multiplepainters.qml b/examples/qml/particles/simple/multiplepainters.qml
new file mode 100644
index 0000000000..c1b85caa2d
--- /dev/null
+++ b/examples/qml/particles/simple/multiplepainters.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** 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: "darkblue"
+ property bool cloneMode: false
+ ParticleSystem {
+ id: sys
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: cloneMode = !cloneMode;
+ }
+ Emitter {
+ system: sys
+ y:root.height + 20
+ width: root.width
+ emitRate: 200
+ lifeSpan: 4000
+ startTime: 4000
+ speed: PointDirection { y: -120; }
+ }
+
+ ImageParticle {
+ system: sys
+ visible: !cloneMode
+ source: "../images/particle2.png"
+ }
+
+ ImageParticle {
+ system: sys
+ visible: cloneMode
+ z: 0
+ source: "../images/particle3.png"
+ }
+
+ ImageParticle {
+ system: sys
+ clip: true
+ visible: cloneMode
+ y: 120
+ height: 240
+ width: root.width
+ z: 1
+ source: "../images/particle.png"
+ }
+}
diff --git a/examples/qml/particles/simple/startstop.qml b/examples/qml/particles/simple/startstop.qml
new file mode 100644
index 0000000000..62105b28a0
--- /dev/null
+++ b/examples/qml/particles/simple/startstop.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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"
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.LeftButton)
+ particles.running = !particles.running
+ else
+ particles.paused = !particles.paused;
+ }
+ }
+
+ ParticleSystem {
+ id: particles
+ running: false
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/star.png"
+ sizeTable: "../images/sparkleSize.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ anchors.fill: parent
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 30
+ sizeVariation: 10
+ }
+}