aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/declarative.pro3
-rw-r--r--examples/declarative/inputmethods/inputmethods.qmlproject16
-rw-r--r--examples/declarative/inputmethods/spellcheck/Key.qml85
-rw-r--r--examples/declarative/inputmethods/spellcheck/Keyboard.qml141
-rw-r--r--examples/declarative/inputmethods/spellcheck/WordSuggestions.qml100
-rw-r--r--examples/declarative/inputmethods/spellcheck/spellcheck.qml137
-rw-r--r--examples/declarative/painteditem/main.cpp85
-rw-r--r--examples/declarative/painteditem/myfile.qml57
-rw-r--r--examples/declarative/painteditem/painteditem.pro14
-rw-r--r--examples/declarative/particles/allsmiles/content/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/singlesmile.pngbin0 -> 269 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/sizeInOut.pngbin0 -> 251 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/smileMask.pngbin0 -> 259 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite.pngbin0 -> 496 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite2.pngbin0 -> 459 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite3.pngbin0 -> 476 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite4.pngbin0 -> 553 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite5.pngbin0 -> 623 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite6.pngbin0 -> 615 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacesprite7.pngbin0 -> 581 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacespriteX.pngbin0 -> 474 bytes
-rw-r--r--examples/declarative/particles/allsmiles/content/squarefacespriteXX.pngbin0 -> 255 bytes
-rw-r--r--examples/declarative/particles/allsmiles/smile.qml77
-rw-r--r--examples/declarative/particles/allsmiles/smilefactory.qml118
-rw-r--r--examples/declarative/particles/allsmiles/spriteparticles.qml103
-rw-r--r--examples/declarative/particles/allsmiles/spritestateparticles.qml190
-rw-r--r--examples/declarative/particles/allsmiles/spritevariedparticles.qml117
-rw-r--r--examples/declarative/particles/asteroid/asteroid.qml213
-rw-r--r--examples/declarative/particles/asteroid/blackhole.qml200
-rw-r--r--examples/declarative/particles/asteroid/content/_explo.pngbin0 -> 81528 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/meteor_explo.pngbin0 -> 219946 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/meteors.pngbin0 -> 132137 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/particle4.pngbin0 -> 1799 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/rocket2.pngbin0 -> 1918 bytes
-rw-r--r--examples/declarative/particles/asteroid/content/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/declarative/particles/modelparticles/bubbles.qml81
-rw-r--r--examples/declarative/particles/modelparticles/content/Delegate.qml88
-rw-r--r--examples/declarative/particles/modelparticles/content/Delegate2.qml79
-rw-r--r--examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml204
-rw-r--r--examples/declarative/particles/modelparticles/content/RssModel.qml53
-rw-r--r--examples/declarative/particles/modelparticles/content/bubble.pngbin0 -> 3413 bytes
-rw-r--r--examples/declarative/particles/modelparticles/content/script.js27
-rw-r--r--examples/declarative/particles/modelparticles/gridsplosion.qml146
-rw-r--r--examples/declarative/particles/modelparticles/package.qml91
-rw-r--r--examples/declarative/particles/modelparticles/stream.qml280
-rw-r--r--examples/declarative/particles/snow/content/flake-01.pngbin0 -> 189327 bytes
-rw-r--r--examples/declarative/particles/snow/snow.qml75
-rw-r--r--examples/declarative/particles/snow/snow2.qml74
-rw-r--r--examples/declarative/particles/snow/snow3.qml80
-rw-r--r--examples/declarative/particles/spaceexplorer/content/helpers.js8
-rw-r--r--examples/declarative/particles/spaceexplorer/content/particle4.pngbin0 -> 1799 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/powerupScore.pngbin0 -> 83169 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/powerupScore_gone.pngbin0 -> 140 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/powerupScore_got.pngbin0 -> 81528 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/rocket2.pngbin0 -> 1918 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/rocketEye.pngbin0 -> 2073 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/content/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/declarative/particles/spaceexplorer/spaceexplorer.qml412
-rw-r--r--examples/declarative/particles/trails/content/PetsModel.qml98
-rw-r--r--examples/declarative/particles/trails/content/candle.pngbin0 -> 1348 bytes
-rw-r--r--examples/declarative/particles/trails/content/colortable.pngbin0 -> 704 bytes
-rw-r--r--examples/declarative/particles/trails/content/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/declarative/particles/trails/content/particle2.pngbin0 -> 3909 bytes
-rw-r--r--examples/declarative/particles/trails/content/particle3.pngbin0 -> 3186 bytes
-rw-r--r--examples/declarative/particles/trails/content/particleA.pngbin0 -> 3541 bytes
-rw-r--r--examples/declarative/particles/trails/content/portal_bg.pngbin0 -> 96858 bytes
-rw-r--r--examples/declarative/particles/trails/content/sparkleSize.pngbin0 -> 378 bytes
-rw-r--r--examples/declarative/particles/trails/content/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/declarative/particles/trails/dynamicemitters.qml121
-rw-r--r--examples/declarative/particles/trails/fireballs.qml174
-rw-r--r--examples/declarative/particles/trails/layered.qml93
-rw-r--r--examples/declarative/particles/trails/list.qml120
-rw-r--r--examples/declarative/particles/trails/overburst.qml85
-rw-r--r--examples/declarative/particles/trails/portal.qml110
-rw-r--r--examples/declarative/particles/trails/rainbow.qml82
-rw-r--r--examples/declarative/particles/trails/shimmer.qml73
-rw-r--r--examples/declarative/particles/trails/swarm.qml78
-rw-r--r--examples/declarative/particles/trails/trails.qml87
-rw-r--r--examples/declarative/particles/trails/turbulence.qml129
-rw-r--r--examples/declarative/particles/trails/velocityfrommotion.qml327
85 files changed, 4930 insertions, 1 deletions
diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro
index 927294ade6..cbeb7e9e26 100644
--- a/examples/declarative/declarative.pro
+++ b/examples/declarative/declarative.pro
@@ -4,7 +4,8 @@ TEMPLATE = subdirs
SUBDIRS = \
cppextensions \
modelviews \
- tutorials
+ tutorials \
+ painteditem
# plugins uses a 'Time' class that conflicts with symbian e32std.h also defining a class of the same name
symbian:SUBDIRS -= plugins
diff --git a/examples/declarative/inputmethods/inputmethods.qmlproject b/examples/declarative/inputmethods/inputmethods.qmlproject
new file mode 100644
index 0000000000..d4909f8685
--- /dev/null
+++ b/examples/declarative/inputmethods/inputmethods.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/examples/declarative/inputmethods/spellcheck/Key.qml b/examples/declarative/inputmethods/spellcheck/Key.qml
new file mode 100644
index 0000000000..c95a3f0b2c
--- /dev/null
+++ b/examples/declarative/inputmethods/spellcheck/Key.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 {
+ property string text
+ property string displayText
+ property alias font: keyText.font
+ property int key: 0
+
+ id: root
+ radius: 2
+
+ width: 28
+ height: 28
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgrey" }
+ GradientStop { position: 1.0; color: "grey" }
+ }
+
+ Text {
+ id: keyText
+
+ anchors.fill: parent
+
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ font.pixelSize: 18
+ font.capitalization: keyboard.shift && displayText == "" ? Font.AllUppercase : Font.MixedCase
+
+ text: root.displayText != "" ? root.displayText : root.text
+
+ style: !mouseArea.pressed ? Text.Raised : Text.Normal
+ color: "white"
+ styleColor: "grey"
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ anchors.fill: parent
+ onPressed: keyboard.keyPress(key, text)
+ onReleased: keyboard.keyRelease(key, text)
+ }
+}
diff --git a/examples/declarative/inputmethods/spellcheck/Keyboard.qml b/examples/declarative/inputmethods/spellcheck/Keyboard.qml
new file mode 100644
index 0000000000..533762e7ba
--- /dev/null
+++ b/examples/declarative/inputmethods/spellcheck/Keyboard.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.inputcontext 1.0 as InputContext
+
+
+Rectangle {
+ id: keyboard
+
+ radius: 5
+ height: 122
+ width: 324
+
+ property bool shift: false
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightgrey" }
+ GradientStop { position: 1.0; color: "white" }
+ }
+
+ Column {
+ anchors.left: parent.left; anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+
+ spacing: 2
+
+ Row {
+ spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Key { key: Qt.Key_Q; text: "q"; }
+ Key { key: Qt.Key_W; text: "w"; }
+ Key { key: Qt.Key_E; text: "e"; }
+ Key { key: Qt.Key_R; text: "r"; }
+ Key { key: Qt.Key_T; text: "t"; }
+ Key { key: Qt.Key_Y; text: "y"; }
+ Key { key: Qt.Key_U; text: "u"; }
+ Key { key: Qt.Key_I; text: "i"; }
+ Key { key: Qt.Key_O; text: "o"; }
+ Key { key: Qt.Key_P; text: "p"; }
+ }
+ Row {
+ spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Key { key: Qt.Key_A; text: "a"; }
+ Key { key: Qt.Key_S; text: "s"; }
+ Key { key: Qt.Key_D; text: "d"; }
+ Key { key: Qt.Key_F; text: "f"; }
+ Key { key: Qt.Key_G; text: "g"; }
+ Key { key: Qt.Key_H; text: "h"; }
+ Key { key: Qt.Key_J; text: "j"; }
+ Key { key: Qt.Key_K; text: "k"; }
+ Key { key: Qt.Key_L; text: "l"; }
+ }
+ Row {
+ spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Key { key: Qt.Key_Shift; displayText: "shift"; width: 50 }
+ Key { key: Qt.Key_Z; text: "z"; }
+ Key { key: Qt.Key_X; text: "x"; }
+ Key { key: Qt.Key_C; text: "c"; }
+ Key { key: Qt.Key_V; text: "v"; }
+ Key { key: Qt.Key_B; text: "b"; }
+ Key { key: Qt.Key_N; text: "n"; }
+ Key { key: Qt.Key_M; text: "m"; }
+ Key { key: Qt.Key_Comma; text: ","; }
+ Key { key: Qt.Key_Period; text: "."; }
+ }
+
+ Row {
+ spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Key { key: Qt.Key_Enter; text: "\n"; displayText: "enter"; width: 90 }
+ Key { key: Qt.Key_Space; text: " "; displayText: "space"; width: 138}
+ Key { key: Qt.Key_Backspace; displayText: "backspace"; width: 90 }
+ }
+ }
+
+ function keyPress(key, text)
+ {
+ if (key == Qt.Key_Shift)
+ keyboard.shift = !keyboard.shift
+ else if (keyboard.shift)
+ InputContext.sendKeyPress(key, text.toUpperCase(), Qt.ShiftModifier)
+ else
+ InputContext.sendKeyPress(key, text)
+ }
+
+ function keyRelease(key, text)
+ {
+ if (key != Qt.Key_Shift) {
+ if (keyboard.shift) {
+ InputContext.sendKeyRelease(key, text.toUpperCase(), Qt.ShiftModifier)
+ keyboard.shift = false
+ } else {
+ InputContext.sendKeyRelease(key, text)
+ }
+ }
+ }
+}
diff --git a/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml b/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml
new file mode 100644
index 0000000000..5c4e9cb4a2
--- /dev/null
+++ b/examples/declarative/inputmethods/spellcheck/WordSuggestions.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.inputcontext 1.0 as InputContext
+
+ListView {
+ property int globalX: InputContext.microFocus.x + ((InputContext.microFocus.width - width) / 2)
+ property int globalY: InputContext.microFocus.y + InputContext.microFocus.height
+
+ x: parent.mapToItem(null, globalX, globalY).x
+ y: parent.mapToItem(null, globalX, globalY).y
+
+ visible: suggestionModel.count > 0
+
+ width: 200
+ height: 70
+
+ InputContext.KeyFilter {
+ onPressed: event.accepted = filterKeyPress(event.key, event.text)
+ }
+
+ InputContext.MouseHandler {
+ onPressed: {
+ if (cursor < 0 || cursor >= InputContext.preeditText.length)
+ InputContext.commit()
+ }
+ }
+
+ model: XmlListModel {
+ id: suggestionModel
+
+ query: "/query/results/s:suggestion"
+ namespaceDeclarations: "declare namespace s=\"http://www.inktomi.com/\";"
+ source: InputContext.preeditText.length > 4 ? "http://query.yahooapis.com/v1/public/yql?q=select * from search.spelling where query=\"" + InputContext.preeditText + "\"" : ""
+
+ XmlRole { name: "suggestion"; query: "string()" }
+ }
+
+ delegate: Rectangle {
+ radius: 2
+ color: "lightsteelblue"
+
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ width: suggestionText.implicitWidth + 2
+ height: suggestionText.implicitHeight + 2
+
+ Text {
+ id: suggestionText
+
+ font: InputContext.font
+ text: suggestion
+
+ anchors.fill: parent
+ anchors.margins: 1
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: InputContext.commit(suggestion)
+ }
+ }
+}
diff --git a/examples/declarative/inputmethods/spellcheck/spellcheck.qml b/examples/declarative/inputmethods/spellcheck/spellcheck.qml
new file mode 100644
index 0000000000..57e81451a6
--- /dev/null
+++ b/examples/declarative/inputmethods/spellcheck/spellcheck.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.inputcontext 1.0 as InputContext
+
+Item {
+ width: 360
+ height: 240
+
+ function filterKeyPress(key, text)
+ {
+ switch (key) {
+ case Qt.Key_Enter:
+ case Qt.Key_Return:
+ case Qt.Key_Space:
+ case Qt.Key_Tab:
+ if (InputContext.preeditText != "")
+ InputContext.commit();
+ break;
+ case Qt.Key_Backspace:
+ if (InputContext.preeditText != "") {
+ InputContext.preeditText = InputContext.preeditText.substr(0, InputContext.preeditText.length - 1);
+ return true;
+ }
+ break;
+ default:
+ if (text != "") {
+ InputContext.preeditText += text
+ return true;
+ } else if (InputContext.preeditText != "") {
+ InputContext.commit();
+ }
+ break;
+ }
+ return false;
+ }
+
+ Rectangle {
+ anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right;
+ anchors.bottom: keyboard.top
+ anchors.margins: 2
+
+ border.width: 1
+ radius: 2
+
+ TextEdit {
+ id: textEdit
+
+ wrapMode: TextEdit.WordWrap
+
+ anchors.fill: parent
+ anchors.margins: 2
+ }
+
+ MouseArea {
+ anchors.fill: textEdit
+
+ onPressed: {
+ mouse.accepted = false
+ var position = textEdit.positionAt(mouse.x, mouse.y);
+ if (position != textEdit.cursorPosition) {
+ InputContext.commit()
+ textEdit.cursorPosition = textEdit.positionAt(mouse.x, mouse.y)
+ textEdit.selectWord()
+ var word = textEdit.selectedText
+ if (word != "") {
+ InputContext.commit("");
+ InputContext.preeditText = word;
+ }
+ }
+ }
+ }
+ }
+
+ WordSuggestions {}
+
+ Keyboard {
+ id: keyboard
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ y: parent.height
+
+ states: [
+ State {
+ name: "visible"
+ PropertyChanges { target: keyboard; y: parent.height - height }
+ when: InputContext.softwareInputPanelVisible
+ },
+ State {
+ name: "hidden"
+ PropertyChanges { target: keyboard; y: parent.height }
+ when: !InputContext.softwareInputPanelVisible
+ }
+ ]
+ transitions: Transition {
+ NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad; duration: 100 }
+ }
+ }
+}
diff --git a/examples/declarative/painteditem/main.cpp b/examples/declarative/painteditem/main.cpp
new file mode 100644
index 0000000000..10bd4302c9
--- /dev/null
+++ b/examples/declarative/painteditem/main.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtGui/qapplication.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QtDeclarative/qsgview.h>
+#include <QtDeclarative/qsgpainteditem.h>
+
+class MyPaintItem : public QSGPaintedItem
+{
+ Q_OBJECT
+public:
+ MyPaintItem() : QSGPaintedItem()
+ {
+ setAntialiasing(true);
+ }
+
+ virtual void paint(QPainter *p)
+ {
+ QRectF rect(0, 0, width(), height());
+ rect.adjust(10, 10, -10, -10);
+ p->setPen(QPen(Qt::black, 20));
+ p->setBrush(Qt::yellow);
+ p->drawEllipse(rect);
+ p->setPen(Qt::black);
+ p->setFont(QFont(QLatin1String("Times"), qRound(rect.height() / 2)));
+ p->drawText(rect, Qt::AlignCenter, QLatin1String(":-)"));
+ }
+};
+
+int main(int argc, char ** argv)
+{
+ QApplication app(argc, argv);
+
+ qmlRegisterType<MyPaintItem>("MyModule", 1, 0, "MyPaintItem");
+
+ QGLFormat f = QGLFormat::defaultFormat();
+ f.setSampleBuffers(true);
+ QSGView view(f);
+ view.setResizeMode(QSGView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("myfile.qml"));
+ view.show();
+ view.raise();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/declarative/painteditem/myfile.qml b/examples/declarative/painteditem/myfile.qml
new file mode 100644
index 0000000000..bc4bd2664b
--- /dev/null
+++ b/examples/declarative/painteditem/myfile.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 MyModule 1.0
+
+Rectangle {
+ width: 480
+ height: 480
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#00249a" }
+ GradientStop { position: 0.7; color: "#ffd94f" }
+ GradientStop { position: 1.0; color: "#ffa322" }
+ }
+ MyPaintItem {
+ anchors.fill: parent
+ anchors.margins: 10
+ smooth: true
+ }
+}
diff --git a/examples/declarative/painteditem/painteditem.pro b/examples/declarative/painteditem/painteditem.pro
new file mode 100644
index 0000000000..5d7b9df074
--- /dev/null
+++ b/examples/declarative/painteditem/painteditem.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+TARGET = painteditem
+
+QT += declarative
+
+macx: CONFIG -= app_bundle
+
+SOURCES += main.cpp
+
+CONFIG += console
+
+symbian {
+ TARGET.EPOCHEAPSIZE = 0x20000 0x5000000
+}
diff --git a/examples/declarative/particles/allsmiles/content/particle.png b/examples/declarative/particles/allsmiles/content/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/particle.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/singlesmile.png b/examples/declarative/particles/allsmiles/content/singlesmile.png
new file mode 100644
index 0000000000..4087fa6b7f
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/singlesmile.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/sizeInOut.png b/examples/declarative/particles/allsmiles/content/sizeInOut.png
new file mode 100644
index 0000000000..0a306ea21a
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/sizeInOut.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/smileMask.png b/examples/declarative/particles/allsmiles/content/smileMask.png
new file mode 100644
index 0000000000..65a0143e9e
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/smileMask.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite.png b/examples/declarative/particles/allsmiles/content/squarefacesprite.png
new file mode 100644
index 0000000000..f9a5d5fcce
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite2.png b/examples/declarative/particles/allsmiles/content/squarefacesprite2.png
new file mode 100644
index 0000000000..7106a520a4
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite2.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite3.png b/examples/declarative/particles/allsmiles/content/squarefacesprite3.png
new file mode 100644
index 0000000000..f4e6f26856
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite3.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite4.png b/examples/declarative/particles/allsmiles/content/squarefacesprite4.png
new file mode 100644
index 0000000000..1e094eed4a
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite4.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite5.png b/examples/declarative/particles/allsmiles/content/squarefacesprite5.png
new file mode 100644
index 0000000000..1cfc5c7f8c
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite5.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite6.png b/examples/declarative/particles/allsmiles/content/squarefacesprite6.png
new file mode 100644
index 0000000000..b040139a9e
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite6.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacesprite7.png b/examples/declarative/particles/allsmiles/content/squarefacesprite7.png
new file mode 100644
index 0000000000..b1e5e4e339
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacesprite7.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacespriteX.png b/examples/declarative/particles/allsmiles/content/squarefacespriteX.png
new file mode 100644
index 0000000000..93a0181dd0
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacespriteX.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/content/squarefacespriteXX.png b/examples/declarative/particles/allsmiles/content/squarefacespriteXX.png
new file mode 100644
index 0000000000..3159efe246
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/content/squarefacespriteXX.png
Binary files differ
diff --git a/examples/declarative/particles/allsmiles/smile.qml b/examples/declarative/particles/allsmiles/smile.qml
new file mode 100644
index 0000000000..e37e8fa98e
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/smile.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "white"
+ width: 310
+ height: 300
+ ParticleSystem{ id: sys }
+ Picture{
+ system: sys
+ anchors.fill: parent
+ image: "content/singlesmile.png"
+ onceOff: true
+ }
+ ColoredParticle{
+ system: sys
+ image: "content/particle.png"
+ color: "black"
+ alpha: 0.4
+ sizeTable: "content/sizeInOut.png"
+ }
+ TrailEmitter{
+ id: emitter
+ system: sys
+ emitting: false
+ particleDuration: 4000
+ maxParticles: 1200
+ anchors.fill: parent
+ particleSize: 32
+ speed: PointVector{ xVariation: 12; yVariation: 12 }
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: emitter.burst(1200);
+ }
+}
+
diff --git a/examples/declarative/particles/allsmiles/smilefactory.qml b/examples/declarative/particles/allsmiles/smilefactory.qml
new file mode 100644
index 0000000000..47becb50fe
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/smilefactory.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem{id:sys}
+ DeformableParticle{
+ system: sys
+ particles: ["goingLeft", "goingRight"]
+ image: "content/singlesmile.png"
+ rotation: 90
+ rotationSpeed: 90
+ autoRotation: true
+ }
+ DeformableParticle{
+ system: sys
+ particles: ["goingDown"]
+ image: "content/squarefacespriteXX.png"
+ rotation: 180
+ yVector: PointVector{ y: 0.5; yVariation: 0.25; xVariation: 0.25; }
+ }
+ Timer{
+ running: true
+ repeat: false
+ interval: 100
+ onTriggered: emitA.emitting = true;
+ }
+ Timer{
+ running: true
+ repeat: false
+ interval: 4200
+ onTriggered: emitB.emitting = true;
+ }
+ Timer{
+ running: true
+ repeat: false
+ interval: 8400
+ onTriggered: emitC.emitting = true;
+ }
+ TrailEmitter{
+ id: emitA
+ x: 0
+ y: 120
+ system: sys
+ emitting: false
+ particle: "goingRight"
+ speed: PointVector{ x: 100 }
+ particleDuration: 4000
+ particlesPerSecond: 2
+ particleSize: 32
+ }
+ TrailEmitter{
+ id: emitB
+ x: 400
+ y: 240
+ system: sys
+ emitting: false
+ particle: "goingLeft"
+ speed: PointVector{ x: -100 }
+ particleDuration: 4000
+ particlesPerSecond: 2
+ particleSize: 32
+ }
+ TrailEmitter{
+ id: emitC
+ x: 0
+ y: 360
+ system: sys
+ emitting: false
+ particle: "goingDown"
+ speed: PointVector{ x: 100 }
+ particleDuration: 4000
+ particlesPerSecond: 2
+ particleSize: 32
+ }
+}
diff --git a/examples/declarative/particles/allsmiles/spriteparticles.qml b/examples/declarative/particles/allsmiles/spriteparticles.qml
new file mode 100644
index 0000000000..4bcb7081b8
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/spriteparticles.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ColoredParticle{
+ id: test
+ particles: ["Test"]
+ image: "content/particle.png"
+ system: sys
+ z: 2
+ anchors.fill: parent
+ color: "#336666CC"
+ colorVariation: 0.0
+ }
+ SpriteParticle{
+ id: single
+ particles: ["Face"]
+ system: sys
+ z: 2
+ anchors.fill: parent
+ Sprite{
+ source: "content/squarefacesprite.png"
+ frames: 6
+ duration: 120
+ }
+ }
+ Mask{
+ id: mask
+ source: "content/smileMask.png"
+ }
+ TrailEmitter{
+ system: sys
+ particle: "Test"
+ anchors.fill: parent
+ id: particles2
+ particlesPerSecond: 6000
+ particleDuration: 720
+ emitting: true
+ particleSize: 10
+ shape: mask
+ }
+ TrailEmitter{
+ system: sys
+ particle: "Face"
+ anchors.fill: parent
+ id: particles
+ particlesPerSecond: 60
+ particleDuration: 1440
+ emitting: true
+ speed: PointVector{xVariation: 10; yVariation: 10;}
+ particleSize: 30
+ particleSizeVariation: 10
+ shape: mask
+ }
+ ParticleSystem{
+ id: sys
+ anchors.fill: parent
+ }
+
+}
diff --git a/examples/declarative/particles/allsmiles/spritestateparticles.qml b/examples/declarative/particles/allsmiles/spritestateparticles.qml
new file mode 100644
index 0000000000..6a61487a89
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/spritestateparticles.qml
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "goldenrod"
+ width: 800
+ height: 800
+ id: root
+ SpriteImage{
+ sprites: [Sprite{
+ name: "happy"
+ source: "content/squarefacesprite2.png"
+ frames: 6
+ duration: 120
+ to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0}
+ }, Sprite{
+ name: "silly"
+ source: "content/squarefacesprite.png"
+ frames: 6
+ duration: 120
+ to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2}
+ }, Sprite{
+ name: "sad"
+ source: "content/squarefacesprite3.png"
+ frames: 6
+ duration: 120
+ to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2}
+ }, Sprite{
+ name: "cyclops"
+ source: "content/squarefacesprite4.png"
+ frames: 6
+ duration: 120
+ to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0}
+ }, Sprite{
+ name: "evil"
+ source: "content/squarefacesprite5.png"
+ frames: 6
+ duration: 120
+ to: {"happy": 1.0}
+ }, Sprite{
+ name: "love"
+ source: "content/squarefacesprite6.png"
+ frames: 6
+ duration: 120
+ to: {"sad": 0.6, "evil":0.4, "boggled":0.2}
+ }, Sprite{
+ name: "boggled"
+ source: "content/squarefacesprite7.png"
+ frames: 6
+ duration: 120
+ to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2}
+ }, Sprite{
+ name: "dying"
+ source: "content/squarefacespriteX.png"
+ frames: 4
+ duration: 120
+ to: {"dead":1.0}
+ }, Sprite{
+ name: "dead"
+ source: "content/squarefacespriteXX.png"
+ frames: 1
+ duration: 10000
+ }]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+ ParticleSystem{ id: sys }
+ SpriteParticle{
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite{
+ name: "happy"
+ source: "content/squarefacesprite2.png"
+ frames: 6
+ duration: 120
+ to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0}
+ }, Sprite{
+ name: "silly"
+ source: "content/squarefacesprite.png"
+ frames: 6
+ duration: 120
+ to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2}
+ }, Sprite{
+ name: "sad"
+ source: "content/squarefacesprite3.png"
+ frames: 6
+ duration: 120
+ to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2}
+ }, Sprite{
+ name: "cyclops"
+ source: "content/squarefacesprite4.png"
+ frames: 6
+ duration: 120
+ to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0}
+ }, Sprite{
+ name: "evil"
+ source: "content/squarefacesprite5.png"
+ frames: 6
+ duration: 120
+ to: {"happy": 1.0}
+ }, Sprite{
+ name: "love"
+ source: "content/squarefacesprite6.png"
+ frames: 6
+ duration: 120
+ to: {"sad": 0.6, "evil":0.4, "boggled":0.2}
+ }, Sprite{
+ name: "boggled"
+ source: "content/squarefacesprite7.png"
+ frames: 6
+ duration: 120
+ to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2}
+ }, Sprite{
+ name: "dying"
+ source: "content/squarefacespriteX.png"
+ frames: 4
+ duration: 120
+ to: {"dead":1.0}
+ }, Sprite{
+ name: "dead"
+ source: "content/squarefacespriteXX.png"
+ frames: 1
+ duration: 10000
+ }]
+ }
+ TrailEmitter{
+ system: sys
+ particlesPerSecond: 16
+ particleDuration: 10000
+ emitting: true
+ speed: AngleVector{angle: 90; magnitude: 60; angleVariation: 5}
+ acceleration: PointVector{ y: 10 }
+ particleSize: 30
+ particleSizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+ SpriteGoal{
+ system: sys
+ width: root.width;
+ height: root.height/2;
+ y: root.height/2;
+ goalState:"dead"
+ }
+}
diff --git a/examples/declarative/particles/allsmiles/spritevariedparticles.qml b/examples/declarative/particles/allsmiles/spritevariedparticles.qml
new file mode 100644
index 0000000000..c1b773093f
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/spritevariedparticles.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "goldenrod"
+ width: 800
+ height: 800
+ ParticleSystem{ id: sys }
+ SpriteParticle{
+ system: sys
+ anchors.fill: parent
+ sprites: [Sprite{
+ name: "initial"
+ source: "content/squarefacesprite.png"
+ frames: 6
+ duration: 0
+ to: {"happy":0.2, "silly":0.2, "sad":0.2, "cyclops":0.1, "evil":0.1, "love":0.1, "boggled":0.1}
+ }, Sprite{
+ name: "silly"
+ source: "content/squarefacesprite.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "happy"
+ source: "content/squarefacesprite2.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "sad"
+ source: "content/squarefacesprite3.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "cyclops"
+ source: "content/squarefacesprite4.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "evil"
+ source: "content/squarefacesprite5.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "love"
+ source: "content/squarefacesprite6.png"
+ frames: 6
+ duration: 120
+ }, Sprite{
+ name: "boggled"
+ source: "content/squarefacesprite7.png"
+ frames: 6
+ duration: 120
+ }]
+ }
+ TrailEmitter{
+ id: particleEmitter
+ system: sys
+ width: parent.width
+ particlesPerSecond: 16
+ particleDuration: 8000
+ emitting: true
+ speed: AngleVector{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5}
+ acceleration: PointVector{ y: 10 }
+ particleSize: 30
+ particleSizeVariation: 10
+ }
+ Binding{
+ target: particleEmitter
+ property: "y"
+ value: ma.mouseY
+ when: ma.mouseX !=0 || ma.mouseY!=0
+ }
+ MouseArea{
+ id: ma
+ anchors.fill: parent
+ }
+}
diff --git a/examples/declarative/particles/asteroid/asteroid.qml b/examples/declarative/particles/asteroid/asteroid.qml
new file mode 100644
index 0000000000..b5b4f672c2
--- /dev/null
+++ b/examples/declarative/particles/asteroid/asteroid.qml
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import Qt.labs.particles 2.0 as Qlp
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 360
+ height: 540
+ MouseArea{
+ id: ma
+ anchors.fill: parent
+ }
+
+ ParticleSystem { id: sys }
+ Image {
+ source: "content/finalfrontier.png"
+ transformOrigin: Item.Center
+ anchors.centerIn: parent
+ smooth: true
+ NumberAnimation on rotation {
+ from: 0
+ to: 360
+ duration: 200000
+ loops: Animation.Infinite
+ }
+
+ }
+ ColoredParticle {
+ system: sys
+ particles: ["starfield"]
+ image: "content/star.png"
+ colorVariation: 0.3
+ color: "white"
+ }
+ TrailEmitter {
+ id: starField
+ system: sys
+ particle: "starfield"
+
+ particlesPerSecond: 80
+ particleDuration: 2500
+
+ anchors.centerIn: parent
+
+ //acceleration: AngleVector{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed?
+ acceleration: PointVector{ xVariation: 200; yVariation: 200; }
+
+ particleSize: 0
+ particleEndSize: 80
+ particleSizeVariation: 10
+ }
+ TrailEmitter{
+ system: sys
+ particle: "meteor"
+ particlesPerSecond: 12
+ particleDuration: 5000
+ emitting: true
+ acceleration: PointVector{ xVariation: 80; yVariation: 80; }
+ particleSize: 15
+ particleEndSize: 300
+ anchors.centerIn: parent
+ }
+ SpriteParticle{
+ system: sys
+ particles: ["meteor"]
+ sprites:[Sprite{
+ id: spinState
+ name: "spinning"
+ source: "content/meteor.png"
+ frames: 35
+ duration: 40
+ speedModifiesDuration: -0.1
+ to: {"explode":0, "spinning":1}
+ },Sprite{
+ name: "explode"
+ source: "content/_explo.png"
+ frames: 22
+ duration: 40
+ speedModifiesDuration: -0.1
+ to: {"nullFrame":1}
+ },Sprite{//Not sure if this is needed, but seemed easiest
+ name: "nullFrame"
+ source: "content/nullRock.png"
+ frames: 1
+ duration: 1000
+ }
+ ]
+ }
+ SpriteGoal{
+ particles: ["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: "content/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
+ }
+
+ }
+ }
+ ColoredParticle{
+ z:0
+ system: sys
+ particles: ["exhaust"]
+ image: "content/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
+ }
+ TrailEmitter{
+ id: trailsNormal2
+ system: sys
+ particle: "exhaust"
+
+ particlesPerSecond: 300
+ particleDuration: 500
+
+ y: holder.y
+ x: holder.x
+
+ speed: PointVector{ xVariation: 40; yVariation: 40; }
+ speedFromMovement: 16
+
+ acceleration: PointVector{ xVariation: 10; yVariation: 10; }
+
+ particleSize: 4
+ particleSizeVariation: 4
+ }
+}
diff --git a/examples/declarative/particles/asteroid/blackhole.qml b/examples/declarative/particles/asteroid/blackhole.qml
new file mode 100644
index 0000000000..68d5835880
--- /dev/null
+++ b/examples/declarative/particles/asteroid/blackhole.qml
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ property bool spacePressed: false
+ focus: true
+ Image{
+ source: "content/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;
+ }
+ }
+
+ TrailEmitter{
+ particle: "stars"
+ system: particles
+ particlesPerSecond: 40
+ particleDuration: 4000
+ emitting: true
+ particleSize: 30
+ particleSizeVariation: 10
+ speed: PointVector{ x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ TrailEmitter{
+ particle: "roids"
+ system: particles
+ particlesPerSecond: 10
+ particleDuration: 4000
+ emitting: true
+ particleSize: 30
+ particleSizeVariation: 10
+ speed: PointVector{ x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ ParticleSystem{
+ id: particles
+ anchors.fill: parent
+ }
+ ColoredParticle{
+ id: stars
+ particles: ["stars"]
+ system: particles
+ image: "content/star.png"
+ color: "white"
+ colorVariation: 0.1
+ }
+ SpriteParticle{
+ id: roids
+ particles: ["roids"]
+ system: particles
+ sprites: Sprite{
+ id: spinState
+ name: "spinning"
+ source: "content/meteor.png"
+ frames: 35
+ duration: 60
+ speedModifiesDuration: -0.1
+ }
+ }
+ ColoredParticle{
+ id: shot
+ particles: ["shot"]
+ system: particles
+ image: "content/star.png"
+
+ color: "#0FF06600"
+ colorVariation: 0.3
+ }
+ ColoredParticle{
+ id: engine
+ particles: ["engine"]
+ system: particles
+ image: "content/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
+ }
+ GravitationalSingularity{
+ id: gs; x: root.width/2; y: root.height/2; strength: 4000000;
+ system: particles
+ }
+ Kill{
+ system: particles
+ x: gs.x - 8;
+ y: gs.y - 8;
+ width: 16
+ height: 16
+ }
+ Image{
+ source:"content/rocket2.png"
+ id: ship
+ width: 45
+ height: 22
+ MouseArea{
+ id: ma
+ anchors.fill: parent;
+ drag.axis: Drag.XandYAxis
+ drag.target: ship
+ }
+ TrailEmitter{
+ particle: "engine"
+ system: particles
+ particlesPerSecond: 200
+ particleDuration: 1000
+ emitting: true
+ particleSize: 10
+ particleEndSize: 4
+ particleSizeVariation: 4
+ speed: PointVector{ x: -128; xVariation: 32 }
+ height: parent.height
+ width: 20
+ }
+ TrailEmitter{
+ particle: "shot"
+ system: particles
+ particlesPerSecond: 32
+ particleDuration: 2000
+ emitting: spacePressed
+ particleSize: 40
+ speed: PointVector{ x: 256; }
+ x: parent.width
+ y: parent.height/2
+ }
+ }
+ Text{
+ color: "white"
+ anchors.bottom: parent.bottom
+ text:"Drag the ship, Spacebar to fire."
+ }
+}
+
diff --git a/examples/declarative/particles/asteroid/content/_explo.png b/examples/declarative/particles/asteroid/content/_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/_explo.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/finalfrontier.png b/examples/declarative/particles/asteroid/content/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/finalfrontier.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/meteor.png b/examples/declarative/particles/asteroid/content/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/meteor.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/meteor_explo.png b/examples/declarative/particles/asteroid/content/meteor_explo.png
new file mode 100644
index 0000000000..e659bfe2cf
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/meteor_explo.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/meteors.png b/examples/declarative/particles/asteroid/content/meteors.png
new file mode 100644
index 0000000000..bada8a1407
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/meteors.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/nullRock.png b/examples/declarative/particles/asteroid/content/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/nullRock.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/particle4.png b/examples/declarative/particles/asteroid/content/particle4.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/particle4.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/rocket.png b/examples/declarative/particles/asteroid/content/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/rocket.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/rocket2.png b/examples/declarative/particles/asteroid/content/rocket2.png
new file mode 100644
index 0000000000..7110f8fdc6
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/rocket2.png
Binary files differ
diff --git a/examples/declarative/particles/asteroid/content/star.png b/examples/declarative/particles/asteroid/content/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/declarative/particles/asteroid/content/star.png
Binary files differ
diff --git a/examples/declarative/particles/modelparticles/bubbles.qml b/examples/declarative/particles/modelparticles/bubbles.qml
new file mode 100644
index 0000000000..711d52d522
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/bubbles.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import "../../modelviews/listview/content" as OtherDemo
+import "content/script.js" as Script
+import "content"
+//Needs OtherDemo to be updated to QtQuick 2.0
+
+Item{
+ id: root
+ width: 400
+ height: 400
+ Rectangle{
+ anchors.fill: parent
+ color: "lightsteelblue"
+ }
+ ParticleSystem{
+ id: sys;
+ }
+ TrailEmitter{
+ system: sys
+ particle: "A"
+ width: parent.width/2
+ x: parent.width/4
+ y:parent.height
+ speed: PointVector{ y: -64; yVariation: 16 }
+ particlesPerSecond: 1
+ particleDuration: 8000
+ }
+ Drift{
+ system: sys
+ xDrift: 200
+ }
+ ModelParticle{
+ id: mp
+ z: 0
+ system: sys
+ particles: ["A"]
+ model: OtherDemo.RecipesModel{}
+ delegate: ExpandingDelegate{}
+ }
+}
diff --git a/examples/declarative/particles/modelparticles/content/Delegate.qml b/examples/declarative/particles/modelparticles/content/Delegate.qml
new file mode 100644
index 0000000000..ae1dffb63b
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/content/Delegate.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/declarative/particles/modelparticles/content/Delegate2.qml b/examples/declarative/particles/modelparticles/content/Delegate2.qml
new file mode 100644
index 0000000000..a05fa348b9
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/content/Delegate2.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/declarative/particles/modelparticles/content/ExpandingDelegate.qml b/examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml
new file mode 100644
index 0000000000..e6fcb6dcf7
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/declarative/particles/modelparticles/content/RssModel.qml b/examples/declarative/particles/modelparticles/content/RssModel.qml
new file mode 100644
index 0000000000..603a157de5
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/content/RssModel.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 1.0
+
+XmlListModel {
+ property string tags : ""
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+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/declarative/particles/modelparticles/content/bubble.png b/examples/declarative/particles/modelparticles/content/bubble.png
new file mode 100644
index 0000000000..c7f479e9e3
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/content/bubble.png
Binary files differ
diff --git a/examples/declarative/particles/modelparticles/content/script.js b/examples/declarative/particles/modelparticles/content/script.js
new file mode 100644
index 0000000000..e8ef93a847
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/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/declarative/particles/modelparticles/gridsplosion.qml b/examples/declarative/particles/modelparticles/gridsplosion.qml
new file mode 100644
index 0000000000..a654124587
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/gridsplosion.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import "content"
+
+Item{
+ id: root
+ width: 240
+ height: 240
+ property bool inGrid: false
+ ParticleSystem{ id: sys }
+ TrailEmitter{
+ system: sys
+ id: burster;
+ emitting: false
+ particlesPerSecond: 1000
+ particleDuration: 500
+ speed: PointVector{xVariation: 400; yVariation: 400}
+ anchors.centerIn: parent
+ Timer{
+ interval: 1000
+ running: true
+ repeat: false
+ onTriggered: burster.pulse(0.1);
+ }
+ Timer{
+ interval: 2000
+ running: true
+ repeat: false
+ onTriggered: {inGrid = true;}// sys.running = false;}
+ }
+ }
+ ColoredParticle{
+ system: sys
+ image: "../trails/content/particle.png"
+ color: "black"
+ colorVariation: 0.0
+ }
+ GridView{ id: grid; cellWidth: 40; cellHeight: 40
+ model: theModel.parts.grid
+ width: 120
+ height: 120
+ }
+ ModelParticle{
+ system: sys
+ model: theModel.parts.particles
+ }
+ Friction{
+ system: sys
+ factor: 1
+ }
+ Stasis{
+ system: sys
+ targetLife: 400
+ }
+ VisualDataModel{
+ id: theModel
+ delegate: Delegate2{}
+ model: ListModel{
+ ListElement{
+ w: 40
+ h: 20
+ col: "forestgreen"
+ }
+ ListElement{
+ w: 20
+ h: 40
+ col: "salmon"
+ }
+ ListElement{
+ w: 20
+ h: 20
+ col: "lightsteelblue"
+ }
+ ListElement{
+ w: 40
+ h: 40
+ col: "goldenrod"
+ }
+ ListElement{
+ w: 40
+ h: 20
+ col: "forestgreen"
+ }
+ ListElement{
+ w: 20
+ h: 40
+ col: "salmon"
+ }
+ ListElement{
+ w: 20
+ h: 20
+ col: "lightsteelblue"
+ }
+ ListElement{
+ w: 40
+ h: 40
+ col: "goldenrod"
+ }
+ ListElement{
+ w: 0
+ h: 0
+ col: "white"//Hack because add isn't working well with old stuff
+ }
+ }
+ }
+}
diff --git a/examples/declarative/particles/modelparticles/package.qml b/examples/declarative/particles/modelparticles/package.qml
new file mode 100644
index 0000000000..402cdea84a
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/package.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import "content"
+
+Rectangle {
+ color: "white"
+ width: 400
+ height: 200
+
+ ListModel {
+ id: myModel
+ ListElement { display: "One" }
+ ListElement { display: "Two" }
+ ListElement { display: "Three" }
+ ListElement { display: "Four" }
+ ListElement { display: "Five" }
+ ListElement { display: "Six" }
+ ListElement { display: "Seven" }
+ ListElement { display: "Eight" }
+ }
+ //![0]
+ VisualDataModel {
+ id: visualModel
+ delegate: Delegate {}
+ model: myModel
+ }
+
+ ListView {
+ width: 200; height:200
+ model: visualModel.parts.list
+ }
+ ModelParticle{
+ x: 200; width: 200; height:200
+ model: visualModel.parts.grid
+ system: sys
+ clip: true;
+ }
+ //![0]
+ ParticleSystem{
+ id: sys
+ anchors.fill: parent
+ }
+ TrailEmitter{
+ system: sys
+ width: 100
+ x: 50
+ speed: PointVector{ y: 40 }
+ particleDuration: 5000
+ particlesPerSecond: 1.6
+ }
+}
diff --git a/examples/declarative/particles/modelparticles/stream.qml b/examples/declarative/particles/modelparticles/stream.qml
new file mode 100644
index 0000000000..b67d6c42af
--- /dev/null
+++ b/examples/declarative/particles/modelparticles/stream.qml
@@ -0,0 +1,280 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.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
+ overwrite: false
+ startTime: 12000//Doesn't actually work with the loading time though...
+ }
+ TrailEmitter{
+ id: emitter
+ system: sys
+ height: parent.height - 132/2
+ x: -132/2
+ y: 132/2
+ speed: PointVector{ x: 32; xVariation: 8 }
+ particlesPerSecond: 0.5
+ particleDuration: 120000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
+ particle: "photos"
+ }
+ Kill{
+ system: sys
+ x: parent.width + 132/2
+ height: parent.height
+ width: 1000
+ }
+ ColoredParticle{
+ system: sys
+ particles: ["fireworks"]
+ image: "../trails/content/star.png"
+ color: "lightsteelblue"
+ alpha: 0
+ colorVariation: 0
+ z: 1000
+ }
+ ModelParticle{
+ id: mp
+ z: 0
+ system: sys
+ fade: false
+ particles: ["photos"]
+ }
+ Component{
+ id: alertDelegate
+ Rectangle{
+ width: 132
+ height: 132
+ NumberAnimation on scale{
+ running: true
+ loops: 1
+ from: 0.2
+ to: 1
+ }
+ Image{
+ source: "../asteroid/content/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(0.2);
+ 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
+ x: root.width/2
+ y: root.height/2
+ strength: -30000
+ active: false
+ anchors.centerIn: parent
+ width: parent.width/2
+ height: parent.height/2
+ particles:["photos"]
+ }
+ Reset{
+ id: resetter
+ system: sys
+ particles:["photos"]
+ }
+ TrailEmitter{
+ id: centerEmitter
+ speed: PointVector{ x: 32; xVariation: 8;}
+ particlesPerSecond: 0.5
+ particleDuration: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
+ maxParticles: 20
+ particle: "photos"
+ system: sys
+ anchors.centerIn: parent
+ emitting: false
+
+ //TODO: Zoom in effect
+ }
+ TrailEmitter{
+ id: spawnFireworks
+ particle: "fireworks"
+ system: sys
+ maxParticles: 400
+ particlesPerSecond: 400
+ particleDuration: 2800
+ x: parent.width/2
+ y: parent.height/2 - 64
+ width: 8
+ height: 8
+ emitting: false
+ particleSize: 32
+ particleEndSize: 8
+ speed: AngleVector{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
+ acceleration: PointVector{ 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
+ //ModelParticle.onAttached: console.log("I'm in" + x + "," + y + ":" + opacity);
+ ModelParticle.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/declarative/particles/snow/content/flake-01.png b/examples/declarative/particles/snow/content/flake-01.png
new file mode 100644
index 0000000000..490887a82f
--- /dev/null
+++ b/examples/declarative/particles/snow/content/flake-01.png
Binary files differ
diff --git a/examples/declarative/particles/snow/snow.qml b/examples/declarative/particles/snow/snow.qml
new file mode 100644
index 0000000000..25d2e1468b
--- /dev/null
+++ b/examples/declarative/particles/snow/snow.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ width: 360
+ height: 540
+ ParticleSystem { id: particles }
+ SpriteParticle {
+ system: particles
+ Sprite{
+ name: "snow"
+ source: "content/flake-01.png"
+ frames: 51
+ duration: 40
+ }
+ }
+ Wander {
+ system: particles
+ anchors.fill: parent
+ xVariance: 40;
+ pace: 40;
+ }
+ TrailEmitter {
+ system: particles
+ particlesPerSecond: 20
+ particleDuration: 7000
+ emitting: true
+ speed: PointVector{ y:80; yVariation: 40; }
+ acceleration: PointVector{ y: 4 }
+ particleSize: 20
+ particleSizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+}
diff --git a/examples/declarative/particles/snow/snow2.qml b/examples/declarative/particles/snow/snow2.qml
new file mode 100644
index 0000000000..c016ba2934
--- /dev/null
+++ b/examples/declarative/particles/snow/snow2.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ width: 360
+ height: 540
+ ParticleSystem{ id: particles }
+ SpriteParticle{
+ system: particles
+ Sprite{
+ name: "snow"
+ source: "content/flake-01.png"
+ frames: 51
+ duration: 40
+ }
+ }
+ Drift{
+ system: particles
+ anchors.fill: parent
+ xDrift: 400;
+ }
+ TrailEmitter{
+ system: particles
+ particlesPerSecond: 20
+ particleDuration: 7000
+ emitting: true
+ speed: PointVector{ y:80; yVariation: 40; }
+ acceleration: PointVector{ y: 4 }
+ particleSize: 20
+ particleSizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+}
diff --git a/examples/declarative/particles/snow/snow3.qml b/examples/declarative/particles/snow/snow3.qml
new file mode 100644
index 0000000000..080bc4d1af
--- /dev/null
+++ b/examples/declarative/particles/snow/snow3.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ width: 360
+ height: 540
+ id: root
+ ParticleSystem{ id: particles }
+ SpriteParticle{
+ system: particles
+ sprites: Sprite{
+ name: "snow"
+ source: "content/flake-01.png"
+ frames: 51
+ duration: 40
+ }
+ }
+ Drift{
+ system: particles
+ anchors.fill: parent
+ xDrift: 200
+ }
+ SpeedLimit{
+ system: particles
+ anchors.fill: parent
+ speedLimit: 100
+ }
+ TrailEmitter{
+ system: particles
+ particlesPerSecond: 20
+ particleDuration: 7000
+ emitting: true
+ speed: PointVector{ y:80; yVariation: 40; }
+ acceleration: PointVector{ y: 4 }
+ particleSize: 20
+ particleSizeVariation: 10
+ width: parent.width
+ height: 40
+ }
+}
diff --git a/examples/declarative/particles/spaceexplorer/content/helpers.js b/examples/declarative/particles/spaceexplorer/content/helpers.js
new file mode 100644
index 0000000000..c38c4c0eed
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/helpers.js
@@ -0,0 +1,8 @@
+function intersects(item, x, y, e){
+ return x+e >= item.x && x-e <= item.x + item.width && y+e >= item.y && y-e <= item.y + item.height;
+}
+
+function direction(x1, y1, x2, y2){
+ return Math.atan2(y2-y1, x2-x1) * (180/Math.PI);
+}
+
diff --git a/examples/declarative/particles/spaceexplorer/content/particle4.png b/examples/declarative/particles/spaceexplorer/content/particle4.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/particle4.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore.png b/examples/declarative/particles/spaceexplorer/content/powerupScore.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/powerupScore.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/rocket.png b/examples/declarative/particles/spaceexplorer/content/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/rocket.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/rocket2.png b/examples/declarative/particles/spaceexplorer/content/rocket2.png
new file mode 100644
index 0000000000..7110f8fdc6
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/rocket2.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/rocketEye.png b/examples/declarative/particles/spaceexplorer/content/rocketEye.png
new file mode 100644
index 0000000000..20005937d2
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/rocketEye.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/content/star.png b/examples/declarative/particles/spaceexplorer/content/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/content/star.png
Binary files differ
diff --git a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml
new file mode 100644
index 0000000000..091ca0a8b5
--- /dev/null
+++ b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml
@@ -0,0 +1,412 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import "content/helpers.js" as Helpers
+
+Rectangle{
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ Image{
+ anchors.centerIn: parent
+ source: "../asteroid/content/finalfrontier.png"
+ }
+ property bool spacePressed: false
+ property int holeSize: 4
+ focus: true
+ 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;
+ }
+ }
+
+ function fakeMove(){
+ fakeMoving = rocket.x < 80 || rocket.x+rocket.width-root.width > -80 || rocket.y < 80 || rocket.y+rocket.height-root.height > -80;
+ if(fakeMoving)
+ fakeMovementDir = Helpers.direction(root.width/2, root.height/2, rocket.x, rocket.y) + 180;
+ }
+ property bool fakeMoving: false
+ property real fakeMovementDir: 0
+
+ TrailEmitter{
+ particle: "stars2"
+ system: background
+ particlesPerSecond: 60
+ particleDuration: 4000
+ emitting: true
+ particleSize: 10
+ particleSizeVariation: 10
+ anchors.fill: parent
+ }
+ ParticleSystem{ id: background }
+ ColoredParticle{
+ particles: ["stars2"]
+ system: background
+ anchors.fill: parent
+ image: "content/star.png"
+ color: "white"
+ colorVariation: 0.1
+ }
+ Gravity{
+ system: background
+ anchors.fill: parent
+ acceleration: fakeMoving?10:0
+ angle: fakeMovementDir
+ }
+ Text{
+ color: "white"
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ text:"Drag the ship, but don't hit a black hole!"
+ font.pixelSize: 10
+ }
+ Text{
+ color: "white"
+ font.pixelSize: 36
+ anchors.centerIn: parent
+ text: "GAME OVER"
+ opacity: gameOver ? 1 : 0
+ Behavior on opacity{NumberAnimation{}}
+ }
+ Text{
+ color: "white"
+ font.pixelSize: 18
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.margins: 8
+ text: "Score: " + score
+ }
+ Image{
+ source: "content/star.png"
+ width: 40
+ height: 40
+ anchors.right: parent.right
+ anchors.top: parent.top
+ MouseArea{
+ anchors.fill: parent
+ anchors.margins: -20
+ onClicked: shoot = !shoot
+ }
+ }
+ property int score: 0
+ property bool gameOver: false
+ property bool shoot: true
+ property int maxLives: 3
+ property int lives: maxLives
+ property bool alive: !Helpers.intersects(rocket, gs1.x, gs1.y, holeSize) && !Helpers.intersects(rocket, gs2.x, gs2.y, holeSize) && !Helpers.intersects(rocket, gs3.x, gs3.y, holeSize) && !Helpers.intersects(rocket, gs4.x, gs4.y, holeSize);
+ onAliveChanged: if(!alive){
+ lives -= 1;
+ if(lives == -1){
+ console.log("game over");
+ gameOver = true;
+ }
+ }
+ Row{
+ Repeater{
+ model: maxLives
+ delegate: Image{
+ opacity: index < lives ? 1 : 0
+ Behavior on opacity{NumberAnimation{}}
+ source: "content/rocket.png"
+ }
+ }
+ }
+
+ property real courseDur: 10000
+ property real vorteX: width/4
+ property real vorteY: height/4
+ Behavior on vorteX{NumberAnimation{duration: courseDur}}
+ Behavior on vorteY{NumberAnimation{duration: courseDur}}
+ property real vorteX2: width/4
+ property real vorteY2: 3*height/4
+ Behavior on vorteX2{NumberAnimation{duration: courseDur}}
+ Behavior on vorteY2{NumberAnimation{duration: courseDur}}
+ property real vorteX3: 3*width/4
+ property real vorteY3: height/4
+ Behavior on vorteX3{NumberAnimation{duration: courseDur}}
+ Behavior on vorteY3{NumberAnimation{duration: courseDur}}
+ property real vorteX4: 3*width/4
+ property real vorteY4: 3*height/4
+ Behavior on vorteX4{NumberAnimation{duration: courseDur}}
+ Behavior on vorteY4{NumberAnimation{duration: courseDur}}
+ Timer{
+ id: vorTimer
+ interval: courseDur
+ running: true
+ repeat: true
+ triggeredOnStart: true
+ onTriggered: {
+ vorteX = Math.random() * width * 2 - width * 0.5;
+ vorteY = Math.random() * height * 2 - height * 0.5;
+ vorteX2 = Math.random() * width * 2 - width * 0.5;
+ vorteY2 = Math.random() * height * 2 - height * 0.5;
+ vorteX3 = Math.random() * width * 2 - width * 0.5;
+ vorteY3 = Math.random() * height * 2 - height * 0.5;
+ vorteX4 = Math.random() * width * 2 - width * 0.5;
+ vorteY4 = Math.random() * height * 2 - height * 0.5;
+ }
+ }
+
+
+
+ ParticleSystem{ id: foreground }
+ ColoredParticle{
+ particles: ["stars"]
+ anchors.fill: parent
+ system: foreground
+ image: "content/star.png"
+ color: "white"
+ colorVariation: 0.1
+ }
+ ColoredParticle{
+ particles: ["shot"]
+ anchors.fill: parent
+ system: foreground
+ image: "content/star.png"
+
+ color: "orange"
+ colorVariation: 0.3
+ }
+ ColoredParticle{
+ id: engine
+ particles: ["engine"]
+ anchors.fill: parent
+ system: foreground
+ image: "content/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
+ }
+ SpriteParticle{
+ particles: ["powerups"]
+ anchors.fill: parent
+ system: foreground
+ Sprite{
+ name: "norm"
+ source: "content/powerupScore.png"
+ frames: 35
+ duration: 40
+ to: {"norm":1, "got":0}
+ }
+ Sprite{
+ name: "got"
+ source: "content/powerupScore_got.png"
+ frames: 22
+ duration: 40
+ to: {"null":1}
+ }
+ Sprite{
+ name: "null"
+ source: "content/powerupScore_gone.png"
+ frames: 1
+ duration: 1000
+ }
+ }
+ SpriteGoal{
+ x: rocket.x - 30
+ y: rocket.y - 30
+ width: 60
+ height: 60
+ goalState: "got"
+ jump: true
+ onAffected: if(!gameOver) score += 1000
+ system: foreground
+ }
+ GravitationalSingularity{
+ id: gs1; x: vorteX; y: vorteY; strength: 800000;
+ system: foreground
+ }
+ Kill{
+ x: gs1.x - holeSize;
+ y: gs1.y - holeSize;
+ width: holeSize * 2
+ height: holeSize * 2
+ system: foreground
+ }
+
+ GravitationalSingularity{
+ id: gs2; x: vorteX2; y: vorteY2; strength: 800000;
+ system: foreground
+ }
+ Kill{
+ x: gs2.x - holeSize;
+ y: gs2.y - holeSize;
+ width: holeSize * 2
+ height: holeSize * 2
+ system: foreground
+ }
+
+ GravitationalSingularity{
+ id: gs3; x: vorteX3; y: vorteY3; strength: 800000;
+ system: foreground
+ }
+ Kill{
+ x: gs3.x - holeSize;
+ y: gs3.y - holeSize;
+ width: holeSize * 2
+ height: holeSize * 2
+ system: foreground
+ }
+ GravitationalSingularity{
+ id: gs4; x: vorteX4; y: vorteY4; strength: 800000;
+ system: foreground
+ }
+ Kill{
+ x: gs4.x - holeSize;
+ y: gs4.y - holeSize;
+ width: holeSize * 2
+ height: holeSize * 2
+ system: foreground
+ }
+ TrailEmitter{
+ particle: "powerups"
+ system: foreground
+ particlesPerSecond: 1
+ particleDuration: 6000
+ emitting: !gameOver
+ particleSize: 60
+ particleSizeVariation: 10
+ anchors.fill: parent
+ }
+ TrailEmitter{
+ particle: "stars"
+ system: foreground
+ particlesPerSecond: 40
+ particleDuration: 4000
+ emitting: !gameOver
+ particleSize: 30
+ particleSizeVariation: 10
+ anchors.fill: parent
+ }
+ SpriteImage{
+ id: rocket
+ //Sprites or children for default?
+ Sprite{
+ name: "normal"
+ source: "content/rocket2.png"
+ frames: 1
+ duration: 1000
+ to: {"normal": 0.9, "winking" : 0.1}
+ }
+ Sprite{
+ name: "winking"
+ source: "content/rocketEye.png"
+ frames: 10
+ duration: 40
+ to: {"normal" : 1}
+ }
+ x: root.width/2
+ y: root.height/2
+ property int lx: 0
+ property int ly: 0
+ property int lastX: 0
+ property int lastY: 0
+ width: 45
+ height: 22
+ onXChanged:{ lastX = lx; lx = x; fakeMove()}
+ onYChanged:{ lastY = ly; ly = y; fakeMove()}
+ rotation: Helpers.direction(lastX, lastY, x, y)
+ data:[
+ MouseArea{
+ id: ma
+ anchors.fill: parent;
+ drag.axis: Drag.XandYAxis
+ drag.target: rocket
+ },
+ TrailEmitter{
+ system: foreground
+ particle: "engine"
+ particlesPerSecond: 100
+ particleDuration: 1000
+ emitting: !gameOver
+ particleSize: 10
+ particleEndSize: 4
+ particleSizeVariation: 4
+ speed: PointVector{
+ x: -128 * Math.cos(rocket.rotation * (Math.PI / 180))
+ y: -128 * Math.sin(rocket.rotation * (Math.PI / 180))
+ }
+ anchors.verticalCenter: parent.verticalCenter
+ height: 4
+ width: 4
+
+ },
+ TrailEmitter{
+ system: foreground
+ particle: "shot"
+ particlesPerSecond: 16
+ particleDuration: 1600
+ emitting: !gameOver && shoot
+ particleSize: 40
+ speed: PointVector{
+ x: 256 * Math.cos(rocket.rotation * (Math.PI / 180))
+ y: 256 * Math.sin(rocket.rotation * (Math.PI / 180))
+ }
+ x: parent.width - 4
+ y: parent.height/2
+ }
+ ]
+ }
+}
+
diff --git a/examples/declarative/particles/trails/content/PetsModel.qml b/examples/declarative/particles/trails/content/PetsModel.qml
new file mode 100644
index 0000000000..d7375a73af
--- /dev/null
+++ b/examples/declarative/particles/trails/content/PetsModel.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 1.0
+
+ListModel {
+ 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/declarative/particles/trails/content/candle.png b/examples/declarative/particles/trails/content/candle.png
new file mode 100644
index 0000000000..8fa3193719
--- /dev/null
+++ b/examples/declarative/particles/trails/content/candle.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/colortable.png b/examples/declarative/particles/trails/content/colortable.png
new file mode 100644
index 0000000000..a62ceeb4a0
--- /dev/null
+++ b/examples/declarative/particles/trails/content/colortable.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/particle.png b/examples/declarative/particles/trails/content/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/declarative/particles/trails/content/particle.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/particle2.png b/examples/declarative/particles/trails/content/particle2.png
new file mode 100644
index 0000000000..36349c6c6e
--- /dev/null
+++ b/examples/declarative/particles/trails/content/particle2.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/particle3.png b/examples/declarative/particles/trails/content/particle3.png
new file mode 100644
index 0000000000..905d8f37b8
--- /dev/null
+++ b/examples/declarative/particles/trails/content/particle3.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/particleA.png b/examples/declarative/particles/trails/content/particleA.png
new file mode 100644
index 0000000000..c63acdee1f
--- /dev/null
+++ b/examples/declarative/particles/trails/content/particleA.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/portal_bg.png b/examples/declarative/particles/trails/content/portal_bg.png
new file mode 100644
index 0000000000..3c59eeabb9
--- /dev/null
+++ b/examples/declarative/particles/trails/content/portal_bg.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/sparkleSize.png b/examples/declarative/particles/trails/content/sparkleSize.png
new file mode 100644
index 0000000000..752056541b
--- /dev/null
+++ b/examples/declarative/particles/trails/content/sparkleSize.png
Binary files differ
diff --git a/examples/declarative/particles/trails/content/star.png b/examples/declarative/particles/trails/content/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/declarative/particles/trails/content/star.png
Binary files differ
diff --git a/examples/declarative/particles/trails/dynamicemitters.qml b/examples/declarative/particles/trails/dynamicemitters.qml
new file mode 100644
index 0000000000..8ea0272d94
--- /dev/null
+++ b/examples/declarative/particles/trails/dynamicemitters.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ id: root
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem{
+ id: sys
+ }
+ ColoredParticle{
+ system: sys
+ image: "content/particle.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ }
+ Component{
+ id: emitterComp
+ TrailEmitter{
+ id: container
+ TrailEmitter{
+ id: emitMore
+ system: sys
+ emitting: true
+ particlesPerSecond: 128
+ particleDuration: 600
+ particleSize: 16
+ particleEndSize: 8
+ speed: AngleVector{angleVariation:360; magnitude: 60}
+ }
+
+ property int life: 2600
+ property real targetX: 0
+ property real targetY: 0
+ function go(){
+ xAnim.start();
+ yAnim.start();
+ container.emitting = true
+ }
+ system: sys
+ emitting: true
+ particlesPerSecond: 64
+ particleDuration: 600
+ particleSize: 24
+ particleEndSize: 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<16; i++){
+ var obj = emitterComp.createObject(root);
+ obj.x = mouse.x
+ obj.y = mouse.y
+ obj.targetX = Math.random() * 640
+ obj.targetY = Math.random() * 480
+ obj.life = Math.round(Math.random() * 2400) + 200
+ obj.go();
+ }
+ }
+ }
+}
diff --git a/examples/declarative/particles/trails/fireballs.qml b/examples/declarative/particles/trails/fireballs.qml
new file mode 100644
index 0000000000..116a2334dc
--- /dev/null
+++ b/examples/declarative/particles/trails/fireballs.qml
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem{
+ id: particles
+ }
+
+ /*
+ ColoredParticle{
+ id: fireball
+ anchors.fill: parent
+ particles: ["E"]
+ system: particles
+ image: "content/particleA.png"
+ colorVariation: 0.2
+ color: "#00ff400f"
+ }
+ */
+ ColoredParticle{
+ id: smoke
+ system: particles
+ anchors.fill: parent
+ particles: ["A", "B"]
+ image: "content/particle.png"
+ colorVariation: 0
+ color: "#00111111"
+ }
+ ColoredParticle{
+ id: flame
+ anchors.fill: parent
+ system: particles
+ particles: ["C", "D"]
+ image: "content/particle.png"
+ colorVariation: 0.1
+ color: "#00ff400f"
+ }
+ TrailEmitter{
+ id: fire
+ system: particles
+ particle: "C"
+
+ y: parent.height
+ width: parent.width
+
+ particlesPerSecond: 350
+ particleDuration: 3500
+
+ acceleration: PointVector{ y: -17; xVariation: 3 }
+ speed: PointVector{xVariation: 3}
+
+ particleSize: 24
+ particleSizeVariation: 8
+ particleEndSize: 4
+ }
+ FollowEmitter{
+ id: fireSmoke
+ particle: "B"
+ system: particles
+ follow: "C"
+ width: root.width
+ height: root.height - 68
+
+ particlesPerParticlePerSecond: 1
+ particleDuration: 2000
+
+ speed: PointVector{y:-17*6; yVariation: -17; xVariation: 3}
+ acceleration: PointVector{xVariation: 3}
+
+ particleSize: 36
+ particleSizeVariation: 8
+ particleEndSize: 16
+ }
+ FollowEmitter{
+ id: fireballFlame
+ anchors.fill: parent
+ system: particles
+ particle: "D"
+ follow: "E"
+
+ particlesPerParticlePerSecond: 120
+ particleDuration: 180
+ emissionWidth: 8
+ emissionHeight: 8
+
+ particleSize: 16
+ particleSizeVariation: 4
+ particleEndSize: 4
+ }
+
+ FollowEmitter{
+ id: fireballSmoke
+ anchors.fill: parent
+ system: particles
+ particle: "A"
+ follow: "E"
+
+ particlesPerParticlePerSecond: 128
+ particleDuration: 2400
+ emissionWidth: 16
+ emissionHeight: 16
+
+ speed: PointVector{yVariation: 16; xVariation: 16}
+ acceleration: PointVector{y: -16}
+
+ particleSize: 24
+ particleSizeVariation: 8
+ particleEndSize: 8
+ }
+ TrailEmitter{
+ id: balls
+ system: particles
+ particle: "E"
+
+ y: parent.height
+ width: parent.width
+
+ particlesPerSecond: 2
+ particleDuration: 7000
+
+ speed: PointVector{y:-17*4*2; xVariation: 6*6}
+ acceleration: PointVector{y: 17*2; xVariation: 6*6}
+
+ particleSize: 12
+ particleSizeVariation: 4
+ }
+
+}
+
diff --git a/examples/declarative/particles/trails/layered.qml b/examples/declarative/particles/trails/layered.qml
new file mode 100644
index 0000000000..38eb8e67dc
--- /dev/null
+++ b/examples/declarative/particles/trails/layered.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ id: root
+ width: 360
+ height: 600
+ color: "darkblue"
+ property bool cloneMode: false
+ MouseArea{
+ anchors.fill: parent
+ onClicked: cloneMode = !cloneMode;
+ }
+ ParticleSystem{
+ id: sys
+ startTime: 4000
+ }
+ TrailEmitter{
+ system: sys
+ y:root.height + 20
+ width: root.width
+ particlesPerSecond: 200
+ particleDuration: 4000
+ speed: PointVector{ y: -120; }
+ }
+ SpriteParticle{
+ system: sys
+ visible: !cloneMode
+ Sprite{
+ source: "content/particle2.png"
+ }
+ }
+ SpriteParticle{
+ system: sys
+ visible: cloneMode
+ z: 0
+ Sprite{
+ source: "content/particle3.png"
+ }
+ }
+ SpriteParticle{
+ system: sys
+ clip: true
+ visible: cloneMode
+ y: 120
+ height: 240
+ width: root.width
+ z: 1
+ Sprite{
+ source: "content/particle.png"
+ }
+ }
+}
diff --git a/examples/declarative/particles/trails/list.qml b/examples/declarative/particles/trails/list.qml
new file mode 100644
index 0000000000..2ab579f126
--- /dev/null
+++ b/examples/declarative/particles/trails/list.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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. + Particles.
+
+import QtQuick 2.0
+import Qt.labs.particles 2.0
+import "content"
+
+Rectangle {
+ width: 200; height: 300
+ color: "black"
+ ParticleSystem{ id: particles }
+ ColoredParticle{
+ anchors.fill: parent
+ system: particles
+ z: 10
+ image: "content/star.png"
+ color: "white"
+ colorVariation: 0.0
+ }
+
+ // 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: 55
+ Column {
+ Text { text: 'Name: ' + name; color: "white" }
+ Text { text: 'Type: ' + type; color: "white" }
+ Text { text: 'Age: ' + age; color: "white" }
+ }
+ // 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 {
+ width: 200; height: 50
+ color: "#333366"
+ y: listView.currentItem.y;
+ //Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
+ Behavior on y { NumberAnimation {id: anim} }
+ TrailEmitter{
+ anchors.fill: parent
+ system: particles;
+ emitting: anim.running
+ particlesPerSecond: 600
+ particleDuration: 600
+ particleSize: 16
+ particleEndSize: 8
+ }
+ }
+ }
+
+ 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
+ }
+}
diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml
new file mode 100644
index 0000000000..6ca15972a4
--- /dev/null
+++ b/examples/declarative/particles/trails/overburst.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "black"
+ width: 360
+ height: 540
+ ParticleSystem{ id: sys }
+ ColoredParticle{
+ system: sys
+ id: cp
+ image: "content/particle.png"
+ colorVariation: 0.4
+ color: "#000000FF"
+ }
+ TrailEmitter{
+ //burst on click
+ id: bursty
+ system: sys
+ emitting: ma.pressed
+ x: ma.mouseX
+ y: ma.mouseY
+ particlesPerSecond: 16000
+ particleDuration: 1000
+ maxParticles: 4000
+ acceleration: AngleVector{angleVariation: 360; magnitude: 360; }
+ particleSize: 8
+ particleEndSize: 16
+ particleSizeVariation: 4
+ }
+ MouseArea{
+ anchors.fill: parent
+ id: ma
+ }
+ MouseArea{
+ width: 100
+ height: 100
+ onClicked: sys.overwrite = !sys.overwrite
+ id: ma2
+ Rectangle{
+ anchors.fill: parent
+ color: "lightsteelblue"
+ }
+ }
+}
diff --git a/examples/declarative/particles/trails/portal.qml b/examples/declarative/particles/trails/portal.qml
new file mode 100644
index 0000000000..dba2e59513
--- /dev/null
+++ b/examples/declarative/particles/trails/portal.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ Image{
+ anchors.fill: parent
+ source: "content/portal_bg.png"
+ }
+ ParticleSystem{
+ id: particles
+ startTime: 2000
+ }
+ ColoredParticle{
+ particles: ["center","edge"]
+ anchors.fill: parent
+ system: particles
+ image: "content/particle.png"
+ colorVariation: 0.1
+ color: "#009999FF"
+ }
+ TrailEmitter{
+ anchors.fill: parent
+ particle: "center"
+ system: particles
+ particlesPerSecond: 200
+ particleDuration: 2000
+ emitting: true
+ particleSize: 20
+ particleSizeVariation: 2
+ particleEndSize: 0
+ shape: Ellipse{fill: false}
+ speed: DirectedVector{
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.5
+ }
+ }
+ TrailEmitter{
+ anchors.fill: parent
+ particle: "edge"
+ system: particles
+ particlesPerSecond: 4000
+ particleDuration: 2000
+ emitting: true
+ particleSize: 20
+ particleSizeVariation: 2
+ particleEndSize: 0
+ shape: Ellipse{fill: false}
+ speed: DirectedVector{
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ acceleration: DirectedVector{
+ targetX: root.width/2
+ targetY: root.height/2
+ targetVariation: 200
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ }
+}
diff --git a/examples/declarative/particles/trails/rainbow.qml b/examples/declarative/particles/trails/rainbow.qml
new file mode 100644
index 0000000000..6c64929668
--- /dev/null
+++ b/examples/declarative/particles/trails/rainbow.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem{ id: particles }
+ ColoredParticle{
+ system: particles
+ colorVariation: 0.5
+ alpha: 0
+
+ image: "content/particle.png"
+ colorTable: "content/colortable.png"
+ sizeTable: "content/colortable.png"
+ }
+ TrailEmitter{
+ system: particles
+ particlesPerSecond: 500
+ particleDuration: 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: PointVector{ xVariation: 5; yVariation: 5;}
+ acceleration: PointVector{ xVariation: 5; yVariation: 5;}
+
+ particleSize: 16
+ //particleEndSize: 8
+ //particleSizeVariation: 8
+ }
+}
diff --git a/examples/declarative/particles/trails/shimmer.qml b/examples/declarative/particles/trails/shimmer.qml
new file mode 100644
index 0000000000..06f599d97a
--- /dev/null
+++ b/examples/declarative/particles/trails/shimmer.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ width: 360
+ height: 540
+ color: "black"
+ MouseArea{
+ anchors.fill: parent
+ onClicked: particles.running = !particles.running
+ }
+ ParticleSystem{
+ id: particles
+ running: false
+ }
+ ColoredParticle{
+ anchors.fill: parent
+ system: particles
+ image: "content/star.png"
+ sizeTable: "content/sparkleSize.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+ TrailEmitter{
+ anchors.fill: parent
+ system: particles
+ particlesPerSecond: 2000
+ particleDuration: 2000
+ emitting: true
+ particleSize: 30
+ particleSizeVariation: 10
+ }
+}
diff --git a/examples/declarative/particles/trails/swarm.qml b/examples/declarative/particles/trails/swarm.qml
new file mode 100644
index 0000000000..083f9e816d
--- /dev/null
+++ b/examples/declarative/particles/trails/swarm.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0 as QLP
+
+Rectangle{
+ width: 200
+ height: 200
+ color: "black"
+ QLP.ParticleSystem{ id: ps }
+ QLP.ColoredParticle{
+ system: ps
+ particles: ["star1","star2"]
+ anchors.fill: parent
+ clip: true
+ image: "content/star.png"
+ }
+ QLP.Swarm{
+ system: ps
+ leaders: ["star2"];
+ anchors.fill: parent
+ strength: 128
+ }
+ QLP.TrailEmitter{
+ anchors.fill: parent
+ system: ps
+ particle: "star1"
+ particlesPerSecond: 100
+ particleDuration: 2000
+ }
+ QLP.TrailEmitter{
+ anchors.fill: parent
+ system: ps
+ particle: "star2"
+ particlesPerSecond: 0.4
+ particleDuration: 10000
+ particleSize: 64
+ particleEndSize: 32
+ }
+}
diff --git a/examples/declarative/particles/trails/trails.qml b/examples/declarative/particles/trails/trails.qml
new file mode 100644
index 0000000000..58d369c8d5
--- /dev/null
+++ b/examples/declarative/particles/trails/trails.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ color: "black"
+ width: 360
+ height: 540
+ ParticleSystem{ id: sys }
+ ColoredParticle{
+ system: sys
+ id: cp
+ image: "content/particle.png"
+ color: "#00FFFFFF"
+ colorVariation: 0.4
+ }
+ TrailEmitter{
+ //burst on click
+ id: bursty
+ system: sys
+ emitting: false
+ particlesPerSecond: 2000
+ particleDuration: 500
+ acceleration: AngleVector{ angle: 90; angleVariation: 360; magnitude: 640; }
+ particleSize: 8
+ particleEndSize: 16
+ particleSizeVariation: 4
+ }
+ TrailEmitter{
+ system: sys
+ speedFromMovement: 4.0
+ emitting: ma.pressed
+ x: ma.mouseX
+ y: ma.mouseY
+ particlesPerSecond: 400
+ particleDuration: 2000
+ acceleration: AngleVector{ angle: 90; angleVariation: 22; magnitude: 32; }
+ particleSize: 8
+ particleEndSize: 16
+ particleSizeVariation: 8
+ }
+ MouseArea{
+ id: ma
+ anchors.fill: parent
+ onPressed: {bursty.x = mouse.x; bursty.y = mouse.y; bursty.pulse(0.1);}//uses both for comparison
+ onReleased: {bursty.x = mouse.x; bursty.y = mouse.y; bursty.burst(200);}
+ }
+}
diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml
new file mode 100644
index 0000000000..7da50464c2
--- /dev/null
+++ b/examples/declarative/particles/trails/turbulence.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.particles 2.0
+
+Rectangle{
+ width: 360
+ height: 540
+ color: "#222222"
+ id: root
+ Image{
+ source: "content/candle.png"
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottomMargin: -8
+ anchors.horizontalCenterOffset: 2
+ }
+ ParticleSystem{
+ id: ps
+ }
+ Turbulence{
+ system: ps
+ height: (parent.height / 2)
+ width: parent.width / 2
+ x: parent. width / 4
+ anchors.fill: parent
+ strength: 16
+ frequency: 64
+ gridSize: 16
+ }
+ ColoredParticle{
+ particles: ["smoke"]
+ system: ps
+ image: "content/particle.png"
+ color: "#11111111"
+ colorVariation: 0
+ }
+ ColoredParticle{
+ particles: ["flame"]
+ system: ps
+ image: "content/particle.png"
+ color: "#11ff400f"
+ colorVariation: 0.1
+ }
+ TrailEmitter{
+ anchors.centerIn: parent
+ system: ps
+ particle: "flame"
+
+ particlesPerSecond: 120
+ particleDuration: 1200
+ particleSize: 20
+ particleEndSize: 10
+ particleSizeVariation: 10
+ acceleration: PointVector{ y: -40 }
+ speed: AngleVector{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ FollowEmitter{
+ id: smoke1
+ width: root.width
+ height: 232
+ system: ps
+ particle: "smoke"
+ follow: "flame"
+
+ particlesPerParticlePerSecond: 4
+ particleDuration: 2400
+ particleDurationVariation: 400
+ particleSize: 16
+ particleEndSize: 8
+ particleSizeVariation: 8
+ acceleration: PointVector{ y: -40 }
+ speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ FollowEmitter{
+ id: smoke2
+ width: root.width
+ height: 232
+ system: ps
+ particle: "smoke"
+ follow: "flame"
+
+ particlesPerParticlePerSecond: 1
+ particleDuration: 2400
+ particleSize: 36
+ particleEndSize: 24
+ particleSizeVariation: 8
+ acceleration: PointVector{ y: -40 }
+ speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+}
diff --git a/examples/declarative/particles/trails/velocityfrommotion.qml b/examples/declarative/particles/trails/velocityfrommotion.qml
new file mode 100644
index 0000000000..3692410853
--- /dev/null
+++ b/examples/declarative/particles/trails/velocityfrommotion.qml
@@ -0,0 +1,327 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 Qt.labs.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
+
+/*
+ onPressed: stopAndStart()
+ onReleased: stopAndStart()
+ function stopAndStart() {
+ trailsNormal.emitting = false;
+ trailsNormal.emitting = true;
+ trailsStars.emitting = false;
+ trailsStars.emitting = true;
+ trailsNormal2.emitting = false;
+ trailsNormal2.emitting = true;
+ trailsStars2.emitting = false;
+ trailsStars2.emitting = true;
+ print("stop and start")
+ }
+*/
+ }
+
+ ParticleSystem{ id: sys1 }
+ ColoredParticle{
+ system: sys1
+ image: "content/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
+ }
+ TrailEmitter{
+ id: trailsNormal
+ system: sys1
+
+ particlesPerSecond: 500
+ particleDuration: 2000
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointVector{xVariation: 4; yVariation: 4;}
+ acceleration: PointVector{xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ particleSize: 8
+ particleSizeVariation: 4
+ }
+ ParticleSystem { id: sys2 }
+ ColoredParticle{
+ 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
+ image: "content/star.png"
+ }
+ TrailEmitter{
+ id: trailsStars
+ system: sys2
+
+ particlesPerSecond: 100
+ particleDuration: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointVector{xVariation: 4; yVariation: 4;}
+ acceleration: PointVector{xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ particleSize: 22
+ particleSizeVariation: 4
+ }
+ ParticleSystem { id: sys3; }
+ ColoredParticle{
+ image: "content/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
+
+ }
+ TrailEmitter{
+ id: trailsNormal2
+ system: sys3
+
+ particlesPerSecond: 300
+ particleDuration: 2000
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+
+ speed: PointVector{xVariation: 4; yVariation: 4;}
+ acceleration: PointVector{xVariation: 10; yVariation: 10;}
+
+ particleSize: 12
+ particleSizeVariation: 4
+ }
+ ParticleSystem { id: sys4; }
+ ColoredParticle{
+ system: sys4
+ image: "content/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
+ }
+ TrailEmitter{
+ id: trailsStars2
+ system: sys4
+
+ particlesPerSecond: 50
+ particleDuration: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+ speed: PointVector{xVariation: 2; yVariation: 2;}
+ acceleration: PointVector{xVariation: 10; yVariation: 10;}
+
+ particleSize: 22
+ particleSizeVariation: 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; }
+ }
+ }
+
+}