aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider-example.qml4
-rw-r--r--examples/declarative/dragtarget/dragtarget.qmlproject16
-rw-r--r--examples/declarative/dragtarget/lists/listmodel.qml256
-rw-r--r--examples/declarative/dragtarget/lists/lists.qmlproject16
-rw-r--r--examples/declarative/dragtarget/text/dragtext.qml142
-rw-r--r--examples/declarative/dragtarget/text/text.qmlproject16
-rw-r--r--examples/declarative/dragtarget/tiles/DragTile.qml59
-rw-r--r--examples/declarative/dragtarget/tiles/DropTile.qml30
-rw-r--r--examples/declarative/dragtarget/tiles/tiles.qml85
-rw-r--r--examples/declarative/particles/allsmiles/plain.qml26
-rw-r--r--examples/declarative/particles/allsmiles/smile.qml100
-rw-r--r--examples/declarative/particles/allsmiles/smilefactory.qml42
-rw-r--r--examples/declarative/particles/allsmiles/spriteparticles.qml32
-rw-r--r--examples/declarative/particles/allsmiles/spritestateparticles.qml18
-rw-r--r--examples/declarative/particles/allsmiles/spritevariedparticles.qml18
-rw-r--r--examples/declarative/particles/allsmiles/ultraparticles.qml16
-rw-r--r--examples/declarative/particles/asteroid/asteroid.qml56
-rw-r--r--examples/declarative/particles/asteroid/blackhole.qml69
-rw-r--r--examples/declarative/particles/custom/blurparticles.qml165
-rw-r--r--examples/declarative/particles/custom/content/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/declarative/particles/custom/content/smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/declarative/particles/custom/fireworks.qml (renamed from examples/declarative/particles/snow/snow3.qml)86
-rw-r--r--examples/declarative/particles/custom/shader.qml84
-rw-r--r--examples/declarative/particles/exampleslauncher.qml116
-rw-r--r--examples/declarative/particles/launcherContent/Button.qml (renamed from examples/declarative/particles/trails/swarm.qml)61
-rw-r--r--examples/declarative/particles/launcherContent/Shell.qml (renamed from examples/declarative/particles/snow/snow2.qml)58
-rw-r--r--examples/declarative/particles/launcherContent/icons/asteroid.pngbin0 -> 35579 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/blackhole.pngbin0 -> 31296 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/blurparticles.pngbin0 -> 7793 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/close.pngbin0 -> 2144 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/dynamicemitters.pngbin0 -> 9347 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/fireballs.pngbin0 -> 5371 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/flickr.pngbin0 -> 10542 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/gridsplosion.pngbin0 -> 8154 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/layered.pngbin0 -> 8572 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/list.pngbin0 -> 32912 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/overburst.pngbin0 -> 1019 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/package.pngbin0 -> 3163 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/plain.pngbin0 -> 4705 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/plasmapatrol.pngbin0 -> 9839 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/portal.pngbin0 -> 11359 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/rainbow.pngbin0 -> 6538 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/remove.pngbin0 -> 2144 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/samegame.pngbin0 -> 8647 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/shimmer.pngbin0 -> 13670 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/smile.pngbin0 -> 12784 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/smilefactory.pngbin0 -> 2863 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/snow.pngbin0 -> 5858 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/spaceexplorer.pngbin0 -> 9152 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/spriteparticles.pngbin0 -> 6963 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/spritestateparticles.pngbin0 -> 2565 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/spritevariedparticles.pngbin0 -> 2569 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/stream.pngbin0 -> 26560 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/trails.pngbin0 -> 23168 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/turbulence.pngbin0 -> 9684 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/ultraparticles.pngbin0 -> 9590 bytes
-rw-r--r--examples/declarative/particles/launcherContent/icons/velocityfrommotion.pngbin0 -> 36360 bytes
-rw-r--r--examples/declarative/particles/launcherContent/launcher.js8
-rw-r--r--examples/declarative/particles/modelparticles/bubbles.qml17
-rw-r--r--examples/declarative/particles/modelparticles/gridsplosion.qml24
-rw-r--r--examples/declarative/particles/modelparticles/package.qml12
-rw-r--r--examples/declarative/particles/modelparticles/stream.qml54
-rw-r--r--examples/declarative/particles/snow/snow.qml43
-rw-r--r--examples/declarative/particles/spaceexplorer/spaceexplorer.qml93
-rw-r--r--examples/declarative/particles/trails/dynamicemitters.qml34
-rw-r--r--examples/declarative/particles/trails/fireballs.qml90
-rw-r--r--examples/declarative/particles/trails/layered.qml28
-rw-r--r--examples/declarative/particles/trails/list.qml16
-rw-r--r--examples/declarative/particles/trails/overburst.qml22
-rw-r--r--examples/declarative/particles/trails/portal.qml40
-rw-r--r--examples/declarative/particles/trails/rainbow.qml22
-rw-r--r--examples/declarative/particles/trails/shimmer.qml16
-rw-r--r--examples/declarative/particles/trails/trails.qml34
-rw-r--r--examples/declarative/particles/trails/turbulence.qml56
-rw-r--r--examples/declarative/particles/trails/velocityfrommotion.qml74
-rw-r--r--examples/declarative/toys/dynamicscene/dynamicscene.qml10
-rw-r--r--examples/declarative/toys/dynamicscene/qml/Sun.qml2
-rw-r--r--examples/declarative/ui-components/flipable/content/Card.qml2
-rw-r--r--examples/declarative/ui-components/flipable/flipable.qml4
79 files changed, 1698 insertions, 574 deletions
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
index e25b420025..f8f7b0ee55 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
@@ -42,8 +42,8 @@ import "ImageProviderCore" // import the plugin that registers the color image p
//![0]
Column {
- Image { source: "image://colors/yellow" }
- Image { source: "image://colors/red" }
+ Image { source: "source://colors/yellow" }
+ Image { source: "source://colors/red" }
}
//![0]
diff --git a/examples/declarative/dragtarget/dragtarget.qmlproject b/examples/declarative/dragtarget/dragtarget.qmlproject
new file mode 100644
index 0000000000..d4909f8685
--- /dev/null
+++ b/examples/declarative/dragtarget/dragtarget.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/dragtarget/lists/listmodel.qml b/examples/declarative/dragtarget/lists/listmodel.qml
new file mode 100644
index 0000000000..50b1d397c7
--- /dev/null
+++ b/examples/declarative/dragtarget/lists/listmodel.qml
@@ -0,0 +1,256 @@
+import QtQuick 2.0
+
+
+Rectangle {
+ id: root
+ color: "grey"
+
+ width: 720
+ height: 380
+
+ Component {
+ id: draggedText
+ Text {
+ x: rootTarget.dragX - 10
+ y: rootTarget.dragY - 10
+ width: 20
+ height: 20
+
+ text: rootTarget.dragData.display
+ font.pixelSize: 18
+ }
+ }
+
+ DragTarget {
+ id: rootTarget
+
+ anchors.fill: parent
+ }
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: rootTarget.containsDrag ? draggedText : undefined
+ }
+
+ GridView {
+ id: gridView
+
+ width: 240
+ height: 360
+
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 10
+
+ cellWidth: 60
+ cellHeight: 60
+
+ model: ListModel {
+ id: gridModel
+
+ ListElement { display: "1" }
+ ListElement { display: "2" }
+ ListElement { display: "3" }
+ ListElement { display: "4" }
+ ListElement { display: "5" }
+ ListElement { display: "6" }
+ ListElement { display: "7" }
+ ListElement { display: "8" }
+ ListElement { display: "9" }
+ ListElement { display: "10" }
+ ListElement { display: "11" }
+ ListElement { display: "12" }
+ ListElement { display: "13" }
+ ListElement { display: "14" }
+ ListElement { display: "15" }
+ ListElement { display: "16" }
+ ListElement { display: "17" }
+ ListElement { display: "18" }
+ ListElement { display: "19" }
+ ListElement { display: "20" }
+ ListElement { display: "21" }
+ ListElement { display: "22" }
+ ListElement { display: "23" }
+ ListElement { display: "24" }
+ }
+
+ delegate: Rectangle {
+ id: root
+
+ width: 60
+ height: 60
+
+ color: "black"
+
+ Text {
+ anchors.fill: parent
+ color: draggable.drag.active ? "gold" : "white"
+ text: display
+ font.pixelSize: 16
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ MouseArea {
+ id: draggable
+
+ property int initialIndex
+
+ width: 60
+ height: 60
+
+ drag.data: model
+ drag.keys: ["grid"]
+ drag.target: draggable
+
+ states: State {
+ when: !draggable.drag.active
+ PropertyChanges { target: draggable; x: 0; y: 0 }
+ }
+ }
+ }
+
+ DragTarget {
+ anchors.fill: parent
+
+ keys: [ "grid" ]
+ onPositionChanged: {
+ var index = gridView.indexAt(drag.x, drag.y)
+ if (index != -1)
+ gridModel.move(drag.data.index, index, 1)
+ }
+ }
+
+ DragTarget {
+ property int dragIndex
+ anchors.fill: parent
+
+ keys: [ "list" ]
+ onEntered: {
+ dragIndex = gridView.indexAt(drag.x, drag.y)
+ if (dragIndex != -1) {
+ gridModel.insert(dragIndex, { "display": drag.data.display })
+ } else {
+ event.accepted = false
+ }
+ }
+ onPositionChanged: {
+ var index = gridView.indexAt(drag.x, drag.y);
+ if (index != -1) {
+ gridModel.move(dragIndex, index, 1)
+ dragIndex = index
+ }
+ }
+ onExited: gridModel.remove(dragIndex, 1)
+ }
+ }
+
+ ListView {
+ id: listView
+
+ width: 240
+ height: 360
+
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 10
+
+ model: ListModel {
+ id: listModel
+
+ ListElement { display: "a" }
+ ListElement { display: "b" }
+ ListElement { display: "c" }
+ ListElement { display: "d"}
+ ListElement { display: "e" }
+ ListElement { display: "f" }
+ ListElement { display: "g" }
+ ListElement { display: "h" }
+ ListElement { display: "i" }
+ ListElement { display: "j" }
+ ListElement { display: "k" }
+ ListElement { display: "l" }
+ ListElement { display: "m" }
+ ListElement { display: "n" }
+ ListElement { display: "o" }
+ ListElement { display: "p" }
+ ListElement { display: "q" }
+ ListElement { display: "r" }
+ ListElement { display: "s" }
+ ListElement { display: "t" }
+ ListElement { display: "u" }
+ ListElement { display: "v" }
+ ListElement { display: "w" }
+ ListElement { display: "x" }
+ }
+
+ delegate: Rectangle {
+ id: root
+
+ width: 240
+ height: 15
+
+ color: "black"
+
+ Text {
+ anchors.fill: parent
+ color: draggable.drag.active ? "gold" : "white"
+ text: display
+ font.pixelSize: 12
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ MouseArea {
+ id: draggable
+
+ width: 240
+ height: 15
+
+ drag.data: model
+ drag.keys: ["list"]
+ drag.target: draggable
+
+ states: State {
+ when: !draggable.drag.active
+ PropertyChanges { target: draggable; x: 0; y: 0 }
+ }
+ }
+ }
+
+ DragTarget {
+ anchors.fill: parent
+
+ keys: [ "list" ]
+ onPositionChanged: {
+ var index = listView.indexAt(drag.x, drag.y)
+ if (index != -1)
+ listModel.move(drag.data.index, index, 1)
+ }
+ }
+
+ DragTarget {
+ property int dragIndex
+ anchors.fill: parent
+
+ keys: [ "grid" ]
+
+ onEntered: {
+ dragIndex = listView.indexAt(drag.x, drag.y)
+ if (dragIndex != -1) {
+ listModel.insert(dragIndex, { "display": drag.data.display })
+ } else {
+ event.accepted = false
+ }
+ }
+ onPositionChanged: {
+ var index = listView.indexAt(drag.x, drag.y);
+ if (index != -1) {
+ listModel.move(dragIndex, index, 1)
+ dragIndex = index
+ }
+ }
+ onExited: listModel.remove(dragIndex, 1)
+ }
+ }
+}
diff --git a/examples/declarative/dragtarget/lists/lists.qmlproject b/examples/declarative/dragtarget/lists/lists.qmlproject
new file mode 100644
index 0000000000..d4909f8685
--- /dev/null
+++ b/examples/declarative/dragtarget/lists/lists.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/dragtarget/text/dragtext.qml b/examples/declarative/dragtarget/text/dragtext.qml
new file mode 100644
index 0000000000..c4a4f24f74
--- /dev/null
+++ b/examples/declarative/dragtarget/text/dragtext.qml
@@ -0,0 +1,142 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 320; height: 480
+
+ Rectangle {
+ id: inputRect
+ anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
+ anchors.margins: 2
+ height: input.implicitHeight + 4
+
+ border.width: 1
+
+ TextInput {
+ id: input
+ anchors.fill: parent; anchors.margins: 2
+
+ text: "the quick brown fox jumped over the lazy dog"
+
+ DragTarget {
+ id: inputTarget
+
+ anchors.fill: parent
+
+ Component {
+ id: draggedInputText
+ Text {
+ x: inputTarget.dragX
+ y: inputTarget.dragY
+ text: inputTarget.dragData
+ color: "blue"
+ font: input.font
+ }
+ }
+
+ Loader {
+ sourceComponent: parent.containsDrag ? draggedInputText : undefined
+ }
+ }
+
+
+ MouseArea {
+ id: inputDraggable
+
+ anchors.fill: parent
+ enabled: input.selectionStart != input.selectionEnd
+
+ drag.data: input.selectedText
+ drag.target: inputDraggable
+
+ drag.onDragged: {
+ var position = input.positionAt(mouse.x);
+ mouse.accepted = position >= input.selectionStart && position < input.selectionEnd
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onPressed: {
+ var position = input.positionAt(mouse.x);
+ if (position < input.selectionStart || position >= input.selectionEnd) {
+ input.cursorPosition = position
+ } else {
+ mouse.accepted = false
+ }
+ }
+ onPositionChanged: input.moveCursorSelection(input.positionAt(mouse.x))
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ id: editRect
+ anchors.left: parent.left; anchors.right: parent.right;
+ anchors.top: inputRect.bottom; anchors.bottom: parent.bottom
+ anchors.margins: 2
+
+ border.width: 1
+
+ TextEdit {
+ id: edit
+ anchors.fill: parent; anchors.margins: 2
+
+ text: "the quick brown fox jumped over the lazy dog"
+ font.pixelSize: 18
+ wrapMode: TextEdit.WordWrap
+
+ DragTarget {
+ id: editTarget
+
+ anchors.fill: parent
+
+
+ Component {
+ id: draggedEditText
+ Text {
+ x: editTarget.dragX
+ y: editTarget.dragY
+ text: editTarget.dragData
+ color: "red"
+ font: edit.font
+ }
+ }
+
+ Loader {
+ sourceComponent: parent.containsDrag ? draggedEditText : undefined
+ }
+ }
+
+ MouseArea {
+ id: editDraggable
+
+ anchors.fill: parent
+ enabled: edit.selectionStart != edit.selectionEnd
+
+ drag.data: edit.selectedText
+ drag.target: editDraggable
+
+ drag.onDragged: {
+ var position = edit.positionAt(mouse.x, mouse.y);
+ mouse.accepted = position >= edit.selectionStart && position < edit.selectionEnd
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onPressed: {
+ var position = edit.positionAt(mouse.x, mouse.y);
+ if (position < edit.selectionStart || position >= edit.selectionEnd) {
+ edit.cursorPosition = position
+ } else {
+ mouse.accepted = false
+ }
+ }
+ onPositionChanged: edit.moveCursorSelection(edit.positionAt(mouse.x, mouse.y))
+ }
+ }
+ }
+ }
+}
diff --git a/examples/declarative/dragtarget/text/text.qmlproject b/examples/declarative/dragtarget/text/text.qmlproject
new file mode 100644
index 0000000000..d4909f8685
--- /dev/null
+++ b/examples/declarative/dragtarget/text/text.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/dragtarget/tiles/DragTile.qml b/examples/declarative/dragtarget/tiles/DragTile.qml
new file mode 100644
index 0000000000..213373a392
--- /dev/null
+++ b/examples/declarative/dragtarget/tiles/DragTile.qml
@@ -0,0 +1,59 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: dragRectangle
+
+ property Item dropTarget
+
+ property string colorKey
+
+ color: colorKey
+
+ width: 100; height: 100
+
+ Text {
+ anchors.fill: parent
+ color: "white"
+ font.pixelSize: 90
+ text: modelData + 1
+ horizontalAlignment:Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ MouseArea {
+ id: draggable
+
+ anchors.fill: parent
+
+ drag.target: parent
+ drag.keys: [ colorKey ]
+
+ drag.onDropped: dropTarget = dropItem
+
+ states: [
+ State {
+ when: dragRectangle.dropTarget != undefined && !draggable.drag.active
+ ParentChange {
+ target: dragRectangle
+ parent: dropTarget
+ x: 0
+ y: 0
+ }
+ },
+ State {
+ when: dragRectangle.dropTarget != undefined && draggable.drag.active
+ ParentChange {
+ target: dragRectangle
+ parent: dropTarget
+ }
+ },
+ State {
+ when: !draggable.drag.active
+ AnchorChanges {
+ target: dragRectangle
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/declarative/dragtarget/tiles/DropTile.qml b/examples/declarative/dragtarget/tiles/DropTile.qml
new file mode 100644
index 0000000000..9d968753db
--- /dev/null
+++ b/examples/declarative/dragtarget/tiles/DropTile.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: dropRectangle
+
+ property string colorKey
+
+ color: colorKey
+
+ width: 100; height: 100
+
+ DragTarget {
+ id: dragTarget
+
+ anchors.fill: parent
+
+ keys: [ colorKey ]
+ dropItem: dropRectangle
+ }
+
+ states: [
+ State {
+ when: dragTarget.containsDrag
+ PropertyChanges {
+ target: dropRectangle
+ color: "grey"
+ }
+ }
+ ]
+}
diff --git a/examples/declarative/dragtarget/tiles/tiles.qml b/examples/declarative/dragtarget/tiles/tiles.qml
new file mode 100644
index 0000000000..d8bcb39bd2
--- /dev/null
+++ b/examples/declarative/dragtarget/tiles/tiles.qml
@@ -0,0 +1,85 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 620
+ height: 410
+
+ color: "black"
+
+ DragTarget {
+ id: resetTarget
+
+ anchors.fill: parent
+ }
+
+ Grid {
+ id: redDestination
+
+ anchors.left: redSource.right; anchors.top: parent.top;
+ anchors.margins: 5
+ width: 300
+ height: 300
+
+ opacity: 0.5
+
+ columns: 3
+
+ Repeater {
+ model: 9
+ delegate: DropTile {
+ colorKey: "red"
+ }
+ }
+ }
+
+ Grid {
+ id: blueDestination
+
+ anchors.right: blueSource.left; anchors.bottom: parent.bottom;
+ anchors.margins: 5
+ width: 300
+ height: 300
+
+ opacity: 0.5
+
+ columns: 3
+
+ Repeater {
+ model: 9
+ delegate: DropTile {
+ colorKey: "blue"
+ }
+ }
+ }
+
+ Column {
+ id: redSource
+
+ anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom
+ anchors.margins: 5
+ width: 100
+
+ Repeater {
+ model: 9
+ delegate: DragTile {
+ colorKey: "red"
+ }
+ }
+ }
+ Column {
+ id: blueSource
+
+ anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: parent.bottom
+ anchors.margins: 5
+ width: 100
+
+ Repeater {
+ model: 9
+ delegate: DragTile {
+ colorKey: "blue"
+ }
+ }
+ }
+}
diff --git a/examples/declarative/particles/allsmiles/plain.qml b/examples/declarative/particles/allsmiles/plain.qml
new file mode 100644
index 0000000000..890a5782d1
--- /dev/null
+++ b/examples/declarative/particles/allsmiles/plain.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle{
+ color: "goldenrod"
+ width: 2000
+ height: 2000
+ ParticleSystem{id: sys}
+ ImageParticle{
+ id: up
+ system: sys
+ source: "content/singlesmile.png"
+ }
+ Emitter{
+ anchors.centerIn: parent
+ system: sys
+ emitRate: 1000
+ size: 20
+ lifeSpan: 10000
+ speed: AngledDirection{angleVariation: 360; magnitudeVariation: 100;}
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: up.autoRotation = !up.autoRotation
+ }
+}
diff --git a/examples/declarative/particles/allsmiles/smile.qml b/examples/declarative/particles/allsmiles/smile.qml
index e37e8fa98e..6b122e7be5 100644
--- a/examples/declarative/particles/allsmiles/smile.qml
+++ b/examples/declarative/particles/allsmiles/smile.qml
@@ -39,35 +39,101 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
+ id: root
color: "white"
width: 310
height: 300
ParticleSystem{ id: sys }
- Picture{
+ CustomParticle{
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"
+ property real maxWidth: root.width
+ property real maxHeight: root.height
+ ShaderEffectSource{
+ id: pictureSource
+ sourceItem: picture
+ hideSource: true
+ }
+ Image{
+ id: picture
+ source: "content/singlesmile.png"
+ }
+ ShaderEffectSource{
+ id: particleSource
+ sourceItem: particle
+ hideSource: true
+ }
+ Image{
+ id: particle
+ source: "content/particle.png"
+ }
+ vertexShader:"
+ attribute highp vec2 vPos;
+ attribute highp vec2 vTex;
+ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
+ attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
+ attribute highp float r;
+
+ uniform highp float maxWidth;
+ uniform highp float maxHeight;
+
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float timestamp;
+ uniform lowp float qt_Opacity;
+
+ varying highp vec2 fTex;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+
+ void main() {
+ fTex = vTex;
+ fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight);
+ highp float size = vData.z;
+ highp float endSize = vData.w;
+
+ highp float t = (timestamp - vData.x) / vData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = vPos
+ - currentSize / 2. + currentSize * vTex // adjust size
+ + vVec.xy * t * vData.y // apply speed vector..
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.);
+
+ gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ }
+ "
+ property variant particleTexture: particleSource
+ property variant pictureTexture: pictureSource
+ fragmentShader: "
+ uniform sampler2D particleTexture;
+ uniform sampler2D pictureTexture;
+ varying highp vec2 fTex;
+ varying highp vec2 fTex2;
+ varying highp float fFade;
+ void main() {
+ gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, fTex).w * fFade;
+ }"
}
- TrailEmitter{
+ Emitter{
id: emitter
system: sys
emitting: false
- particleDuration: 4000
- maxParticles: 1200
+ lifeSpan: 4000
+ emitCap: 1200
anchors.fill: parent
- particleSize: 32
- speed: PointVector{ xVariation: 12; yVariation: 12 }
+ size: 32
+ speed: PointDirection{ xVariation: 12; yVariation: 12 }
}
MouseArea{
anchors.fill: parent
diff --git a/examples/declarative/particles/allsmiles/smilefactory.qml b/examples/declarative/particles/allsmiles/smilefactory.qml
index 47becb50fe..5b36eee3cd 100644
--- a/examples/declarative/particles/allsmiles/smilefactory.qml
+++ b/examples/declarative/particles/allsmiles/smilefactory.qml
@@ -39,27 +39,27 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "goldenrod"
width: 400
height: 400
ParticleSystem{id:sys}
- DeformableParticle{
+ ImageParticle{
system: sys
particles: ["goingLeft", "goingRight"]
- image: "content/singlesmile.png"
+ source: "content/singlesmile.png"
rotation: 90
rotationSpeed: 90
autoRotation: true
}
- DeformableParticle{
+ ImageParticle{
system: sys
particles: ["goingDown"]
- image: "content/squarefacespriteXX.png"
+ source: "content/squarefacespriteXX.png"
rotation: 180
- yVector: PointVector{ y: 0.5; yVariation: 0.25; xVariation: 0.25; }
+ yVector: PointDirection{ y: 0.5; yVariation: 0.25; xVariation: 0.25; }
}
Timer{
running: true
@@ -79,40 +79,40 @@ Rectangle{
interval: 8400
onTriggered: emitC.emitting = true;
}
- TrailEmitter{
+ Emitter{
id: emitA
x: 0
y: 120
system: sys
emitting: false
particle: "goingRight"
- speed: PointVector{ x: 100 }
- particleDuration: 4000
- particlesPerSecond: 2
- particleSize: 32
+ speed: PointDirection{ x: 100 }
+ lifeSpan: 4000
+ emitRate: 2
+ size: 32
}
- TrailEmitter{
+ Emitter{
id: emitB
x: 400
y: 240
system: sys
emitting: false
particle: "goingLeft"
- speed: PointVector{ x: -100 }
- particleDuration: 4000
- particlesPerSecond: 2
- particleSize: 32
+ speed: PointDirection{ x: -100 }
+ lifeSpan: 4000
+ emitRate: 2
+ size: 32
}
- TrailEmitter{
+ Emitter{
id: emitC
x: 0
y: 360
system: sys
emitting: false
particle: "goingDown"
- speed: PointVector{ x: 100 }
- particleDuration: 4000
- particlesPerSecond: 2
- particleSize: 32
+ speed: PointDirection{ x: 100 }
+ lifeSpan: 4000
+ emitRate: 2
+ size: 32
}
}
diff --git a/examples/declarative/particles/allsmiles/spriteparticles.qml b/examples/declarative/particles/allsmiles/spriteparticles.qml
index 4bcb7081b8..f5479f1570 100644
--- a/examples/declarative/particles/allsmiles/spriteparticles.qml
+++ b/examples/declarative/particles/allsmiles/spriteparticles.qml
@@ -39,60 +39,60 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "goldenrod"
width: 400
height: 400
- ColoredParticle{
+ ImageParticle{
id: test
particles: ["Test"]
- image: "content/particle.png"
+ source: "content/particle.png"
system: sys
z: 2
anchors.fill: parent
color: "#336666CC"
colorVariation: 0.0
}
- SpriteParticle{
+ ImageParticle{
id: single
particles: ["Face"]
system: sys
z: 2
anchors.fill: parent
- Sprite{
+ sprites: Sprite{
source: "content/squarefacesprite.png"
frames: 6
duration: 120
}
}
- Mask{
+ MaskShape{
id: mask
source: "content/smileMask.png"
}
- TrailEmitter{
+ Emitter{
system: sys
particle: "Test"
anchors.fill: parent
id: particles2
- particlesPerSecond: 6000
- particleDuration: 720
+ emitRate: 6000
+ lifeSpan: 720
emitting: true
- particleSize: 10
+ size: 10
shape: mask
}
- TrailEmitter{
+ Emitter{
system: sys
particle: "Face"
anchors.fill: parent
id: particles
- particlesPerSecond: 60
- particleDuration: 1440
+ emitRate: 60
+ lifeSpan: 1440
emitting: true
- speed: PointVector{xVariation: 10; yVariation: 10;}
- particleSize: 30
- particleSizeVariation: 10
+ speed: PointDirection{xVariation: 10; yVariation: 10;}
+ size: 30
+ sizeVariation: 10
shape: mask
}
ParticleSystem{
diff --git a/examples/declarative/particles/allsmiles/spritestateparticles.qml b/examples/declarative/particles/allsmiles/spritestateparticles.qml
index 6a61487a89..a599c69a63 100644
--- a/examples/declarative/particles/allsmiles/spritestateparticles.qml
+++ b/examples/declarative/particles/allsmiles/spritestateparticles.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "goldenrod"
@@ -109,7 +109,7 @@ Rectangle{
z:4
}
ParticleSystem{ id: sys }
- SpriteParticle{
+ ImageParticle{
anchors.fill: parent
id: particles
system: sys
@@ -168,15 +168,15 @@ Rectangle{
duration: 10000
}]
}
- TrailEmitter{
+ Emitter{
system: sys
- particlesPerSecond: 16
- particleDuration: 10000
+ emitRate: 16
+ lifeSpan: 10000
emitting: true
- speed: AngleVector{angle: 90; magnitude: 60; angleVariation: 5}
- acceleration: PointVector{ y: 10 }
- particleSize: 30
- particleSizeVariation: 10
+ speed: AngledDirection{angle: 90; magnitude: 60; angleVariation: 5}
+ acceleration: PointDirection{ y: 10 }
+ size: 30
+ sizeVariation: 10
width: parent.width
height: 100
}
diff --git a/examples/declarative/particles/allsmiles/spritevariedparticles.qml b/examples/declarative/particles/allsmiles/spritevariedparticles.qml
index c1b773093f..d6e13727ff 100644
--- a/examples/declarative/particles/allsmiles/spritevariedparticles.qml
+++ b/examples/declarative/particles/allsmiles/spritevariedparticles.qml
@@ -39,14 +39,14 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "goldenrod"
width: 800
height: 800
ParticleSystem{ id: sys }
- SpriteParticle{
+ ImageParticle{
system: sys
anchors.fill: parent
sprites: [Sprite{
@@ -92,17 +92,17 @@ Rectangle{
duration: 120
}]
}
- TrailEmitter{
+ Emitter{
id: particleEmitter
system: sys
width: parent.width
- particlesPerSecond: 16
- particleDuration: 8000
+ emitRate: 16
+ lifeSpan: 8000
emitting: true
- speed: AngleVector{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5}
- acceleration: PointVector{ y: 10 }
- particleSize: 30
- particleSizeVariation: 10
+ speed: AngledDirection{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5}
+ acceleration: PointDirection{ y: 10 }
+ size: 30
+ sizeVariation: 10
}
Binding{
target: particleEmitter
diff --git a/examples/declarative/particles/allsmiles/ultraparticles.qml b/examples/declarative/particles/allsmiles/ultraparticles.qml
index 85bbdbacd8..0ea095deb6 100644
--- a/examples/declarative/particles/allsmiles/ultraparticles.qml
+++ b/examples/declarative/particles/allsmiles/ultraparticles.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "white"
@@ -48,7 +48,7 @@ Rectangle{
ParticleSystem{
id: sys
}
- UltraParticle{
+ ImageParticle{
sprites: [
Sprite{
name: "licking"
@@ -80,16 +80,16 @@ Rectangle{
factor: 0.1
system: sys
}
- TrailEmitter{
+ Emitter{
system: sys
anchors.centerIn: parent
id: particles
- particlesPerSecond: 200
- particleDuration: 6000
+ emitRate: 200
+ lifeSpan: 6000
emitting: true
- speed: AngleVector{angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
- particleSize: 40
- particleEndSize: 80
+ speed: AngledDirection{angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
+ size: 40
+ endSize: 80
}
Text{
x: 16
diff --git a/examples/declarative/particles/asteroid/asteroid.qml b/examples/declarative/particles/asteroid/asteroid.qml
index b5b4f672c2..2ecfc42a98 100644
--- a/examples/declarative/particles/asteroid/asteroid.qml
+++ b/examples/declarative/particles/asteroid/asteroid.qml
@@ -38,8 +38,8 @@
**
****************************************************************************/
-import Qt.labs.particles 2.0
-import Qt.labs.particles 2.0 as Qlp
+import QtQuick.Particles 2.0
+import QtQuick.Particles 2.0 as Qlp
import QtQuick 2.0
Item {
@@ -65,42 +65,42 @@ Item {
}
}
- ColoredParticle {
+ ImageParticle {
system: sys
particles: ["starfield"]
- image: "content/star.png"
+ source: "content/star.png"
colorVariation: 0.3
color: "white"
}
- TrailEmitter {
+ Emitter {
id: starField
system: sys
particle: "starfield"
- particlesPerSecond: 80
- particleDuration: 2500
+ emitRate: 80
+ lifeSpan: 2500
anchors.centerIn: parent
- //acceleration: AngleVector{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed?
- acceleration: PointVector{ xVariation: 200; yVariation: 200; }
+ //acceleration: AngledDirection{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed?
+ acceleration: PointDirection{ xVariation: 200; yVariation: 200; }
- particleSize: 0
- particleEndSize: 80
- particleSizeVariation: 10
+ size: 0
+ endSize: 80
+ sizeVariation: 10
}
- TrailEmitter{
+ Emitter{
system: sys
particle: "meteor"
- particlesPerSecond: 12
- particleDuration: 5000
+ emitRate: 12
+ lifeSpan: 5000
emitting: true
- acceleration: PointVector{ xVariation: 80; yVariation: 80; }
- particleSize: 15
- particleEndSize: 300
+ acceleration: PointDirection{ xVariation: 80; yVariation: 80; }
+ size: 15
+ endSize: 300
anchors.centerIn: parent
}
- SpriteParticle{
+ ImageParticle{
system: sys
particles: ["meteor"]
sprites:[Sprite{
@@ -168,11 +168,11 @@ Item {
}
}
- ColoredParticle{
+ ImageParticle{
z:0
system: sys
particles: ["exhaust"]
- image: "content/particle4.png"
+ source: "content/particle4.png"
color: "orange"
SequentialAnimation on color {
@@ -191,23 +191,23 @@ Item {
colorVariation: 0.2
}
- TrailEmitter{
+ Emitter{
id: trailsNormal2
system: sys
particle: "exhaust"
- particlesPerSecond: 300
- particleDuration: 500
+ emitRate: 300
+ lifeSpan: 500
y: holder.y
x: holder.x
- speed: PointVector{ xVariation: 40; yVariation: 40; }
+ speed: PointDirection{ xVariation: 40; yVariation: 40; }
speedFromMovement: 16
- acceleration: PointVector{ xVariation: 10; yVariation: 10; }
+ acceleration: PointDirection{ xVariation: 10; yVariation: 10; }
- particleSize: 4
- particleSizeVariation: 4
+ size: 4
+ sizeVariation: 4
}
}
diff --git a/examples/declarative/particles/asteroid/blackhole.qml b/examples/declarative/particles/asteroid/blackhole.qml
index 68d5835880..4a7ce02538 100644
--- a/examples/declarative/particles/asteroid/blackhole.qml
+++ b/examples/declarative/particles/asteroid/blackhole.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
id: root
@@ -65,41 +65,42 @@ Rectangle{
}
}
- TrailEmitter{
+ Emitter{
particle: "stars"
system: particles
- particlesPerSecond: 40
- particleDuration: 4000
+ emitRate: 40
+ lifeSpan: 4000
emitting: true
- particleSize: 30
- particleSizeVariation: 10
- speed: PointVector{ x: 220; xVariation: 40 }
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection{ x: 220; xVariation: 40 }
height: parent.height
}
- TrailEmitter{
+ Emitter{
particle: "roids"
system: particles
- particlesPerSecond: 10
- particleDuration: 4000
+ emitRate: 10
+ lifeSpan: 4000
emitting: true
- particleSize: 30
- particleSizeVariation: 10
- speed: PointVector{ x: 220; xVariation: 40 }
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection{ x: 220; xVariation: 40 }
height: parent.height
}
ParticleSystem{
id: particles
anchors.fill: parent
}
- ColoredParticle{
+ ImageParticle{
id: stars
particles: ["stars"]
system: particles
- image: "content/star.png"
+ source: "content/star.png"
color: "white"
colorVariation: 0.1
+ alpha: 0
}
- SpriteParticle{
+ ImageParticle{
id: roids
particles: ["roids"]
system: particles
@@ -112,20 +113,20 @@ Rectangle{
speedModifiesDuration: -0.1
}
}
- ColoredParticle{
+ ImageParticle{
id: shot
particles: ["shot"]
system: particles
- image: "content/star.png"
+ source: "content/star.png"
color: "#0FF06600"
colorVariation: 0.3
}
- ColoredParticle{
+ ImageParticle{
id: engine
particles: ["engine"]
system: particles
- image: "content/particle4.png"
+ source: "content/particle4.png"
color: "orange"
SequentialAnimation on color {
@@ -144,9 +145,11 @@ Rectangle{
colorVariation: 0.2
}
- GravitationalSingularity{
+ PointAttractor{
id: gs; x: root.width/2; y: root.height/2; strength: 4000000;
system: particles
+ physics: PointAttractor.Acceleration
+ proportionalToDistance: PointAttractor.Quadratic
}
Kill{
system: particles
@@ -166,27 +169,27 @@ Rectangle{
drag.axis: Drag.XandYAxis
drag.target: ship
}
- TrailEmitter{
+ Emitter{
particle: "engine"
system: particles
- particlesPerSecond: 200
- particleDuration: 1000
+ emitRate: 200
+ lifeSpan: 1000
emitting: true
- particleSize: 10
- particleEndSize: 4
- particleSizeVariation: 4
- speed: PointVector{ x: -128; xVariation: 32 }
+ size: 10
+ endSize: 4
+ sizeVariation: 4
+ speed: PointDirection{ x: -128; xVariation: 32 }
height: parent.height
width: 20
}
- TrailEmitter{
+ Emitter{
particle: "shot"
system: particles
- particlesPerSecond: 32
- particleDuration: 2000
+ emitRate: 32
+ lifeSpan: 2000
emitting: spacePressed
- particleSize: 40
- speed: PointVector{ x: 256; }
+ size: 40
+ speed: PointDirection{ x: 256; }
x: parent.width
y: parent.height/2
}
diff --git a/examples/declarative/particles/custom/blurparticles.qml b/examples/declarative/particles/custom/blurparticles.qml
new file mode 100644
index 0000000000..15da9ba9db
--- /dev/null
+++ b/examples/declarative/particles/custom/blurparticles.qml
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** 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 QtQuick.Particles 2.0
+
+Rectangle{
+ color: "white"
+ width: 240
+ height: 360
+ ParticleSystem{
+ id: sys
+ }
+ Emitter{
+ system:sys
+ height: parent.height
+ emitRate: 1
+ lifeSpan: 12000
+ speed: PointDirection{x:20;}
+ size: 64
+ }
+ ShaderEffectSource{
+ id: theSource
+ sourceItem: theItem
+ hideSource: true
+ }
+ Image{
+ id: theItem
+ source: "content/smile.png"
+ }
+
+ CustomParticle{
+ system: sys
+ //TODO: Someway that you don't have to rewrite the basics for a simple addition
+ vertexShader:"
+ attribute highp vec2 vPos;
+ attribute highp vec2 vTex;
+ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
+ attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
+ attribute highp float r;
+
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float timestamp;
+ uniform lowp float qt_Opacity;
+
+ varying highp vec2 fTex;
+ varying lowp float fFade;
+ varying lowp float fBlur;
+
+ void main() {
+ fTex = vTex;
+ highp float size = vData.z;
+ highp float endSize = vData.w;
+
+ highp float t = (timestamp - vData.x) / vData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = vPos
+ - currentSize / 2. + currentSize * vTex // adjust size
+ + vVec.xy * t * vData.y // apply speed vector..
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.);
+
+ gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fBlur = max(0.2 * t, t * r);
+ }
+ "
+ property variant source: theSource
+ property variant blurred: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffectItem {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffectItem {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta);
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta);
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform sampler2D blurred;
+ varying highp vec2 fTex;
+ varying highp float fBlur;
+ varying highp float fFade;
+ void main() {
+ gl_FragColor = mix(texture2D(source, fTex), texture2D(blurred, fTex), min(1.0,fBlur*3.0)) * fFade;
+ }"
+
+ }
+}
+
diff --git a/examples/declarative/particles/custom/content/particle.png b/examples/declarative/particles/custom/content/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/declarative/particles/custom/content/particle.png
Binary files differ
diff --git a/examples/declarative/particles/custom/content/smile.png b/examples/declarative/particles/custom/content/smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/declarative/particles/custom/content/smile.png
Binary files differ
diff --git a/examples/declarative/particles/snow/snow3.qml b/examples/declarative/particles/custom/fireworks.qml
index 080bc4d1af..b73a5e234f 100644
--- a/examples/declarative/particles/snow/snow3.qml
+++ b/examples/declarative/particles/custom/fireworks.qml
@@ -39,42 +39,66 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.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
+ height: 600
+ color: "black"
+ Component{
+ id: firework
+ Item{
+ id: container
+ width: 48
+ height: 48
+ Image{
+ width: 48
+ height: 48
+ id: img
+ source: "content/particle.png"
+ }
+ Timer{
+ interval: 1000 + 4000*Math.random()
+ running: true
+ repeat: false
+ onTriggered: {
+ img.visible = false;
+ emitter.burst(100);
+ }
+ }
+ Emitter{
+ anchors.centerIn: parent
+ id: emitter
+ system: syssy
+ particle: "works"
+ emitting: false
+ emitRate: 100
+ lifeSpan: 1000
+ //speed: AngledDirection{angle: 270; angleVariation:60; magnitudeVariation: 60; magnitude: 20}
+ speed: PointDirection{y:-60; yVariation: 80; xVariation: 80}
+ acceleration: PointDirection{y:100; yVariation: 20}
+ }
}
}
- Drift{
- system: particles
+ ParticleSystem{
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
+ id: syssy
+ Emitter{
+ particle: "fire"
+ width: parent.width
+ y: parent.height
+ emitRate: 2
+ lifeSpan: 6000
+ speed: PointDirection{y:-100}
+ }
+ ItemParticle{
+ particles: ["fire"]
+ delegate: firework
+ }
+ ImageParticle{
+ particles: ["works"]
+ source: "content/particle.png"
+ }
}
}
+
diff --git a/examples/declarative/particles/custom/shader.qml b/examples/declarative/particles/custom/shader.qml
new file mode 100644
index 0000000000..d83e7864c4
--- /dev/null
+++ b/examples/declarative/particles/custom/shader.qml
@@ -0,0 +1,84 @@
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem{
+ id: root
+ width: 1024
+ height: 768
+ Rectangle{
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ Text{
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 36
+ color: "white"
+ text: "It's all in the fragment shader."
+ }
+ }
+ Emitter{
+ emitRate: 400
+ lifeSpan: 8000
+ size: 24
+ sizeVariation: 16
+ speed: PointDirection{x: root.width/10; y: root.height/10;}
+ //acceleration: AngledDirection{angle:225; magnitude: root.width/36; angleVariation: 45; magnitudeVariation: 80}
+ acceleration: PointDirection{x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20}
+ }
+ CustomParticle{
+ //TODO: Someway that you don't have to rewrite the basics for a simple addition
+ vertexShader:"
+ attribute highp vec2 vPos;
+ attribute highp vec2 vTex;
+ attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize
+ attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration
+ attribute highp float r;
+
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float timestamp;
+ uniform lowp float qt_Opacity;
+
+ varying highp vec2 fTex;
+ varying lowp float fFade;
+ varying highp vec2 fPos;
+
+ void main() {
+ fTex = vTex;
+ highp float size = vData.z;
+ highp float endSize = vData.w;
+
+ highp float t = (timestamp - vData.x) / vData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = vPos
+ - currentSize / 2. + currentSize * vTex // adjust size
+ + vVec.xy * t * vData.y // apply speed vector..
+ + 0.5 * vVec.zw * pow(t * vData.y, 2.);
+
+ gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 20., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fPos = vec2(pos.x/1024., pos.y/768.);
+ }
+ "
+ fragmentShader: "
+ varying highp vec2 fPos;
+ varying lowp float fFade;
+ varying highp vec2 fTex;
+ void main() {//*2 because this generates dark colors mostly
+ highp vec2 circlePos = fTex*2.0 - vec2(1.0,1.0);
+ highp float dist = length(circlePos);
+ highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0);
+ gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade;
+ }"
+
+ }
+}
diff --git a/examples/declarative/particles/exampleslauncher.qml b/examples/declarative/particles/exampleslauncher.qml
new file mode 100644
index 0000000000..354bcdf65a
--- /dev/null
+++ b/examples/declarative/particles/exampleslauncher.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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 QtQuick.Particles 2.0
+import "launcherContent/launcher.js" as Util
+import "launcherContent"
+
+Rectangle{
+ color: "black"
+ width: 360
+ height: 600
+ Shell{
+ z: 1
+ id: shell
+ anchors.fill: parent
+ }
+ VisualDataModel{//TODO: Transitions between modes
+ id: vdm
+ model: [
+ "../spaceexplorer/spaceexplorer.qml",
+ "../snow/snow.qml",
+ "../asteroid/asteroid.qml",
+ "../asteroid/blackhole.qml",
+ "../custom/blurparticles.qml",
+ "../modelparticles/bubbles.qml",
+ "../modelparticles/gridsplosion.qml",
+ "../modelparticles/package.qml",
+ "../modelparticles/stream.qml",
+ "../allsmiles/plain.qml",
+ "../allsmiles/smile.qml",
+ "../allsmiles/smilefactory.qml",
+ "../allsmiles/ultraparticles.qml",
+ "../allsmiles/spriteparticles.qml",
+ "../allsmiles/spritestateparticles.qml",
+ "../allsmiles/spritevariedparticles.qml",
+ "../trails/velocityfrommotion.qml",
+ "../trails/fireballs.qml",
+ "../trails/list.qml",
+ "../trails/portal.qml",
+ "../trails/rainbow.qml",
+ "../trails/dynamicemitters.qml",
+ "../trails/overburst.qml",
+ "../trails/layered.qml",
+ "../trails/shimmer.qml",
+ "../trails/turbulence.qml",
+ "../../../../demos/declarative/samegame/samegame.qml",
+ "../../../../demos/declarative/plasmapatrol/plasmapatrol.qml",
+ "../../../../demos/declarative/flickr/flickr.qml"
+ ]
+ delegate: Rectangle{
+ color: "white"
+ width: 96
+ height: 96
+ Image{
+ width: 72
+ height: 72
+ anchors.centerIn: parent
+ source: Util.iconFromPath(modelData)
+ }
+ Text{
+ text: Util.nameFromPath(modelData)
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 8
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: shell.setDemo(modelData)
+ }
+ }
+ }
+ GridView{
+ anchors.fill: parent
+ cellWidth: 120
+ cellHeight: 120
+ model: vdm
+ }
+}
diff --git a/examples/declarative/particles/trails/swarm.qml b/examples/declarative/particles/launcherContent/Button.qml
index 083f9e816d..a937b3bede 100644
--- a/examples/declarative/particles/trails/swarm.qml
+++ b/examples/declarative/particles/launcherContent/Button.qml
@@ -39,40 +39,35 @@
****************************************************************************/
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
+Rectangle {
+ id: container
+
+ property string text: "Button"
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 20
+ smooth: true
+ property color myCol: "#999999"
+ border { width: 1; color: Qt.darker(myCol) }
+ radius: 8
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return Qt.darker(myCol)
+ else
+ return Qt.lighter(myCol)
+ }
+ }
+ GradientStop { position: 1.0; color: myCol }
}
- QLP.TrailEmitter{
- anchors.fill: parent
- system: ps
- particle: "star2"
- particlesPerSecond: 0.4
- particleDuration: 10000
- particleSize: 64
- particleEndSize: 32
+
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: buttonLabel; text: container.text; anchors.centerIn: container; color: "black"; font.pixelSize: 24
}
}
diff --git a/examples/declarative/particles/snow/snow2.qml b/examples/declarative/particles/launcherContent/Shell.qml
index c016ba2934..32b0cd624c 100644
--- a/examples/declarative/particles/snow/snow2.qml
+++ b/examples/declarative/particles/launcherContent/Shell.qml
@@ -39,36 +39,40 @@
****************************************************************************/
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
+Loader{
+ id: ldr
+ visible: false
+ focus: visible
+ onVisibleChanged: source = ""
+ opacity: visible?1:0
+ Behavior on opacity{NumberAnimation{}}
+
+ function setDemo(str){
+ visible = true;
+ source = str;
+ }
+ Image{//TODO: Augment with PARTICLES
+ z: 1
+ source: "icons/close.png"
+ MouseArea{
+ anchors.fill: parent
+ onClicked: ldr.visible = false;
}
}
- Drift{
- system: particles
+ Rectangle{
+ z: -1
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
+ color:"black"
+ Text{
+ color: "white"
+ anchors.centerIn: parent
+ text: ldr.Status == Loader.Error ? "Error :(" : "Loading..."
+ }
+ MouseArea{
+ id: graball
+ anchors.fill: parent
+ onClicked:;
+ }
}
}
diff --git a/examples/declarative/particles/launcherContent/icons/asteroid.png b/examples/declarative/particles/launcherContent/icons/asteroid.png
new file mode 100644
index 0000000000..77480c6f09
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/asteroid.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/blackhole.png b/examples/declarative/particles/launcherContent/icons/blackhole.png
new file mode 100644
index 0000000000..4bd8040c3b
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/blackhole.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/blurparticles.png b/examples/declarative/particles/launcherContent/icons/blurparticles.png
new file mode 100644
index 0000000000..7a247ae46e
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/blurparticles.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/close.png b/examples/declarative/particles/launcherContent/icons/close.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/close.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/dynamicemitters.png b/examples/declarative/particles/launcherContent/icons/dynamicemitters.png
new file mode 100644
index 0000000000..0cdef9d21e
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/dynamicemitters.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/fireballs.png b/examples/declarative/particles/launcherContent/icons/fireballs.png
new file mode 100644
index 0000000000..39acf8b40d
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/fireballs.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/flickr.png b/examples/declarative/particles/launcherContent/icons/flickr.png
new file mode 100644
index 0000000000..4de2650280
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/flickr.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/gridsplosion.png b/examples/declarative/particles/launcherContent/icons/gridsplosion.png
new file mode 100644
index 0000000000..ec75453df6
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/gridsplosion.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/layered.png b/examples/declarative/particles/launcherContent/icons/layered.png
new file mode 100644
index 0000000000..a28e3c4f02
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/layered.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/list.png b/examples/declarative/particles/launcherContent/icons/list.png
new file mode 100644
index 0000000000..bc13263cff
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/list.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/overburst.png b/examples/declarative/particles/launcherContent/icons/overburst.png
new file mode 100644
index 0000000000..4ef0435991
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/overburst.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/package.png b/examples/declarative/particles/launcherContent/icons/package.png
new file mode 100644
index 0000000000..eba8951c26
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/package.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/plain.png b/examples/declarative/particles/launcherContent/icons/plain.png
new file mode 100644
index 0000000000..dd51498514
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/plain.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/plasmapatrol.png b/examples/declarative/particles/launcherContent/icons/plasmapatrol.png
new file mode 100644
index 0000000000..fda852b420
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/plasmapatrol.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/portal.png b/examples/declarative/particles/launcherContent/icons/portal.png
new file mode 100644
index 0000000000..9c1f910d0c
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/portal.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/rainbow.png b/examples/declarative/particles/launcherContent/icons/rainbow.png
new file mode 100644
index 0000000000..8841ea30f9
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/rainbow.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/remove.png b/examples/declarative/particles/launcherContent/icons/remove.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/remove.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/samegame.png b/examples/declarative/particles/launcherContent/icons/samegame.png
new file mode 100644
index 0000000000..d00698264b
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/samegame.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/shimmer.png b/examples/declarative/particles/launcherContent/icons/shimmer.png
new file mode 100644
index 0000000000..0ff53196a6
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/shimmer.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/smile.png b/examples/declarative/particles/launcherContent/icons/smile.png
new file mode 100644
index 0000000000..f990e6c03e
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/smile.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/smilefactory.png b/examples/declarative/particles/launcherContent/icons/smilefactory.png
new file mode 100644
index 0000000000..78ea52790f
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/smilefactory.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/snow.png b/examples/declarative/particles/launcherContent/icons/snow.png
new file mode 100644
index 0000000000..d98e14b8ae
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/snow.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/spaceexplorer.png b/examples/declarative/particles/launcherContent/icons/spaceexplorer.png
new file mode 100644
index 0000000000..770584a0fa
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/spaceexplorer.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/spriteparticles.png b/examples/declarative/particles/launcherContent/icons/spriteparticles.png
new file mode 100644
index 0000000000..5603964939
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/spriteparticles.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/spritestateparticles.png b/examples/declarative/particles/launcherContent/icons/spritestateparticles.png
new file mode 100644
index 0000000000..dd01518ac4
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/spritestateparticles.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/spritevariedparticles.png b/examples/declarative/particles/launcherContent/icons/spritevariedparticles.png
new file mode 100644
index 0000000000..495bb6beee
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/spritevariedparticles.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/stream.png b/examples/declarative/particles/launcherContent/icons/stream.png
new file mode 100644
index 0000000000..a74f9a0340
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/stream.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/trails.png b/examples/declarative/particles/launcherContent/icons/trails.png
new file mode 100644
index 0000000000..0337ebcfd8
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/trails.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/turbulence.png b/examples/declarative/particles/launcherContent/icons/turbulence.png
new file mode 100644
index 0000000000..2b9446ea90
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/turbulence.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/ultraparticles.png b/examples/declarative/particles/launcherContent/icons/ultraparticles.png
new file mode 100644
index 0000000000..0d87eea427
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/ultraparticles.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/icons/velocityfrommotion.png b/examples/declarative/particles/launcherContent/icons/velocityfrommotion.png
new file mode 100644
index 0000000000..79baa08293
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/icons/velocityfrommotion.png
Binary files differ
diff --git a/examples/declarative/particles/launcherContent/launcher.js b/examples/declarative/particles/launcherContent/launcher.js
new file mode 100644
index 0000000000..e4fedd30d7
--- /dev/null
+++ b/examples/declarative/particles/launcherContent/launcher.js
@@ -0,0 +1,8 @@
+function nameFromPath(path){
+ var ret = path.split('/');
+ return ret[ret.length-1].split('.')[0];
+}
+function iconFromPath(path){
+ var ret = path.split('/');
+ return "launcherContent/icons/" + ret[ret.length-1].split('.')[0] + ".png";
+}
diff --git a/examples/declarative/particles/modelparticles/bubbles.qml b/examples/declarative/particles/modelparticles/bubbles.qml
index 80d03a9ea7..23f0b82d01 100644
--- a/examples/declarative/particles/modelparticles/bubbles.qml
+++ b/examples/declarative/particles/modelparticles/bubbles.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "../../modelviews/listview/content" as OtherDemo
import "content/script.js" as Script
import "content"
@@ -56,21 +56,22 @@ Item{
ParticleSystem{
id: sys;
}
- TrailEmitter{
+ Emitter{
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
+ speed: PointDirection{ y: -64; yVariation: 16 }
+ emitRate: 1
+ lifeSpan: 8000
}
- Drift{
+ Wander{
system: sys
- xDrift: 200
+ xVariance: 400
+ pace: 200
}
- DataParticle{
+ ModelParticle{
id: mp
z: 0
system: sys
diff --git a/examples/declarative/particles/modelparticles/gridsplosion.qml b/examples/declarative/particles/modelparticles/gridsplosion.qml
index d45ef392e0..db860125e5 100644
--- a/examples/declarative/particles/modelparticles/gridsplosion.qml
+++ b/examples/declarative/particles/modelparticles/gridsplosion.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "content"
Item{
@@ -48,13 +48,14 @@ Item{
height: 240
property bool inGrid: false
ParticleSystem{ id: sys }
- TrailEmitter{
+ Emitter{
system: sys
id: burster;
emitting: false
- particlesPerSecond: 1000
- particleDuration: 500
- speed: PointVector{xVariation: 400; yVariation: 400}
+ emitRate: 1000
+ lifeSpan: 50000
+ emitCap: 100;
+ speed: PointDirection{xVariation: 400; yVariation: 400}
anchors.centerIn: parent
Timer{
interval: 1000
@@ -69,9 +70,9 @@ Item{
onTriggered: {inGrid = true;}// sys.running = false;}
}
}
- ColoredParticle{
+ ImageParticle{
system: sys
- image: "../trails/content/particle.png"
+ source: "../trails/content/particle.png"
color: "black"
colorVariation: 0.0
}
@@ -80,17 +81,14 @@ Item{
width: 120
height: 120
}
- DataParticle{
+ ModelParticle{
system: sys
model: theModel.parts.particles
+ fade: false
}
Friction{
system: sys
- factor: 1
- }
- Stasis{
- system: sys
- targetLife: 400
+ factor: 5
}
VisualDataModel{
id: theModel
diff --git a/examples/declarative/particles/modelparticles/package.qml b/examples/declarative/particles/modelparticles/package.qml
index d5c104b480..0aa8903270 100644
--- a/examples/declarative/particles/modelparticles/package.qml
+++ b/examples/declarative/particles/modelparticles/package.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "content"
Rectangle {
@@ -69,7 +69,7 @@ Rectangle {
width: 200; height:200
model: visualModel.parts.list
}
- DataParticle{
+ ModelParticle{
x: 200; width: 200; height:200
model: visualModel.parts.grid
system: sys
@@ -80,12 +80,12 @@ Rectangle {
id: sys
anchors.fill: parent
}
- TrailEmitter{
+ Emitter{
system: sys
width: 100
x: 50
- speed: PointVector{ y: 40 }
- particleDuration: 5000
- particlesPerSecond: 1.6
+ speed: PointDirection{ y: 40 }
+ lifeSpan: 5000
+ emitRate: 1.6
}
}
diff --git a/examples/declarative/particles/modelparticles/stream.qml b/examples/declarative/particles/modelparticles/stream.qml
index 0ad807bc7b..5c7a6f7fc4 100644
--- a/examples/declarative/particles/modelparticles/stream.qml
+++ b/examples/declarative/particles/modelparticles/stream.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "content/script.js" as Script
import "content"
@@ -68,15 +68,15 @@ Item{
overwrite: false
startTime: 12000//Doesn't actually work with the loading time though...
}
- TrailEmitter{
+ Emitter{
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)
+ speed: PointDirection{ x: 32; xVariation: 8 }
+ emitRate: 0.5
+ lifeSpan: 120000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
particle: "photos"
}
Kill{
@@ -85,10 +85,10 @@ Item{
height: parent.height
width: 1000
}
- ColoredParticle{
+ ImageParticle{
system: sys
particles: ["fireworks"]
- image: "../trails/content/star.png"
+ source: "../trails/content/star.png"
color: "lightsteelblue"
alpha: 0
colorVariation: 0
@@ -125,7 +125,7 @@ Item{
}
property Item alertItem;
function alert(){
- resetter.active = false
+ //resetter.active = false
force.active = true;
alertItem = alertDelegate.createObject(root);
alertItem.x = root.width/2 - alertItem.width/2
@@ -142,34 +142,30 @@ Item{
interval: 800
onTriggered: {
force.active = false
- resetter.active = true;
+ //resetter.active = true;
mp.take(alertItem, true);
centerEmitter.burst(1);
}
}
- Attractor{
+ PointAttractor{
id: force
system: sys
x: root.width/2
y: root.height/2
- strength: -30000
+ strength: -10000
active: false
anchors.centerIn: parent
width: parent.width/2
height: parent.height/2
particles:["photos"]
+ physics: PointAttractor.Position
}
- Reset{
- id: resetter
- system: sys
- particles:["photos"]
- }
- TrailEmitter{
+ Emitter{
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
+ speed: PointDirection{ x: 32; xVariation: 8;}
+ emitRate: 0.5
+ lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
+ emitCap: 20
particle: "photos"
system: sys
anchors.centerIn: parent
@@ -177,22 +173,22 @@ Item{
//TODO: Zoom in effect
}
- TrailEmitter{
+ Emitter{
id: spawnFireworks
particle: "fireworks"
system: sys
- maxParticles: 400
- particlesPerSecond: 400
- particleDuration: 2800
+ emitCap: 400
+ emitRate: 400
+ lifeSpan: 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 }
+ size: 32
+ endSize: 8
+ speed: AngledDirection{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
+ acceleration: PointDirection{ y: 160 }
}
Item{ x: -1000; y: -1000 //offscreen
Repeater{//Load them here, add to system on completed
diff --git a/examples/declarative/particles/snow/snow.qml b/examples/declarative/particles/snow/snow.qml
index 25d2e1468b..ea2de17046 100644
--- a/examples/declarative/particles/snow/snow.qml
+++ b/examples/declarative/particles/snow/snow.qml
@@ -39,15 +39,17 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
+import "content"
+import "../launcherContent" as UI
Rectangle{
width: 360
height: 540
ParticleSystem { id: particles }
- SpriteParticle {
+ ImageParticle {
system: particles
- Sprite{
+ sprites: Sprite{
name: "snow"
source: "content/flake-01.png"
frames: 51
@@ -55,21 +57,38 @@ Rectangle{
}
}
Wander {
+ id: wanderer
system: particles
anchors.fill: parent
- xVariance: 40;
- pace: 40;
+ xVariance: 360/(wanderer.physics+1);
+ pace: 100*(wanderer.physics+1);
}
- TrailEmitter {
+ Emitter {
system: particles
- particlesPerSecond: 20
- particleDuration: 7000
+ emitRate: 20
+ lifeSpan: 7000
emitting: true
- speed: PointVector{ y:80; yVariation: 40; }
- acceleration: PointVector{ y: 4 }
- particleSize: 20
- particleSizeVariation: 10
+ speed: PointDirection{ y:80; yVariation: 40; }
+ acceleration: PointDirection{ y: 4 }
+ size: 20
+ sizeVariation: 10
width: parent.width
height: 100
}
+ Row{
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ UI.Button{
+ text:"dx/dt"
+ onClicked: wanderer.physics = Wander.Position;
+ }
+ UI.Button{
+ text:"dv/dt"
+ onClicked: wanderer.physics = Wander.Velocity;
+ }
+ UI.Button{
+ text:"da/dt"
+ onClicked: wanderer.physics = Wander.Acceleration;
+ }
+ }
}
diff --git a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml
index 091ca0a8b5..1bb3cdae02 100644
--- a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml
+++ b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "content/helpers.js" as Helpers
Rectangle{
@@ -75,22 +75,22 @@ Rectangle{
property bool fakeMoving: false
property real fakeMovementDir: 0
- TrailEmitter{
+ Emitter{
particle: "stars2"
system: background
- particlesPerSecond: 60
- particleDuration: 4000
+ emitRate: 60
+ lifeSpan: 4000
emitting: true
- particleSize: 10
- particleSizeVariation: 10
+ size: 10
+ sizeVariation: 10
anchors.fill: parent
}
ParticleSystem{ id: background }
- ColoredParticle{
+ ImageParticle{
particles: ["stars2"]
system: background
anchors.fill: parent
- image: "content/star.png"
+ source: "content/star.png"
color: "white"
colorVariation: 0.1
}
@@ -197,29 +197,29 @@ Rectangle{
ParticleSystem{ id: foreground }
- ColoredParticle{
+ ImageParticle{
particles: ["stars"]
anchors.fill: parent
system: foreground
- image: "content/star.png"
+ source: "content/star.png"
color: "white"
colorVariation: 0.1
}
- ColoredParticle{
+ ImageParticle{
particles: ["shot"]
anchors.fill: parent
system: foreground
- image: "content/star.png"
+ source: "content/star.png"
color: "orange"
colorVariation: 0.3
}
- ColoredParticle{
+ ImageParticle{
id: engine
particles: ["engine"]
anchors.fill: parent
system: foreground
- image: "content/particle4.png"
+ source: "content/particle4.png"
color: "orange"
SequentialAnimation on color {
@@ -238,30 +238,31 @@ Rectangle{
colorVariation: 0.2
}
- SpriteParticle{
+ ImageParticle{
particles: ["powerups"]
anchors.fill: parent
system: foreground
- Sprite{
+ sprites:[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
@@ -273,8 +274,9 @@ Rectangle{
onAffected: if(!gameOver) score += 1000
system: foreground
}
- GravitationalSingularity{
+ PointAttractor{
id: gs1; x: vorteX; y: vorteY; strength: 800000;
+ proportionalToDistance: PointAttractor.Quadratic;
system: foreground
}
Kill{
@@ -285,8 +287,9 @@ Rectangle{
system: foreground
}
- GravitationalSingularity{
+ PointAttractor{
id: gs2; x: vorteX2; y: vorteY2; strength: 800000;
+ proportionalToDistance: PointAttractor.Quadratic;
system: foreground
}
Kill{
@@ -297,8 +300,9 @@ Rectangle{
system: foreground
}
- GravitationalSingularity{
+ PointAttractor{
id: gs3; x: vorteX3; y: vorteY3; strength: 800000;
+ proportionalToDistance: PointAttractor.Quadratic;
system: foreground
}
Kill{
@@ -308,8 +312,9 @@ Rectangle{
height: holeSize * 2
system: foreground
}
- GravitationalSingularity{
+ PointAttractor{
id: gs4; x: vorteX4; y: vorteY4; strength: 800000;
+ proportionalToDistance: PointAttractor.Quadratic;
system: foreground
}
Kill{
@@ -319,24 +324,24 @@ Rectangle{
height: holeSize * 2
system: foreground
}
- TrailEmitter{
+ Emitter{
particle: "powerups"
system: foreground
- particlesPerSecond: 1
- particleDuration: 6000
+ emitRate: 1
+ lifeSpan: 6000
emitting: !gameOver
- particleSize: 60
- particleSizeVariation: 10
+ size: 60
+ sizeVariation: 10
anchors.fill: parent
}
- TrailEmitter{
+ Emitter{
particle: "stars"
system: foreground
- particlesPerSecond: 40
- particleDuration: 4000
+ emitRate: 40
+ lifeSpan: 4000
emitting: !gameOver
- particleSize: 30
- particleSizeVariation: 10
+ size: 30
+ sizeVariation: 10
anchors.fill: parent
}
SpriteImage{
@@ -374,16 +379,16 @@ Rectangle{
drag.axis: Drag.XandYAxis
drag.target: rocket
},
- TrailEmitter{
+ Emitter{
system: foreground
particle: "engine"
- particlesPerSecond: 100
- particleDuration: 1000
+ emitRate: 100
+ lifeSpan: 1000
emitting: !gameOver
- particleSize: 10
- particleEndSize: 4
- particleSizeVariation: 4
- speed: PointVector{
+ size: 10
+ endSize: 4
+ sizeVariation: 4
+ speed: PointDirection{
x: -128 * Math.cos(rocket.rotation * (Math.PI / 180))
y: -128 * Math.sin(rocket.rotation * (Math.PI / 180))
}
@@ -392,14 +397,14 @@ Rectangle{
width: 4
},
- TrailEmitter{
+ Emitter{
system: foreground
particle: "shot"
- particlesPerSecond: 16
- particleDuration: 1600
+ emitRate: 16
+ lifeSpan: 1600
emitting: !gameOver && shoot
- particleSize: 40
- speed: PointVector{
+ size: 40
+ speed: PointDirection{
x: 256 * Math.cos(rocket.rotation * (Math.PI / 180))
y: 256 * Math.sin(rocket.rotation * (Math.PI / 180))
}
diff --git a/examples/declarative/particles/trails/dynamicemitters.qml b/examples/declarative/particles/trails/dynamicemitters.qml
index 8ea0272d94..f338c204db 100644
--- a/examples/declarative/particles/trails/dynamicemitters.qml
+++ b/examples/declarative/particles/trails/dynamicemitters.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
id: root
@@ -49,26 +49,26 @@ Rectangle{
ParticleSystem{
id: sys
}
- ColoredParticle{
+ ImageParticle{
system: sys
- image: "content/particle.png"
+ source: "content/particle.png"
color: "white"
colorVariation: 1.0
alpha: 0.1
}
Component{
id: emitterComp
- TrailEmitter{
+ Emitter{
id: container
- TrailEmitter{
+ Emitter{
id: emitMore
system: sys
emitting: true
- particlesPerSecond: 128
- particleDuration: 600
- particleSize: 16
- particleEndSize: 8
- speed: AngleVector{angleVariation:360; magnitude: 60}
+ emitRate: 128
+ lifeSpan: 600
+ size: 16
+ endSize: 8
+ speed: AngledDirection{angleVariation:360; magnitude: 60}
}
property int life: 2600
@@ -81,10 +81,10 @@ Rectangle{
}
system: sys
emitting: true
- particlesPerSecond: 64
- particleDuration: 600
- particleSize: 24
- particleEndSize: 8
+ emitRate: 32
+ lifeSpan: 600
+ size: 24
+ endSize: 8
NumberAnimation on x{
id: xAnim;
to: targetX
@@ -107,12 +107,12 @@ Rectangle{
MouseArea{
anchors.fill: parent
onClicked:{
- for(var i=0; i<16; i++){
+ for(var i=0; i<8; 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.targetX = Math.random() * 240 - 120 + obj.x
+ obj.targetY = Math.random() * 240 - 120 + obj.y
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
index 116a2334dc..4cc2eacc25 100644
--- a/examples/declarative/particles/trails/fireballs.qml
+++ b/examples/declarative/particles/trails/fireballs.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle {
id: root
@@ -52,35 +52,35 @@ Rectangle {
}
/*
- ColoredParticle{
+ ImageParticle{
id: fireball
anchors.fill: parent
particles: ["E"]
system: particles
- image: "content/particleA.png"
+ source: "content/particleA.png"
colorVariation: 0.2
color: "#00ff400f"
}
*/
- ColoredParticle{
+ ImageParticle{
id: smoke
system: particles
anchors.fill: parent
particles: ["A", "B"]
- image: "content/particle.png"
+ source: "content/particle.png"
colorVariation: 0
color: "#00111111"
}
- ColoredParticle{
+ ImageParticle{
id: flame
anchors.fill: parent
system: particles
particles: ["C", "D"]
- image: "content/particle.png"
+ source: "content/particle.png"
colorVariation: 0.1
color: "#00ff400f"
}
- TrailEmitter{
+ Emitter{
id: fire
system: particles
particle: "C"
@@ -88,15 +88,15 @@ Rectangle {
y: parent.height
width: parent.width
- particlesPerSecond: 350
- particleDuration: 3500
+ emitRate: 350
+ lifeSpan: 3500
- acceleration: PointVector{ y: -17; xVariation: 3 }
- speed: PointVector{xVariation: 3}
+ acceleration: PointDirection{ y: -17; xVariation: 3 }
+ speed: PointDirection{xVariation: 3}
- particleSize: 24
- particleSizeVariation: 8
- particleEndSize: 4
+ size: 24
+ sizeVariation: 8
+ endSize: 4
}
FollowEmitter{
id: fireSmoke
@@ -106,15 +106,15 @@ Rectangle {
width: root.width
height: root.height - 68
- particlesPerParticlePerSecond: 1
- particleDuration: 2000
+ emitRatePerParticle: 1
+ lifeSpan: 2000
- speed: PointVector{y:-17*6; yVariation: -17; xVariation: 3}
- acceleration: PointVector{xVariation: 3}
+ speed: PointDirection{y:-17*6; yVariation: -17; xVariation: 3}
+ acceleration: PointDirection{xVariation: 3}
- particleSize: 36
- particleSizeVariation: 8
- particleEndSize: 16
+ size: 36
+ sizeVariation: 8
+ endSize: 16
}
FollowEmitter{
id: fireballFlame
@@ -123,14 +123,14 @@ Rectangle {
particle: "D"
follow: "E"
- particlesPerParticlePerSecond: 120
- particleDuration: 180
- emissionWidth: 8
- emissionHeight: 8
+ emitRatePerParticle: 120
+ lifeSpan: 180
+ emitWidth: 8
+ emitHeight: 8
- particleSize: 16
- particleSizeVariation: 4
- particleEndSize: 4
+ size: 16
+ sizeVariation: 4
+ endSize: 4
}
FollowEmitter{
@@ -140,19 +140,19 @@ Rectangle {
particle: "A"
follow: "E"
- particlesPerParticlePerSecond: 128
- particleDuration: 2400
- emissionWidth: 16
- emissionHeight: 16
+ emitRatePerParticle: 128
+ lifeSpan: 2400
+ emitWidth: 16
+ emitHeight: 16
- speed: PointVector{yVariation: 16; xVariation: 16}
- acceleration: PointVector{y: -16}
+ speed: PointDirection{yVariation: 16; xVariation: 16}
+ acceleration: PointDirection{y: -16}
- particleSize: 24
- particleSizeVariation: 8
- particleEndSize: 8
+ size: 24
+ sizeVariation: 8
+ endSize: 8
}
- TrailEmitter{
+ Emitter{
id: balls
system: particles
particle: "E"
@@ -160,14 +160,14 @@ Rectangle {
y: parent.height
width: parent.width
- particlesPerSecond: 2
- particleDuration: 7000
+ emitRate: 2
+ lifeSpan: 7000
- speed: PointVector{y:-17*4*2; xVariation: 6*6}
- acceleration: PointVector{y: 17*2; xVariation: 6*6}
+ speed: PointDirection{y:-17*4*2; xVariation: 6*6}
+ acceleration: PointDirection{y: 17*2; xVariation: 6*6}
- particleSize: 12
- particleSizeVariation: 4
+ size: 12
+ sizeVariation: 4
}
}
diff --git a/examples/declarative/particles/trails/layered.qml b/examples/declarative/particles/trails/layered.qml
index 38eb8e67dc..d4a823b556 100644
--- a/examples/declarative/particles/trails/layered.qml
+++ b/examples/declarative/particles/trails/layered.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
id: root
@@ -55,30 +55,26 @@ Rectangle{
id: sys
startTime: 4000
}
- TrailEmitter{
+ Emitter{
system: sys
y:root.height + 20
width: root.width
- particlesPerSecond: 200
- particleDuration: 4000
- speed: PointVector{ y: -120; }
+ emitRate: 200
+ lifeSpan: 4000
+ speed: PointDirection{ y: -120; }
}
- SpriteParticle{
+ ImageParticle{
system: sys
visible: !cloneMode
- Sprite{
- source: "content/particle2.png"
- }
+ source: "content/particle2.png"
}
- SpriteParticle{
+ ImageParticle{
system: sys
visible: cloneMode
z: 0
- Sprite{
- source: "content/particle3.png"
- }
+ source: "content/particle3.png"
}
- SpriteParticle{
+ ImageParticle{
system: sys
clip: true
visible: cloneMode
@@ -86,8 +82,6 @@ Rectangle{
height: 240
width: root.width
z: 1
- Sprite{
- source: "content/particle.png"
- }
+ source: "content/particle.png"
}
}
diff --git a/examples/declarative/particles/trails/list.qml b/examples/declarative/particles/trails/list.qml
index 2ab579f126..7e8fb44003 100644
--- a/examples/declarative/particles/trails/list.qml
+++ b/examples/declarative/particles/trails/list.qml
@@ -43,18 +43,18 @@
// highlight bar is moved between items. + Particles.
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import "content"
Rectangle {
width: 200; height: 300
color: "black"
ParticleSystem{ id: particles }
- ColoredParticle{
+ ImageParticle{
anchors.fill: parent
system: particles
z: 10
- image: "content/star.png"
+ source: "content/star.png"
color: "white"
colorVariation: 0.0
}
@@ -92,14 +92,14 @@ Rectangle {
y: listView.currentItem.y;
//Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
Behavior on y { NumberAnimation {id: anim} }
- TrailEmitter{
+ Emitter{
anchors.fill: parent
system: particles;
emitting: anim.running
- particlesPerSecond: 600
- particleDuration: 600
- particleSize: 16
- particleEndSize: 8
+ emitRate: 600
+ lifeSpan: 600
+ size: 16
+ endSize: 8
}
}
}
diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml
index 6ca15972a4..c3129a1d72 100644
--- a/examples/declarative/particles/trails/overburst.qml
+++ b/examples/declarative/particles/trails/overburst.qml
@@ -39,34 +39,34 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "black"
width: 360
height: 540
ParticleSystem{ id: sys }
- ColoredParticle{
+ ImageParticle{
system: sys
id: cp
- image: "content/particle.png"
+ source: "content/particle.png"
colorVariation: 0.4
color: "#000000FF"
}
- TrailEmitter{
+ Emitter{
//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
+ emitRate: 16000
+ lifeSpan: 1000
+ emitCap: 4000
+ acceleration: AngledDirection{angleVariation: 360; magnitude: 360; }
+ size: 8
+ endSize: 16
+ sizeVariation: 4
}
MouseArea{
anchors.fill: parent
diff --git a/examples/declarative/particles/trails/portal.qml b/examples/declarative/particles/trails/portal.qml
index dba2e59513..8cf323b0f5 100644
--- a/examples/declarative/particles/trails/portal.qml
+++ b/examples/declarative/particles/trails/portal.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
id: root
@@ -54,51 +54,51 @@ Rectangle{
id: particles
startTime: 2000
}
- ColoredParticle{
+ ImageParticle{
particles: ["center","edge"]
anchors.fill: parent
system: particles
- image: "content/particle.png"
+ source: "content/particle.png"
colorVariation: 0.1
color: "#009999FF"
}
- TrailEmitter{
+ Emitter{
anchors.fill: parent
particle: "center"
system: particles
- particlesPerSecond: 200
- particleDuration: 2000
+ emitRate: 200
+ lifeSpan: 2000
emitting: true
- particleSize: 20
- particleSizeVariation: 2
- particleEndSize: 0
- shape: Ellipse{fill: false}
- speed: DirectedVector{
+ size: 20
+ sizeVariation: 2
+ endSize: 0
+ shape: EllipseShape{fill: false}
+ speed: TargetedDirection{
targetX: root.width/2
targetY: root.height/2
proportionalMagnitude: true
magnitude: 0.5
}
}
- TrailEmitter{
+ Emitter{
anchors.fill: parent
particle: "edge"
system: particles
- particlesPerSecond: 4000
- particleDuration: 2000
+ emitRate: 4000
+ lifeSpan: 2000
emitting: true
- particleSize: 20
- particleSizeVariation: 2
- particleEndSize: 0
- shape: Ellipse{fill: false}
- speed: DirectedVector{
+ size: 20
+ sizeVariation: 2
+ endSize: 0
+ shape: EllipseShape{fill: false}
+ speed: TargetedDirection{
targetX: root.width/2
targetY: root.height/2
proportionalMagnitude: true
magnitude: 0.1
magnitudeVariation: 0.1
}
- acceleration: DirectedVector{
+ acceleration: TargetedDirection{
targetX: root.width/2
targetY: root.height/2
targetVariation: 200
diff --git a/examples/declarative/particles/trails/rainbow.qml b/examples/declarative/particles/trails/rainbow.qml
index 6c64929668..c0b61bf89e 100644
--- a/examples/declarative/particles/trails/rainbow.qml
+++ b/examples/declarative/particles/trails/rainbow.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
import QtQuick 2.0
Rectangle {
@@ -48,19 +48,19 @@ Rectangle {
color: "black"
ParticleSystem{ id: particles }
- ColoredParticle{
+ ImageParticle{
system: particles
colorVariation: 0.5
alpha: 0
- image: "content/particle.png"
+ source: "content/particle.png"
colorTable: "content/colortable.png"
sizeTable: "content/colortable.png"
}
- TrailEmitter{
+ Emitter{
system: particles
- particlesPerSecond: 500
- particleDuration: 2000
+ emitRate: 500
+ lifeSpan: 2000
y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3
x: root.width / 2 + Math.cos(t) * root.width * 0.3
@@ -72,11 +72,11 @@ Rectangle {
speedFromMovement: 20
- speed: PointVector{ xVariation: 5; yVariation: 5;}
- acceleration: PointVector{ xVariation: 5; yVariation: 5;}
+ speed: PointDirection{ xVariation: 5; yVariation: 5;}
+ acceleration: PointDirection{ xVariation: 5; yVariation: 5;}
- particleSize: 16
- //particleEndSize: 8
- //particleSizeVariation: 8
+ size: 16
+ //endSize: 8
+ //sizeVariation: 8
}
}
diff --git a/examples/declarative/particles/trails/shimmer.qml b/examples/declarative/particles/trails/shimmer.qml
index 06f599d97a..2bd4f6980f 100644
--- a/examples/declarative/particles/trails/shimmer.qml
+++ b/examples/declarative/particles/trails/shimmer.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
width: 360
@@ -53,21 +53,21 @@ Rectangle{
id: particles
running: false
}
- ColoredParticle{
+ ImageParticle{
anchors.fill: parent
system: particles
- image: "content/star.png"
+ source: "content/star.png"
sizeTable: "content/sparkleSize.png"
alpha: 0
colorVariation: 0.6
}
- TrailEmitter{
+ Emitter{
anchors.fill: parent
system: particles
- particlesPerSecond: 2000
- particleDuration: 2000
+ emitRate: 2000
+ lifeSpan: 2000
emitting: true
- particleSize: 30
- particleSizeVariation: 10
+ size: 30
+ sizeVariation: 10
}
}
diff --git a/examples/declarative/particles/trails/trails.qml b/examples/declarative/particles/trails/trails.qml
index 58d369c8d5..689de4eb41 100644
--- a/examples/declarative/particles/trails/trails.qml
+++ b/examples/declarative/particles/trails/trails.qml
@@ -39,44 +39,44 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
color: "black"
width: 360
height: 540
ParticleSystem{ id: sys }
- ColoredParticle{
+ ImageParticle{
system: sys
id: cp
- image: "content/particle.png"
+ source: "content/particle.png"
color: "#00FFFFFF"
colorVariation: 0.4
}
- TrailEmitter{
+ Emitter{
//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
+ emitRate: 2000
+ lifeSpan: 500
+ acceleration: AngledDirection{ angle: 90; angleVariation: 360; magnitude: 640; }
+ size: 8
+ endSize: 16
+ sizeVariation: 4
}
- TrailEmitter{
+ Emitter{
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
+ emitRate: 400
+ lifeSpan: 2000
+ acceleration: AngledDirection{ angle: 90; angleVariation: 22; magnitude: 32; }
+ size: 8
+ endSize: 16
+ sizeVariation: 8
}
MouseArea{
id: ma
diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml
index 7da50464c2..6159b3e9c9 100644
--- a/examples/declarative/particles/trails/turbulence.qml
+++ b/examples/declarative/particles/trails/turbulence.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle{
width: 360
@@ -66,32 +66,32 @@ Rectangle{
frequency: 64
gridSize: 16
}
- ColoredParticle{
+ ImageParticle{
particles: ["smoke"]
system: ps
- image: "content/particle.png"
+ source: "content/particle.png"
color: "#11111111"
colorVariation: 0
}
- ColoredParticle{
+ ImageParticle{
particles: ["flame"]
system: ps
- image: "content/particle.png"
+ source: "content/particle.png"
color: "#11ff400f"
colorVariation: 0.1
}
- TrailEmitter{
+ Emitter{
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 }
+ emitRate: 120
+ lifeSpan: 1200
+ size: 20
+ endSize: 10
+ sizeVariation: 10
+ acceleration: PointDirection{ y: -40 }
+ speed: AngledDirection{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
}
FollowEmitter{
id: smoke1
@@ -101,14 +101,14 @@ Rectangle{
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 }
+ emitRatePerParticle: 4
+ lifeSpan: 2400
+ lifeSpanVariation: 400
+ size: 16
+ endSize: 8
+ sizeVariation: 8
+ acceleration: PointDirection{ y: -40 }
+ speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
}
FollowEmitter{
id: smoke2
@@ -118,12 +118,12 @@ Rectangle{
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 }
+ emitRatePerParticle: 1
+ lifeSpan: 2400
+ size: 36
+ endSize: 24
+ sizeVariation: 8
+ acceleration: PointDirection{ y: -40 }
+ speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
}
}
diff --git a/examples/declarative/particles/trails/velocityfrommotion.qml b/examples/declarative/particles/trails/velocityfrommotion.qml
index 3692410853..d361c99f89 100644
--- a/examples/declarative/particles/trails/velocityfrommotion.qml
+++ b/examples/declarative/particles/trails/velocityfrommotion.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import Qt.labs.particles 2.0
+import QtQuick.Particles 2.0
Rectangle {
@@ -75,9 +75,9 @@ Rectangle {
}
ParticleSystem{ id: sys1 }
- ColoredParticle{
+ ImageParticle{
system: sys1
- image: "content/particle.png"
+ source: "content/particle.png"
color: "cyan"
alpha: 0
SequentialAnimation on color {
@@ -105,26 +105,26 @@ Rectangle {
}
colorVariation: 0.3
}
- TrailEmitter{
+ Emitter{
id: trailsNormal
system: sys1
- particlesPerSecond: 500
- particleDuration: 2000
+ emitRate: 500
+ lifeSpan: 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;}
+ speed: PointDirection{xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection{xVariation: 10; yVariation: 10;}
speedFromMovement: 8
- particleSize: 8
- particleSizeVariation: 4
+ size: 8
+ sizeVariation: 4
}
ParticleSystem { id: sys2 }
- ColoredParticle{
+ ImageParticle{
color: "cyan"
system: sys2
alpha: 0
@@ -142,29 +142,29 @@ Rectangle {
}
}
colorVariation: 0.5
- image: "content/star.png"
+ source: "content/star.png"
}
- TrailEmitter{
+ Emitter{
id: trailsStars
system: sys2
- particlesPerSecond: 100
- particleDuration: 2200
+ emitRate: 100
+ lifeSpan: 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;}
+ speed: PointDirection{xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection{xVariation: 10; yVariation: 10;}
speedFromMovement: 8
- particleSize: 22
- particleSizeVariation: 4
+ size: 22
+ sizeVariation: 4
}
ParticleSystem { id: sys3; }
- ColoredParticle{
- image: "content/particle.png"
+ ImageParticle{
+ source: "content/particle.png"
system: sys3
color: "orange"
alpha: 0
@@ -185,28 +185,28 @@ Rectangle {
colorVariation: 0.2
}
- TrailEmitter{
+ Emitter{
id: trailsNormal2
system: sys3
- particlesPerSecond: 300
- particleDuration: 2000
+ emitRate: 300
+ lifeSpan: 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;}
+ speed: PointDirection{xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection{xVariation: 10; yVariation: 10;}
- particleSize: 12
- particleSizeVariation: 4
+ size: 12
+ sizeVariation: 4
}
ParticleSystem { id: sys4; }
- ColoredParticle{
+ ImageParticle{
system: sys4
- image: "content/star.png"
+ source: "content/star.png"
color: "green"
alpha: 0
SequentialAnimation on color {
@@ -225,23 +225,23 @@ Rectangle {
colorVariation: 0.5
}
- TrailEmitter{
+ Emitter{
id: trailsStars2
system: sys4
- particlesPerSecond: 50
- particleDuration: 2200
+ emitRate: 50
+ lifeSpan: 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;}
+ speed: PointDirection{xVariation: 2; yVariation: 2;}
+ acceleration: PointDirection{xVariation: 10; yVariation: 10;}
- particleSize: 22
- particleSizeVariation: 4
+ size: 22
+ sizeVariation: 4
}
diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml
index a436b41b88..174204768a 100644
--- a/examples/declarative/toys/dynamicscene/dynamicscene.qml
+++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml
@@ -147,27 +147,27 @@ Item {
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "Sun.qml"
- image: "../images/sun.png"
+ source: "../images/sun.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "GenericSceneItem.qml"
- image: "../images/moon.png"
+ source: "../images/moon.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
- image: "../images/tree_s.png"
+ source: "../images/tree_s.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
- image: "../images/rabbit_brown.png"
+ source: "../images/rabbit_brown.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
- image: "../images/rabbit_bw.png"
+ source: "../images/rabbit_bw.png"
}
}
}
diff --git a/examples/declarative/toys/dynamicscene/qml/Sun.qml b/examples/declarative/toys/dynamicscene/qml/Sun.qml
index d632461262..df3246d356 100644
--- a/examples/declarative/toys/dynamicscene/qml/Sun.qml
+++ b/examples/declarative/toys/dynamicscene/qml/Sun.qml
@@ -44,7 +44,7 @@ Image {
id: sun
property bool created: false
- property string image: "../images/sun.png"
+ property string source: "../images/sun.png"
source: image
diff --git a/examples/declarative/ui-components/flipable/content/Card.qml b/examples/declarative/ui-components/flipable/content/Card.qml
index 6374dd8eda..6574733abb 100644
--- a/examples/declarative/ui-components/flipable/content/Card.qml
+++ b/examples/declarative/ui-components/flipable/content/Card.qml
@@ -43,7 +43,7 @@ import QtQuick 1.0
Flipable {
id: container
- property alias image: frontImage.source
+ property alias source: frontImage.source
property bool flipped: true
property int xAxis: 0
property int yAxis: 0
diff --git a/examples/declarative/ui-components/flipable/flipable.qml b/examples/declarative/ui-components/flipable/flipable.qml
index 6d0235ecb4..3b23aa0d69 100644
--- a/examples/declarative/ui-components/flipable/flipable.qml
+++ b/examples/declarative/ui-components/flipable/flipable.qml
@@ -49,7 +49,7 @@ Rectangle {
Row {
anchors.centerIn: parent; spacing: 30
- Card { image: "content/9_club.png"; angle: 180; yAxis: 1 }
- Card { image: "content/5_heart.png"; angle: 540; xAxis: 1 }
+ Card { source: "content/9_club.png"; angle: 180; yAxis: 1 }
+ Card { source: "content/5_heart.png"; angle: 540; xAxis: 1 }
}
}