diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-05-31 15:25:44 +1000 |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-05-31 15:25:44 +1000 |
commit | 766521d62a4cf4598326a510186b080a91bde6dd (patch) | |
tree | 5cf89c1338f42122c370c649b73c8193ca079268 /examples/declarative/particles/trails | |
parent | a91b8a041966f8aea4bf01fdcb1d5006547f3902 (diff) | |
parent | e7fef9d6115d1a9193c112d8fd4249ae9396dae3 (diff) |
Merge branch 'qtquick2'
Conflicts:
demos/declarative/flickr/common/Progress.qml
demos/declarative/flickr/common/RssModel.qml
demos/declarative/flickr/common/ScrollBar.qml
demos/declarative/flickr/common/Slider.qml
demos/declarative/flickr/mobile/Button.qml
demos/declarative/flickr/mobile/GridDelegate.qml
demos/declarative/flickr/mobile/ImageDetails.qml
demos/declarative/flickr/mobile/ListDelegate.qml
demos/declarative/flickr/mobile/TitleBar.qml
demos/declarative/flickr/mobile/ToolBar.qml
demos/declarative/webbrowser/content/Button.qml
demos/declarative/webbrowser/content/FlickableWebView.qml
demos/declarative/webbrowser/content/Header.qml
demos/declarative/webbrowser/content/ScrollBar.qml
demos/declarative/webbrowser/content/UrlInput.qml
demos/declarative/webbrowser/webbrowser.qml
doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
examples/declarative/modelviews/webview/newwindows/qml/alerts.html
examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/map.html
examples/declarative/modelviews/webview/newwindows/qml/content/pics/cancel.png
examples/declarative/modelviews/webview/newwindows/qml/content/pics/ok.png
examples/declarative/modelviews/webview/newwindows/qml/newwindows.html
src/declarative/graphicsitems/qdeclarativetextinput.cpp
src/declarative/qml/qdeclarativecompiledbindings.cpp
src/declarative/qml/qdeclarativecompiledbindings_p.h
src/declarative/qml/qdeclarativedom.cpp
src/declarative/qml/qdeclarativedom_p.h
src/declarative/qml/qdeclarativedom_p_p.h
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/qml/qdeclarativetypeloader.cpp
src/imports/particles/particles.cpp
tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp
tests/auto/declarative/qmlvisual/qdeclarativeflickable/data/flickable-horizontal.4.png
tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png
tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.0.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.1.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.2.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.3.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.4.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.5.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.6.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.7.png
tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/multilineAlign.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-X11/multilineAlign.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/data-X11/parentanchor.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-X11/qtbug_14865.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-X11/qtbug_14865.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide2.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.2.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.3.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.4.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.5.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext3.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/plaintext.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/plaintext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/richtext.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/richtext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.10.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.11.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.5.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.6.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.8.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.9.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.5.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.6.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.10.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.11.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.12.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.9.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/wrap.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.11.png
tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
Change-Id: I40df8a9403a58a6c03a0f1734f16a5cbed6c85ff
Diffstat (limited to 'examples/declarative/particles/trails')
22 files changed, 1577 insertions, 0 deletions
diff --git a/examples/declarative/particles/trails/content/PetsModel.qml b/examples/declarative/particles/trails/content/PetsModel.qml new file mode 100644 index 0000000000..d7375a73af --- /dev/null +++ b/examples/declarative/particles/trails/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/particles/trails/content/candle.png b/examples/declarative/particles/trails/content/candle.png Binary files differnew file mode 100644 index 0000000000..8fa3193719 --- /dev/null +++ b/examples/declarative/particles/trails/content/candle.png diff --git a/examples/declarative/particles/trails/content/colortable.png b/examples/declarative/particles/trails/content/colortable.png Binary files differnew file mode 100644 index 0000000000..a62ceeb4a0 --- /dev/null +++ b/examples/declarative/particles/trails/content/colortable.png diff --git a/examples/declarative/particles/trails/content/particle.png b/examples/declarative/particles/trails/content/particle.png Binary files differnew file mode 100644 index 0000000000..5c83896d22 --- /dev/null +++ b/examples/declarative/particles/trails/content/particle.png diff --git a/examples/declarative/particles/trails/content/particle2.png b/examples/declarative/particles/trails/content/particle2.png Binary files differnew file mode 100644 index 0000000000..36349c6c6e --- /dev/null +++ b/examples/declarative/particles/trails/content/particle2.png diff --git a/examples/declarative/particles/trails/content/particle3.png b/examples/declarative/particles/trails/content/particle3.png Binary files differnew file mode 100644 index 0000000000..905d8f37b8 --- /dev/null +++ b/examples/declarative/particles/trails/content/particle3.png diff --git a/examples/declarative/particles/trails/content/particleA.png b/examples/declarative/particles/trails/content/particleA.png Binary files differnew file mode 100644 index 0000000000..c63acdee1f --- /dev/null +++ b/examples/declarative/particles/trails/content/particleA.png diff --git a/examples/declarative/particles/trails/content/portal_bg.png b/examples/declarative/particles/trails/content/portal_bg.png Binary files differnew file mode 100644 index 0000000000..3c59eeabb9 --- /dev/null +++ b/examples/declarative/particles/trails/content/portal_bg.png diff --git a/examples/declarative/particles/trails/content/sparkleSize.png b/examples/declarative/particles/trails/content/sparkleSize.png Binary files differnew file mode 100644 index 0000000000..752056541b --- /dev/null +++ b/examples/declarative/particles/trails/content/sparkleSize.png diff --git a/examples/declarative/particles/trails/content/star.png b/examples/declarative/particles/trails/content/star.png Binary files differnew file mode 100644 index 0000000000..0d592cfa87 --- /dev/null +++ b/examples/declarative/particles/trails/content/star.png diff --git a/examples/declarative/particles/trails/dynamicemitters.qml b/examples/declarative/particles/trails/dynamicemitters.qml new file mode 100644 index 0000000000..8ea0272d94 --- /dev/null +++ b/examples/declarative/particles/trails/dynamicemitters.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + id: root + color: "black" + width: 640 + height: 480 + ParticleSystem{ + id: sys + } + ColoredParticle{ + system: sys + image: "content/particle.png" + color: "white" + colorVariation: 1.0 + alpha: 0.1 + } + Component{ + id: emitterComp + TrailEmitter{ + id: container + TrailEmitter{ + id: emitMore + system: sys + emitting: true + particlesPerSecond: 128 + particleDuration: 600 + particleSize: 16 + particleEndSize: 8 + speed: AngleVector{angleVariation:360; magnitude: 60} + } + + property int life: 2600 + property real targetX: 0 + property real targetY: 0 + function go(){ + xAnim.start(); + yAnim.start(); + container.emitting = true + } + system: sys + emitting: true + particlesPerSecond: 64 + particleDuration: 600 + particleSize: 24 + particleEndSize: 8 + NumberAnimation on x{ + id: xAnim; + to: targetX + duration: life + running: false + } + NumberAnimation on y{ + id: yAnim; + to: targetY + duration: life + running: false + } + Timer{ + interval: life + running: true + onTriggered: container.destroy(); + } + } + } + MouseArea{ + anchors.fill: parent + onClicked:{ + for(var i=0; i<16; i++){ + var obj = emitterComp.createObject(root); + obj.x = mouse.x + obj.y = mouse.y + obj.targetX = Math.random() * 640 + obj.targetY = Math.random() * 480 + obj.life = Math.round(Math.random() * 2400) + 200 + obj.go(); + } + } + } +} diff --git a/examples/declarative/particles/trails/fireballs.qml b/examples/declarative/particles/trails/fireballs.qml new file mode 100644 index 0000000000..116a2334dc --- /dev/null +++ b/examples/declarative/particles/trails/fireballs.qml @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle { + id: root + width: 360 + height: 540 + color: "black" + + ParticleSystem{ + id: particles + } + + /* + ColoredParticle{ + id: fireball + anchors.fill: parent + particles: ["E"] + system: particles + image: "content/particleA.png" + colorVariation: 0.2 + color: "#00ff400f" + } + */ + ColoredParticle{ + id: smoke + system: particles + anchors.fill: parent + particles: ["A", "B"] + image: "content/particle.png" + colorVariation: 0 + color: "#00111111" + } + ColoredParticle{ + id: flame + anchors.fill: parent + system: particles + particles: ["C", "D"] + image: "content/particle.png" + colorVariation: 0.1 + color: "#00ff400f" + } + TrailEmitter{ + id: fire + system: particles + particle: "C" + + y: parent.height + width: parent.width + + particlesPerSecond: 350 + particleDuration: 3500 + + acceleration: PointVector{ y: -17; xVariation: 3 } + speed: PointVector{xVariation: 3} + + particleSize: 24 + particleSizeVariation: 8 + particleEndSize: 4 + } + FollowEmitter{ + id: fireSmoke + particle: "B" + system: particles + follow: "C" + width: root.width + height: root.height - 68 + + particlesPerParticlePerSecond: 1 + particleDuration: 2000 + + speed: PointVector{y:-17*6; yVariation: -17; xVariation: 3} + acceleration: PointVector{xVariation: 3} + + particleSize: 36 + particleSizeVariation: 8 + particleEndSize: 16 + } + FollowEmitter{ + id: fireballFlame + anchors.fill: parent + system: particles + particle: "D" + follow: "E" + + particlesPerParticlePerSecond: 120 + particleDuration: 180 + emissionWidth: 8 + emissionHeight: 8 + + particleSize: 16 + particleSizeVariation: 4 + particleEndSize: 4 + } + + FollowEmitter{ + id: fireballSmoke + anchors.fill: parent + system: particles + particle: "A" + follow: "E" + + particlesPerParticlePerSecond: 128 + particleDuration: 2400 + emissionWidth: 16 + emissionHeight: 16 + + speed: PointVector{yVariation: 16; xVariation: 16} + acceleration: PointVector{y: -16} + + particleSize: 24 + particleSizeVariation: 8 + particleEndSize: 8 + } + TrailEmitter{ + id: balls + system: particles + particle: "E" + + y: parent.height + width: parent.width + + particlesPerSecond: 2 + particleDuration: 7000 + + speed: PointVector{y:-17*4*2; xVariation: 6*6} + acceleration: PointVector{y: 17*2; xVariation: 6*6} + + particleSize: 12 + particleSizeVariation: 4 + } + +} + diff --git a/examples/declarative/particles/trails/layered.qml b/examples/declarative/particles/trails/layered.qml new file mode 100644 index 0000000000..38eb8e67dc --- /dev/null +++ b/examples/declarative/particles/trails/layered.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + id: root + width: 360 + height: 600 + color: "darkblue" + property bool cloneMode: false + MouseArea{ + anchors.fill: parent + onClicked: cloneMode = !cloneMode; + } + ParticleSystem{ + id: sys + startTime: 4000 + } + TrailEmitter{ + system: sys + y:root.height + 20 + width: root.width + particlesPerSecond: 200 + particleDuration: 4000 + speed: PointVector{ y: -120; } + } + SpriteParticle{ + system: sys + visible: !cloneMode + Sprite{ + source: "content/particle2.png" + } + } + SpriteParticle{ + system: sys + visible: cloneMode + z: 0 + Sprite{ + source: "content/particle3.png" + } + } + SpriteParticle{ + system: sys + clip: true + visible: cloneMode + y: 120 + height: 240 + width: root.width + z: 1 + Sprite{ + source: "content/particle.png" + } + } +} diff --git a/examples/declarative/particles/trails/list.qml b/examples/declarative/particles/trails/list.qml new file mode 100644 index 0000000000..2ab579f126 --- /dev/null +++ b/examples/declarative/particles/trails/list.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + Particles. + +import QtQuick 2.0 +import Qt.labs.particles 2.0 +import "content" + +Rectangle { + width: 200; height: 300 + color: "black" + ParticleSystem{ id: particles } + ColoredParticle{ + anchors.fill: parent + system: particles + z: 10 + image: "content/star.png" + color: "white" + colorVariation: 0.0 + } + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name; color: "white" } + Text { text: 'Type: ' + type; color: "white" } + Text { text: 'Age: ' + age; color: "white" } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#333366" + y: listView.currentItem.y; + //Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + Behavior on y { NumberAnimation {id: anim} } + TrailEmitter{ + anchors.fill: parent + system: particles; + emitting: anim.running + particlesPerSecond: 600 + particleDuration: 600 + particleSize: 16 + particleEndSize: 8 + } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml new file mode 100644 index 0000000000..6ca15972a4 --- /dev/null +++ b/examples/declarative/particles/trails/overburst.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + color: "black" + width: 360 + height: 540 + ParticleSystem{ id: sys } + ColoredParticle{ + system: sys + id: cp + image: "content/particle.png" + colorVariation: 0.4 + color: "#000000FF" + } + TrailEmitter{ + //burst on click + id: bursty + system: sys + emitting: ma.pressed + x: ma.mouseX + y: ma.mouseY + particlesPerSecond: 16000 + particleDuration: 1000 + maxParticles: 4000 + acceleration: AngleVector{angleVariation: 360; magnitude: 360; } + particleSize: 8 + particleEndSize: 16 + particleSizeVariation: 4 + } + MouseArea{ + anchors.fill: parent + id: ma + } + MouseArea{ + width: 100 + height: 100 + onClicked: sys.overwrite = !sys.overwrite + id: ma2 + Rectangle{ + anchors.fill: parent + color: "lightsteelblue" + } + } +} diff --git a/examples/declarative/particles/trails/portal.qml b/examples/declarative/particles/trails/portal.qml new file mode 100644 index 0000000000..dba2e59513 --- /dev/null +++ b/examples/declarative/particles/trails/portal.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + id: root + width: 360 + height: 540 + color: "black" + Image{ + anchors.fill: parent + source: "content/portal_bg.png" + } + ParticleSystem{ + id: particles + startTime: 2000 + } + ColoredParticle{ + particles: ["center","edge"] + anchors.fill: parent + system: particles + image: "content/particle.png" + colorVariation: 0.1 + color: "#009999FF" + } + TrailEmitter{ + anchors.fill: parent + particle: "center" + system: particles + particlesPerSecond: 200 + particleDuration: 2000 + emitting: true + particleSize: 20 + particleSizeVariation: 2 + particleEndSize: 0 + shape: Ellipse{fill: false} + speed: DirectedVector{ + targetX: root.width/2 + targetY: root.height/2 + proportionalMagnitude: true + magnitude: 0.5 + } + } + TrailEmitter{ + anchors.fill: parent + particle: "edge" + system: particles + particlesPerSecond: 4000 + particleDuration: 2000 + emitting: true + particleSize: 20 + particleSizeVariation: 2 + particleEndSize: 0 + shape: Ellipse{fill: false} + speed: DirectedVector{ + targetX: root.width/2 + targetY: root.height/2 + proportionalMagnitude: true + magnitude: 0.1 + magnitudeVariation: 0.1 + } + acceleration: DirectedVector{ + targetX: root.width/2 + targetY: root.height/2 + targetVariation: 200 + proportionalMagnitude: true + magnitude: 0.1 + magnitudeVariation: 0.1 + } + } +} diff --git a/examples/declarative/particles/trails/rainbow.qml b/examples/declarative/particles/trails/rainbow.qml new file mode 100644 index 0000000000..6c64929668 --- /dev/null +++ b/examples/declarative/particles/trails/rainbow.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt.labs.particles 2.0 +import QtQuick 2.0 + +Rectangle { + id: root + width: 360 + height: 540 + color: "black" + + ParticleSystem{ id: particles } + ColoredParticle{ + system: particles + colorVariation: 0.5 + alpha: 0 + + image: "content/particle.png" + colorTable: "content/colortable.png" + sizeTable: "content/colortable.png" + } + TrailEmitter{ + system: particles + particlesPerSecond: 500 + particleDuration: 2000 + + y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3 + x: root.width / 2 + Math.cos(t) * root.width * 0.3 + property real t; + + NumberAnimation on t { + from: 0; to: Math.PI * 2; duration: 10000; loops: Animation.Infinite + } + + speedFromMovement: 20 + + speed: PointVector{ xVariation: 5; yVariation: 5;} + acceleration: PointVector{ xVariation: 5; yVariation: 5;} + + particleSize: 16 + //particleEndSize: 8 + //particleSizeVariation: 8 + } +} diff --git a/examples/declarative/particles/trails/shimmer.qml b/examples/declarative/particles/trails/shimmer.qml new file mode 100644 index 0000000000..06f599d97a --- /dev/null +++ b/examples/declarative/particles/trails/shimmer.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + width: 360 + height: 540 + color: "black" + MouseArea{ + anchors.fill: parent + onClicked: particles.running = !particles.running + } + ParticleSystem{ + id: particles + running: false + } + ColoredParticle{ + anchors.fill: parent + system: particles + image: "content/star.png" + sizeTable: "content/sparkleSize.png" + alpha: 0 + colorVariation: 0.6 + } + TrailEmitter{ + anchors.fill: parent + system: particles + particlesPerSecond: 2000 + particleDuration: 2000 + emitting: true + particleSize: 30 + particleSizeVariation: 10 + } +} diff --git a/examples/declarative/particles/trails/swarm.qml b/examples/declarative/particles/trails/swarm.qml new file mode 100644 index 0000000000..083f9e816d --- /dev/null +++ b/examples/declarative/particles/trails/swarm.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 as QLP + +Rectangle{ + width: 200 + height: 200 + color: "black" + QLP.ParticleSystem{ id: ps } + QLP.ColoredParticle{ + system: ps + particles: ["star1","star2"] + anchors.fill: parent + clip: true + image: "content/star.png" + } + QLP.Swarm{ + system: ps + leaders: ["star2"]; + anchors.fill: parent + strength: 128 + } + QLP.TrailEmitter{ + anchors.fill: parent + system: ps + particle: "star1" + particlesPerSecond: 100 + particleDuration: 2000 + } + QLP.TrailEmitter{ + anchors.fill: parent + system: ps + particle: "star2" + particlesPerSecond: 0.4 + particleDuration: 10000 + particleSize: 64 + particleEndSize: 32 + } +} diff --git a/examples/declarative/particles/trails/trails.qml b/examples/declarative/particles/trails/trails.qml new file mode 100644 index 0000000000..58d369c8d5 --- /dev/null +++ b/examples/declarative/particles/trails/trails.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + color: "black" + width: 360 + height: 540 + ParticleSystem{ id: sys } + ColoredParticle{ + system: sys + id: cp + image: "content/particle.png" + color: "#00FFFFFF" + colorVariation: 0.4 + } + TrailEmitter{ + //burst on click + id: bursty + system: sys + emitting: false + particlesPerSecond: 2000 + particleDuration: 500 + acceleration: AngleVector{ angle: 90; angleVariation: 360; magnitude: 640; } + particleSize: 8 + particleEndSize: 16 + particleSizeVariation: 4 + } + TrailEmitter{ + system: sys + speedFromMovement: 4.0 + emitting: ma.pressed + x: ma.mouseX + y: ma.mouseY + particlesPerSecond: 400 + particleDuration: 2000 + acceleration: AngleVector{ angle: 90; angleVariation: 22; magnitude: 32; } + particleSize: 8 + particleEndSize: 16 + particleSizeVariation: 8 + } + MouseArea{ + id: ma + anchors.fill: parent + onPressed: {bursty.x = mouse.x; bursty.y = mouse.y; bursty.pulse(0.1);}//uses both for comparison + onReleased: {bursty.x = mouse.x; bursty.y = mouse.y; bursty.burst(200);} + } +} diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml new file mode 100644 index 0000000000..7da50464c2 --- /dev/null +++ b/examples/declarative/particles/trails/turbulence.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle{ + width: 360 + height: 540 + color: "#222222" + id: root + Image{ + source: "content/candle.png" + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottomMargin: -8 + anchors.horizontalCenterOffset: 2 + } + ParticleSystem{ + id: ps + } + Turbulence{ + system: ps + height: (parent.height / 2) + width: parent.width / 2 + x: parent. width / 4 + anchors.fill: parent + strength: 16 + frequency: 64 + gridSize: 16 + } + ColoredParticle{ + particles: ["smoke"] + system: ps + image: "content/particle.png" + color: "#11111111" + colorVariation: 0 + } + ColoredParticle{ + particles: ["flame"] + system: ps + image: "content/particle.png" + color: "#11ff400f" + colorVariation: 0.1 + } + TrailEmitter{ + anchors.centerIn: parent + system: ps + particle: "flame" + + particlesPerSecond: 120 + particleDuration: 1200 + particleSize: 20 + particleEndSize: 10 + particleSizeVariation: 10 + acceleration: PointVector{ y: -40 } + speed: AngleVector{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } + } + FollowEmitter{ + id: smoke1 + width: root.width + height: 232 + system: ps + particle: "smoke" + follow: "flame" + + particlesPerParticlePerSecond: 4 + particleDuration: 2400 + particleDurationVariation: 400 + particleSize: 16 + particleEndSize: 8 + particleSizeVariation: 8 + acceleration: PointVector{ y: -40 } + speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + } + FollowEmitter{ + id: smoke2 + width: root.width + height: 232 + system: ps + particle: "smoke" + follow: "flame" + + particlesPerParticlePerSecond: 1 + particleDuration: 2400 + particleSize: 36 + particleEndSize: 24 + particleSizeVariation: 8 + acceleration: PointVector{ y: -40 } + speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + } +} diff --git a/examples/declarative/particles/trails/velocityfrommotion.qml b/examples/declarative/particles/trails/velocityfrommotion.qml new file mode 100644 index 0000000000..3692410853 --- /dev/null +++ b/examples/declarative/particles/trails/velocityfrommotion.qml @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Rectangle { + + id: root + + height: 540 + width: 360 + + gradient: Gradient { + GradientStop { position: 0; color: "#000020" } + GradientStop { position: 1; color: "#000000" } + } + + MouseArea { + id: mouseArea + anchors.fill: root + +/* + onPressed: stopAndStart() + onReleased: stopAndStart() + function stopAndStart() { + trailsNormal.emitting = false; + trailsNormal.emitting = true; + trailsStars.emitting = false; + trailsStars.emitting = true; + trailsNormal2.emitting = false; + trailsNormal2.emitting = true; + trailsStars2.emitting = false; + trailsStars2.emitting = true; + print("stop and start") + } +*/ + } + + ParticleSystem{ id: sys1 } + ColoredParticle{ + system: sys1 + image: "content/particle.png" + color: "cyan" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "cyan" + to: "magenta" + duration: 1000 + } + ColorAnimation { + from: "magenta" + to: "blue" + duration: 2000 + } + ColorAnimation { + from: "blue" + to: "violet" + duration: 2000 + } + ColorAnimation { + from: "violet" + to: "cyan" + duration: 2000 + } + } + colorVariation: 0.3 + } + TrailEmitter{ + id: trailsNormal + system: sys1 + + particlesPerSecond: 500 + particleDuration: 2000 + + + y: mouseArea.pressed ? mouseArea.mouseY : circle.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle.cx + + speed: PointVector{xVariation: 4; yVariation: 4;} + acceleration: PointVector{xVariation: 10; yVariation: 10;} + speedFromMovement: 8 + + particleSize: 8 + particleSizeVariation: 4 + } + ParticleSystem { id: sys2 } + ColoredParticle{ + color: "cyan" + system: sys2 + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "magenta" + to: "cyan" + duration: 1000 + } + ColorAnimation { + from: "cyan" + to: "magenta" + duration: 2000 + } + } + colorVariation: 0.5 + image: "content/star.png" + } + TrailEmitter{ + id: trailsStars + system: sys2 + + particlesPerSecond: 100 + particleDuration: 2200 + + + y: mouseArea.pressed ? mouseArea.mouseY : circle.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle.cx + + speed: PointVector{xVariation: 4; yVariation: 4;} + acceleration: PointVector{xVariation: 10; yVariation: 10;} + speedFromMovement: 8 + + particleSize: 22 + particleSizeVariation: 4 + } + ParticleSystem { id: sys3; } + ColoredParticle{ + image: "content/particle.png" + system: sys3 + color: "orange" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "red" + to: "green" + duration: 2000 + } + ColorAnimation { + from: "green" + to: "red" + duration: 2000 + } + } + + colorVariation: 0.2 + + } + TrailEmitter{ + id: trailsNormal2 + system: sys3 + + particlesPerSecond: 300 + particleDuration: 2000 + + y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx + + speedFromMovement: 16 + + speed: PointVector{xVariation: 4; yVariation: 4;} + acceleration: PointVector{xVariation: 10; yVariation: 10;} + + particleSize: 12 + particleSizeVariation: 4 + } + ParticleSystem { id: sys4; } + ColoredParticle{ + system: sys4 + image: "content/star.png" + color: "green" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "green" + to: "red" + duration: 2000 + } + ColorAnimation { + from: "red" + to: "green" + duration: 2000 + } + } + + colorVariation: 0.5 + } + TrailEmitter{ + id: trailsStars2 + system: sys4 + + particlesPerSecond: 50 + particleDuration: 2200 + + + y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx + + speedFromMovement: 16 + speed: PointVector{xVariation: 2; yVariation: 2;} + acceleration: PointVector{xVariation: 10; yVariation: 10;} + + particleSize: 22 + particleSizeVariation: 4 + } + + + + color: "white" + + Item { + id: circle + //anchors.fill: parent + property real radius: 0 + property real dx: root.width / 2 + property real dy: root.height / 2 + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { + duration: 1000 + from: 1 + to: 0 + loops: 8 + } + NumberAnimation { + duration: 1000 + from: 0 + to: 1 + loops: 8 + } + + } + + SequentialAnimation on radius { + loops: Animation.Infinite + running: true + NumberAnimation { + duration: 4000 + from: 0 + to: 100 + } + NumberAnimation { + duration: 4000 + from: 100 + to: 0 + } + } + } + + Item { + id: circle3 + property real radius: 100 + property real dx: root.width / 2 + property real dy: root.height / 2 + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { from: 0.0; to: 1 ; duration: 10000; } + } + } + + Item { + id: circle2 + property real radius: 30 + property real dx: circle3.cx + property real dy: circle3.cy + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { from: 0.0; to: 1 ; duration: 1000; } + } + } + +} |