diff options
Diffstat (limited to 'basicsuite/Qt5 Particles Demo')
59 files changed, 1583 insertions, 0 deletions
diff --git a/basicsuite/Qt5 Particles Demo/content/burstandpulse.qml b/basicsuite/Qt5 Particles Demo/content/burstandpulse.qml new file mode 100644 index 0000000..c44c8dc --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/burstandpulse.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + width: 320 + height: 480 + color: "black" + property bool lastWasPulse: false + Timer { + interval: 3500 + triggeredOnStart: true + running: true + repeat: true + onTriggered: { + //! [0] + if (lastWasPulse) { + burstEmitter.burst(500); + lastWasPulse = false; + } else { + pulseEmitter.pulse(500); + lastWasPulse = true; + } + //! [0] + } + } + ParticleSystem { + id: particles + anchors.fill: parent + ImageParticle { + source: "../images/star.png" + alpha: 0 + colorVariation: 0.6 + } + + Emitter { + id: burstEmitter + x: parent.width/2 + y: parent.height/3 + emitRate: 1000 + lifeSpan: 2000 + enabled: false + velocity: AngleDirection{magnitude: 64; angleVariation: 360} + size: 24 + sizeVariation: 8 + Text { + anchors.centerIn: parent + color: "white" + font.pixelSize: 18 + text: "Burst" + } + } + Emitter { + id: pulseEmitter + x: parent.width/2 + y: 2*parent.height/3 + emitRate: 1000 + lifeSpan: 2000 + enabled: false + velocity: AngleDirection{magnitude: 64; angleVariation: 360} + size: 24 + sizeVariation: 8 + Text { + anchors.centerIn: parent + color: "white" + font.pixelSize: 18 + text: "Pulse" + } + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/content/customemitter.qml b/basicsuite/Qt5 Particles Demo/content/customemitter.qml new file mode 100644 index 0000000..bcf7da3 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/customemitter.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +ParticleSystem { + id: sys + width: 360 + height: 600 + running: true + Rectangle { + z: -1 + anchors.fill: parent + color: "black" + } + + property real petalLength: 180 + property real petalRotation: 0 + NumberAnimation on petalRotation { + from: 0; + to: 360; + loops: -1; + running: true + duration: 24000 + } + + function convert(a) {return a*(Math.PI/180);} + Emitter { + lifeSpan: 4000 + emitRate: 120 + size: 12 + anchors.centerIn: parent + //! [0] + onEmitParticles: { + for (var i=0; i<particles.length; i++) { + var particle = particles[i]; + particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24)); + var theta = Math.floor(Math.random() * 6.0); + particle.red = theta == 0 || theta == 1 || theta == 2 ? 0.2 : 1; + particle.green = theta == 2 || theta == 3 || theta == 4 ? 0.2 : 1; + particle.blue = theta == 4 || theta == 5 || theta == 0 ? 0.2 : 1; + theta /= 6.0; + theta *= 2.0*Math.PI; + theta += sys.convert(sys.petalRotation);//Convert from degrees to radians + particle.initialVX = petalLength * Math.cos(theta); + particle.initialVY = petalLength * Math.sin(theta); + particle.initialAX = particle.initialVX * -0.5; + particle.initialAY = particle.initialVY * -0.5; + } + } + //! [0] + } + + ImageParticle { + source: "../images/particle4.png" + alpha: 0.0 + } +} diff --git a/basicsuite/Qt5 Particles Demo/content/emitmask.qml b/basicsuite/Qt5 Particles Demo/content/emitmask.qml new file mode 100644 index 0000000..575f9a1 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/emitmask.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + color: "goldenrod" + width: 400 + height: 400 + ParticleSystem { + width: 300 + height: 300 + anchors.centerIn: parent + + ImageParticle { + source: "../images/particle.png" + z: 2 + anchors.fill: parent + color: "#336666CC" + colorVariation: 0.0 + } + + Emitter { + anchors.fill: parent + emitRate: 6000 + lifeSpan: 720 + size: 10 + //! [0] + shape: MaskShape { + source: "../images/starfish_mask.png" + } + //! [0] + } + + } +} diff --git a/basicsuite/Qt5 Particles Demo/content/maximumemitted.qml b/basicsuite/Qt5 Particles Demo/content/maximumemitted.qml new file mode 100644 index 0000000..cf87159 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/maximumemitted.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + color: "black" + width: 360 + height: 540 + ParticleSystem { + id: sys + anchors.fill: parent + onEmptyChanged: if (empty) sys.pause(); + + ImageParticle { + system: sys + id: cp + source: "../images/particle.png" + colorVariation: 0.4 + color: "#000000FF" + } + + Emitter { + //burst on click + id: bursty + system: sys + enabled: ma.pressed + x: ma.mouseX + y: ma.mouseY + emitRate: 16000 + maximumEmitted: 4000 + acceleration: AngleDirection {angleVariation: 360; magnitude: 360; } + size: 8 + endSize: 16 + sizeVariation: 4 + } + + MouseArea { + anchors.fill: parent + onPressed: sys.resume() + id: ma + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/content/shapeanddirection.qml b/basicsuite/Qt5 Particles Demo/content/shapeanddirection.qml new file mode 100644 index 0000000..9d5ea98 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/shapeanddirection.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + id: root + width: 360 + height: 540 + color: "black" + Image { + anchors.fill: parent + source: "../images/portal_bg.png" + } + + ParticleSystem { + id: particles + anchors.fill: parent + + ImageParticle { + groups: ["center","edge"] + anchors.fill: parent + source: "../images/particle.png" + colorVariation: 0.1 + color: "#009999FF" + } + + Emitter { + anchors.fill: parent + group: "center" + emitRate: 400 + lifeSpan: 2000 + size: 20 + sizeVariation: 2 + endSize: 0 + //! [0] + shape: EllipseShape {fill: false} + velocity: TargetDirection { + targetX: root.width/2 + targetY: root.height/2 + proportionalMagnitude: true + magnitude: 0.5 + } + //! [0] + } + + Emitter { + anchors.fill: parent + group: "edge" + startTime: 2000 + emitRate: 2000 + lifeSpan: 2000 + size: 28 + sizeVariation: 2 + endSize: 16 + shape: EllipseShape {fill: false} + velocity: TargetDirection { + targetX: root.width/2 + targetY: root.height/2 + proportionalMagnitude: true + magnitude: 0.1 + magnitudeVariation: 0.1 + } + acceleration: TargetDirection { + targetX: root.width/2 + targetY: root.height/2 + targetVariation: 200 + proportionalMagnitude: true + magnitude: 0.1 + magnitudeVariation: 0.1 + } + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/content/trailemitter.qml b/basicsuite/Qt5 Particles Demo/content/trailemitter.qml new file mode 100644 index 0000000..d876bbb --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/trailemitter.qml @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + id: root + width: 360 + height: 540 + color: "black" + + ParticleSystem { + id: particles + anchors.fill: parent + + ImageParticle { + id: smoke + system: particles + anchors.fill: parent + groups: ["A", "B"] + source: "../images/particle.png" + colorVariation: 0 + color: "#00111111" + } + ImageParticle { + id: flame + anchors.fill: parent + system: particles + groups: ["C", "D"] + source: "../images/particle.png" + colorVariation: 0.1 + color: "#00ff400f" + } + + Emitter { + id: fire + system: particles + group: "C" + + y: parent.height + width: parent.width + + emitRate: 350 + lifeSpan: 3500 + + acceleration: PointDirection { y: -17; xVariation: 3 } + velocity: PointDirection {xVariation: 3} + + size: 24 + sizeVariation: 8 + endSize: 4 + } + + TrailEmitter { + id: fireSmoke + group: "B" + system: particles + follow: "C" + width: root.width + height: root.height - 68 + + emitRatePerParticle: 1 + lifeSpan: 2000 + + velocity: PointDirection {y:-17*6; yVariation: -17; xVariation: 3} + acceleration: PointDirection {xVariation: 3} + + size: 36 + sizeVariation: 8 + endSize: 16 + } + + TrailEmitter { + id: fireballFlame + anchors.fill: parent + system: particles + group: "D" + follow: "E" + + emitRatePerParticle: 120 + lifeSpan: 180 + emitWidth: TrailEmitter.ParticleSize + emitHeight: TrailEmitter.ParticleSize + emitShape: EllipseShape{} + + size: 16 + sizeVariation: 4 + endSize: 4 + } + + TrailEmitter { + id: fireballSmoke + anchors.fill: parent + system: particles + group: "A" + follow: "E" + + emitRatePerParticle: 128 + lifeSpan: 2400 + emitWidth: TrailEmitter.ParticleSize + emitHeight: TrailEmitter.ParticleSize + emitShape: EllipseShape{} + + velocity: PointDirection {yVariation: 16; xVariation: 16} + acceleration: PointDirection {y: -16} + + size: 24 + sizeVariation: 8 + endSize: 8 + } + + Emitter { + id: balls + system: particles + group: "E" + + y: parent.height + width: parent.width + + emitRate: 2 + lifeSpan: 7000 + + velocity: PointDirection {y:-17*4*2; xVariation: 6*6} + acceleration: PointDirection {y: 17*2; xVariation: 6*6} + + size: 8 + sizeVariation: 4 + } + + Turbulence { //A bit of turbulence makes the smoke look better + anchors.fill: parent + groups: ["A","B"] + strength: 32 + system: particles + } + } +} + diff --git a/basicsuite/Qt5 Particles Demo/content/velocityfrommotion.qml b/basicsuite/Qt5 Particles Demo/content/velocityfrommotion.qml new file mode 100644 index 0000000..40698b1 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/content/velocityfrommotion.qml @@ -0,0 +1,312 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle { + + id: root + + height: 540 + width: 360 + + gradient: Gradient { + GradientStop { position: 0; color: "#000020" } + GradientStop { position: 1; color: "#000000" } + } + + MouseArea { + id: mouseArea + anchors.fill: root + } + + ParticleSystem { id: sys1 } + ImageParticle { + system: sys1 + source: "../images/particle.png" + color: "cyan" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "cyan" + to: "magenta" + duration: 1000 + } + ColorAnimation { + from: "magenta" + to: "blue" + duration: 2000 + } + ColorAnimation { + from: "blue" + to: "violet" + duration: 2000 + } + ColorAnimation { + from: "violet" + to: "cyan" + duration: 2000 + } + } + colorVariation: 0.3 + } + //! [0] + Emitter { + id: trailsNormal + system: sys1 + + emitRate: 500 + lifeSpan: 2000 + + y: mouseArea.pressed ? mouseArea.mouseY : circle.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle.cx + + velocity: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} + velocityFromMovement: 8 + + size: 8 + sizeVariation: 4 + } + //! [0] + ParticleSystem { id: sys2 } + ImageParticle { + color: "cyan" + system: sys2 + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "magenta" + to: "cyan" + duration: 1000 + } + ColorAnimation { + from: "cyan" + to: "magenta" + duration: 2000 + } + } + colorVariation: 0.5 + source: "../images/star.png" + } + Emitter { + id: trailsStars + system: sys2 + + emitRate: 100 + lifeSpan: 2200 + + + y: mouseArea.pressed ? mouseArea.mouseY : circle.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle.cx + + velocity: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} + velocityFromMovement: 8 + + size: 22 + sizeVariation: 4 + } + ParticleSystem { id: sys3; } + ImageParticle { + source: "../images/particle.png" + system: sys3 + color: "orange" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "red" + to: "green" + duration: 2000 + } + ColorAnimation { + from: "green" + to: "red" + duration: 2000 + } + } + + colorVariation: 0.2 + + } + Emitter { + id: trailsNormal2 + system: sys3 + + emitRate: 300 + lifeSpan: 2000 + + y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx + + velocityFromMovement: 16 + + velocity: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} + + size: 12 + sizeVariation: 4 + } + ParticleSystem { id: sys4; } + ImageParticle { + system: sys4 + source: "../images/star.png" + color: "green" + alpha: 0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { + from: "green" + to: "red" + duration: 2000 + } + ColorAnimation { + from: "red" + to: "green" + duration: 2000 + } + } + + colorVariation: 0.5 + } + Emitter { + id: trailsStars2 + system: sys4 + + emitRate: 50 + lifeSpan: 2200 + + + y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy + x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx + + velocityFromMovement: 16 + velocity: PointDirection {xVariation: 2; yVariation: 2;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} + + size: 22 + sizeVariation: 4 + } + + + + color: "white" + + Item { + id: circle + //anchors.fill: parent + property real radius: 0 + property real dx: root.width / 2 + property real dy: root.height / 2 + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { + duration: 1000 + from: 1 + to: 0 + loops: 8 + } + NumberAnimation { + duration: 1000 + from: 0 + to: 1 + loops: 8 + } + + } + + SequentialAnimation on radius { + loops: Animation.Infinite + running: true + NumberAnimation { + duration: 4000 + from: 0 + to: 100 + } + NumberAnimation { + duration: 4000 + from: 100 + to: 0 + } + } + } + + Item { + id: circle3 + property real radius: 100 + property real dx: root.width / 2 + property real dy: root.height / 2 + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { from: 0.0; to: 1 ; duration: 10000; } + } + } + + Item { + id: circle2 + property real radius: 30 + property real dx: circle3.cx + property real dy: circle3.cy + property real cx: radius * Math.sin(percent*6.283185307179) + dx + property real cy: radius * Math.cos(percent*6.283185307179) + dy + property real percent: 0 + + SequentialAnimation on percent { + loops: Animation.Infinite + running: true + NumberAnimation { from: 0.0; to: 1 ; duration: 1000; } + } + } + +} diff --git a/basicsuite/Qt5 Particles Demo/doc/images/qml-emitters-example.png b/basicsuite/Qt5 Particles Demo/doc/images/qml-emitters-example.png Binary files differnew file mode 100644 index 0000000..0025afd --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/doc/images/qml-emitters-example.png diff --git a/basicsuite/Qt5 Particles Demo/doc/src/emitters.qdoc b/basicsuite/Qt5 Particles Demo/doc/src/emitters.qdoc new file mode 100644 index 0000000..5644ab1 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/doc/src/emitters.qdoc @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title QtQuick.Particles Examples - Emitters + \example quick/particles/emitters + \brief This is a collection of examples using Emitters in the QML particle system. + \image qml-emitters-example.png + + This is a collection of small QML examples relating to using Emitters in the particle system. + Each example is a small QML file emphasizing a particular element or feature. + + Velocity from motion gives the effect of strong particle motion through primarily moving the emitters: + \snippet quick/particles/emitters/content/velocityfrommotion.qml 0 + + Burst and pulse calls the burst and pulse methods on two idential emitters. + \snippet quick/particles/emitters/content/burstandpulse.qml 0 + Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for. + This gives a slightly different behaviour, which is easy to see in this example. + + Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted; + \snippet quick/particles/emitters/content/customemitter.qml 0 + This is used to emit curving particles in six rotating spokes. + + Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape. + \snippet quick/particles/emitters/content/emitmask.qml 0 + + Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached. + + Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection + \snippet quick/particles/emitters/content/shapeanddirection.qml 0 + This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center. + + TrailEmitter uses that element to add smoke particles to trail the fire particles in the scene. + \snippet quick/particles/emitters/content/customemitter.qml 0 + +*/ diff --git a/basicsuite/Qt5 Particles Demo/emitters.pro b/basicsuite/Qt5 Particles Demo/emitters.pro new file mode 100644 index 0000000..c5d8b8b --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/emitters.pro @@ -0,0 +1,11 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += \ + emitters.qrc \ + ../images.qrc \ + ../../shared/shared.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/emitters +INSTALLS += target diff --git a/basicsuite/Qt5 Particles Demo/emitters.qmlproject b/basicsuite/Qt5 Particles Demo/emitters.qmlproject new file mode 100644 index 0000000..5379aac --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/emitters.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "emitters.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/basicsuite/Qt5 Particles Demo/emitters.qrc b/basicsuite/Qt5 Particles Demo/emitters.qrc new file mode 100644 index 0000000..708c868 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/emitters.qrc @@ -0,0 +1,12 @@ +<RCC> + <qresource prefix="/particles/emitters"> + <file>emitters.qml</file> + <file>content/burstandpulse.qml</file> + <file>content/customemitter.qml</file> + <file>content/emitmask.qml</file> + <file>content/maximumemitted.qml</file> + <file>content/shapeanddirection.qml</file> + <file>content/trailemitter.qml</file> + <file>content/velocityfrommotion.qml</file> + </qresource> +</RCC> diff --git a/basicsuite/Qt5 Particles Demo/icon.png b/basicsuite/Qt5 Particles Demo/icon.png Binary files differnew file mode 100755 index 0000000..a418e30 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/icon.png diff --git a/basicsuite/Qt5 Particles Demo/images/_explo.png b/basicsuite/Qt5 Particles Demo/images/_explo.png Binary files differnew file mode 100644 index 0000000..4297245 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/_explo.png diff --git a/basicsuite/Qt5 Particles Demo/images/backgroundLeaves.jpg b/basicsuite/Qt5 Particles Demo/images/backgroundLeaves.jpg Binary files differnew file mode 100755 index 0000000..08be167 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/backgroundLeaves.jpg diff --git a/basicsuite/Qt5 Particles Demo/images/bear_tiles.png b/basicsuite/Qt5 Particles Demo/images/bear_tiles.png Binary files differnew file mode 100644 index 0000000..6bbb2a9 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/bear_tiles.png diff --git a/basicsuite/Qt5 Particles Demo/images/candle.png b/basicsuite/Qt5 Particles Demo/images/candle.png Binary files differnew file mode 100644 index 0000000..8fa3193 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/candle.png diff --git a/basicsuite/Qt5 Particles Demo/images/colortable.png b/basicsuite/Qt5 Particles Demo/images/colortable.png Binary files differnew file mode 100644 index 0000000..a62ceeb --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/colortable.png diff --git a/basicsuite/Qt5 Particles Demo/images/finalfrontier.png b/basicsuite/Qt5 Particles Demo/images/finalfrontier.png Binary files differnew file mode 100644 index 0000000..2ba1815 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/finalfrontier.png diff --git a/basicsuite/Qt5 Particles Demo/images/flower.png b/basicsuite/Qt5 Particles Demo/images/flower.png Binary files differnew file mode 100644 index 0000000..b5c6062 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/flower.png diff --git a/basicsuite/Qt5 Particles Demo/images/matchmask.png b/basicsuite/Qt5 Particles Demo/images/matchmask.png Binary files differnew file mode 100644 index 0000000..e575875 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/matchmask.png diff --git a/basicsuite/Qt5 Particles Demo/images/meteor.png b/basicsuite/Qt5 Particles Demo/images/meteor.png Binary files differnew file mode 100644 index 0000000..e8c368a --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/meteor.png diff --git a/basicsuite/Qt5 Particles Demo/images/meteor_explo.png b/basicsuite/Qt5 Particles Demo/images/meteor_explo.png Binary files differnew file mode 100644 index 0000000..e659bfe --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/meteor_explo.png diff --git a/basicsuite/Qt5 Particles Demo/images/meteors.png b/basicsuite/Qt5 Particles Demo/images/meteors.png Binary files differnew file mode 100644 index 0000000..bada8a1 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/meteors.png diff --git a/basicsuite/Qt5 Particles Demo/images/nullRock.png b/basicsuite/Qt5 Particles Demo/images/nullRock.png Binary files differnew file mode 100644 index 0000000..4076327 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/nullRock.png diff --git a/basicsuite/Qt5 Particles Demo/images/particle.png b/basicsuite/Qt5 Particles Demo/images/particle.png Binary files differnew file mode 100644 index 0000000..5c83896 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/particle.png diff --git a/basicsuite/Qt5 Particles Demo/images/particle2.png b/basicsuite/Qt5 Particles Demo/images/particle2.png Binary files differnew file mode 100644 index 0000000..36349c6 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/particle2.png diff --git a/basicsuite/Qt5 Particles Demo/images/particle3.png b/basicsuite/Qt5 Particles Demo/images/particle3.png Binary files differnew file mode 100644 index 0000000..905d8f3 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/particle3.png diff --git a/basicsuite/Qt5 Particles Demo/images/particle4.png b/basicsuite/Qt5 Particles Demo/images/particle4.png Binary files differnew file mode 100644 index 0000000..bc95b70 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/particle4.png diff --git a/basicsuite/Qt5 Particles Demo/images/particleA.png b/basicsuite/Qt5 Particles Demo/images/particleA.png Binary files differnew file mode 100644 index 0000000..c63acde --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/particleA.png diff --git a/basicsuite/Qt5 Particles Demo/images/portal_bg.png b/basicsuite/Qt5 Particles Demo/images/portal_bg.png Binary files differnew file mode 100644 index 0000000..3c59eea --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/portal_bg.png diff --git a/basicsuite/Qt5 Particles Demo/images/realLeaf1.png b/basicsuite/Qt5 Particles Demo/images/realLeaf1.png Binary files differnew file mode 100644 index 0000000..6cabf29 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/realLeaf1.png diff --git a/basicsuite/Qt5 Particles Demo/images/realLeaf2.png b/basicsuite/Qt5 Particles Demo/images/realLeaf2.png Binary files differnew file mode 100644 index 0000000..bfeca86 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/realLeaf2.png diff --git a/basicsuite/Qt5 Particles Demo/images/realLeaf3.png b/basicsuite/Qt5 Particles Demo/images/realLeaf3.png Binary files differnew file mode 100644 index 0000000..b1071e8 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/realLeaf3.png diff --git a/basicsuite/Qt5 Particles Demo/images/realLeaf4.png b/basicsuite/Qt5 Particles Demo/images/realLeaf4.png Binary files differnew file mode 100644 index 0000000..d61d53d --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/realLeaf4.png diff --git a/basicsuite/Qt5 Particles Demo/images/rocket.png b/basicsuite/Qt5 Particles Demo/images/rocket.png Binary files differnew file mode 100644 index 0000000..a171610 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/rocket.png diff --git a/basicsuite/Qt5 Particles Demo/images/rocket2.png b/basicsuite/Qt5 Particles Demo/images/rocket2.png Binary files differnew file mode 100644 index 0000000..7110f8f --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/rocket2.png diff --git a/basicsuite/Qt5 Particles Demo/images/sizeInOut.png b/basicsuite/Qt5 Particles Demo/images/sizeInOut.png Binary files differnew file mode 100644 index 0000000..0a306ea --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/sizeInOut.png diff --git a/basicsuite/Qt5 Particles Demo/images/snowflake.png b/basicsuite/Qt5 Particles Demo/images/snowflake.png Binary files differnew file mode 100644 index 0000000..490887a --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/snowflake.png diff --git a/basicsuite/Qt5 Particles Demo/images/sparkleSize.png b/basicsuite/Qt5 Particles Demo/images/sparkleSize.png Binary files differnew file mode 100644 index 0000000..7520565 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/sparkleSize.png diff --git a/basicsuite/Qt5 Particles Demo/images/star.png b/basicsuite/Qt5 Particles Demo/images/star.png Binary files differnew file mode 100644 index 0000000..0d592cf --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/star.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_0.png b/basicsuite/Qt5 Particles Demo/images/starfish_0.png Binary files differnew file mode 100644 index 0000000..8747f02 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_0.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_1.png b/basicsuite/Qt5 Particles Demo/images/starfish_1.png Binary files differnew file mode 100644 index 0000000..1f3f159 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_1.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_2.png b/basicsuite/Qt5 Particles Demo/images/starfish_2.png Binary files differnew file mode 100644 index 0000000..c6c7e5a --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_2.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_3.png b/basicsuite/Qt5 Particles Demo/images/starfish_3.png Binary files differnew file mode 100644 index 0000000..307a89f --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_3.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_4.png b/basicsuite/Qt5 Particles Demo/images/starfish_4.png Binary files differnew file mode 100644 index 0000000..d61c265 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_4.png diff --git a/basicsuite/Qt5 Particles Demo/images/starfish_mask.png b/basicsuite/Qt5 Particles Demo/images/starfish_mask.png Binary files differnew file mode 100644 index 0000000..2ef74f9 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/images/starfish_mask.png diff --git a/basicsuite/Qt5 Particles Demo/main.cpp b/basicsuite/Qt5 Particles Demo/main.cpp new file mode 100644 index 0000000..66e7ce4 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(particles/emitters/emitters) diff --git a/basicsuite/Qt5 Particles Demo/main.qml b/basicsuite/Qt5 Particles Demo/main.qml new file mode 100644 index 0000000..2b9a338 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/main.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 "shared" as Examples + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("content/velocityfrommotion.qml")); + addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("content/burstandpulse.qml")); + addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("content/customemitter.qml")); + addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("content/emitmask.qml")); + addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("content/maximumemitted.qml")); + addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("content/shapeanddirection.qml")); + addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("content/trailemitter.qml")); + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/shared/Button.qml b/basicsuite/Qt5 Particles Demo/shared/Button.qml new file mode 100644 index 0000000..9bbc01a --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/Button.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +Item { + id: container + + property string text: "Button" + property string subText: "" + signal clicked + property alias containsMouse: mouseArea.containsMouse + property alias pressed: mouseArea.pressed + implicitHeight: col.height + height: implicitHeight + width: buttonLabel.width + 20 + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + hoverEnabled: true + } + + Column { + spacing: 2 + id: col + anchors.verticalCenter: parent.verticalCenter + width: parent.width + Text { + id: buttonLabel + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + text: container.text + color: "black" + font.pixelSize: 22 + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + styleColor: "white" + style: Text.Raised + + } + Text { + id: buttonLabel2 + anchors.left: parent.left + anchors.leftMargin: 10 + text: container.subText + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: "#666" + font.pixelSize: 12 + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/shared/LauncherList.qml b/basicsuite/Qt5 Particles Demo/shared/LauncherList.qml new file mode 100644 index 0000000..20f9c2b --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/LauncherList.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + //model is a list of {"name":"somename", "url":"file:///some/url/mainfile.qml"} + //function used to add to model A) to enforce scheme B) to allow Qt.resolveUrl in url assignments + + color: "#eee" + function addExample(name, desc, url) + { + myModel.append({"name":name, "description":desc, "url":url}) + } + function hideExample() + { + ei.visible = false; + } + + ListView { + clip: true + delegate: SimpleLauncherDelegate{exampleItem: ei} + model: ListModel {id:myModel} + anchors.fill: parent + } + + Item { + id: ei + visible: false + clip: true + property url exampleUrl + onExampleUrlChanged: visible = (exampleUrl == '' ? false : true); //Setting exampleUrl automatically shows example + anchors.fill: parent + anchors.bottomMargin: 40 + Rectangle { + id: bg + anchors.fill: parent + color: "white" + } + MouseArea{ + anchors.fill: parent + enabled: ei.visible + //Eats mouse events + } + Loader{ + focus: true + source: ei.exampleUrl + anchors.fill: parent + } + } + Rectangle { + id: bar + visible: ei.visible + anchors.bottom: parent.bottom + width: parent.width + height: 40 + + Rectangle { + height: 1 + color: "#ccc" + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } + + Rectangle { + height: 1 + color: "#fff" + anchors.top: parent.top + anchors.topMargin: 1 + anchors.left: parent.left + anchors.right: parent.right + } + + gradient: Gradient { + GradientStop { position: 0 ; color: "#eee" } + GradientStop { position: 1 ; color: "#ccc" } + } + + MouseArea{ + anchors.fill: parent + enabled: ei.visible + //Eats mouse events + } + + Image { + id: back + source: "images/back.png" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 2 + anchors.left: parent.left + anchors.leftMargin: 16 + + MouseArea { + id: mouse + hoverEnabled: true + anchors.centerIn: parent + width: 38 + height: 31 + anchors.verticalCenterOffset: -1 + onClicked: ei.exampleUrl = "" + Rectangle { + anchors.fill: parent + opacity: mouse.pressed ? 1 : 0 + Behavior on opacity { NumberAnimation{ duration: 100 }} + gradient: Gradient { + GradientStop { position: 0 ; color: "#22000000" } + GradientStop { position: 0.2 ; color: "#11000000" } + } + border.color: "darkgray" + antialiasing: true + radius: 4 + } + } + } + } +} diff --git a/basicsuite/Qt5 Particles Demo/shared/README b/basicsuite/Qt5 Particles Demo/shared/README new file mode 100644 index 0000000..bf16f23 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/README @@ -0,0 +1,11 @@ +These files are shared between multiple examples as a set of common and +reusuable components. While they do demonstrate the building of reusable +components in QML, they are not official examples themselves. +Consequently they do not have entries in the Qt documentation, and are +documented only through the code comments within the files. Developers +new to QML are strongly encouraged to go through the official examples +before delving into this directory. + +For most application use, see the Qt Quick Components project to find +ready-made Components you can use in your own projects. Qt Declarative +examples do not use them only to avoid external dependencies. diff --git a/basicsuite/Qt5 Particles Demo/shared/SimpleLauncherDelegate.qml b/basicsuite/Qt5 Particles Demo/shared/SimpleLauncherDelegate.qml new file mode 100644 index 0000000..e891266 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/SimpleLauncherDelegate.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + id: container + property Item exampleItem + width: ListView.view.width + height: button.implicitHeight + 22 + + gradient: Gradient { + GradientStop { + position: 0 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : "#fff" + } + GradientStop { + position: 1 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : button.containsMouse ? "#f5f5f5" : "#eee" + } + } + + Image { + id: image + opacity: 0.7 + Behavior on opacity {NumberAnimation {duration: 100}} + source: "images/next.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 16 + } + + Button { + id: button + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right:image.left + text: name + subText: description + onClicked: exampleItem.exampleUrl = url; + } + + Rectangle { + height: 1 + color: "#ccc" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/basicsuite/Qt5 Particles Demo/shared/images/back.png b/basicsuite/Qt5 Particles Demo/shared/images/back.png Binary files differnew file mode 100644 index 0000000..5340209 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/images/back.png diff --git a/basicsuite/Qt5 Particles Demo/shared/images/next.png b/basicsuite/Qt5 Particles Demo/shared/images/next.png Binary files differnew file mode 100644 index 0000000..cdef8db --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/images/next.png diff --git a/basicsuite/Qt5 Particles Demo/shared/qmldir b/basicsuite/Qt5 Particles Demo/shared/qmldir new file mode 100644 index 0000000..2f1e56a --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/qmldir @@ -0,0 +1,3 @@ +Button 2.0 Button.qml +LauncherList 2.0 LauncherList.qml +SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml diff --git a/basicsuite/Qt5 Particles Demo/shared/quick_shared.qrc b/basicsuite/Qt5 Particles Demo/shared/quick_shared.qrc new file mode 100644 index 0000000..9fc114d --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/quick_shared.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/quick/shared"> + <file>LauncherList.qml</file> + <file>SimpleLauncherDelegate.qml</file> + <file>Button.qml</file> + <file>images/back.png</file> + </qresource> +</RCC> diff --git a/basicsuite/Qt5 Particles Demo/shared/shared.h b/basicsuite/Qt5 Particles Demo/shared/shared.h new file mode 100644 index 0000000..eab15f3 --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/shared.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QDir> +#include <QGuiApplication> +#include <QQmlEngine> +#include <QQuickView> +#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ +{\ + QGuiApplication app(argc,argv);\ + QQuickView view;\ + view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ + view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + if (QGuiApplication::platformName() == QLatin1String("qnx") || \ + QGuiApplication::platformName() == QLatin1String("eglfs")) {\ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ + view.showFullScreen();\ + } else {\ + view.show();\ + }\ + return app.exec();\ +} diff --git a/basicsuite/Qt5 Particles Demo/shared/shared.qrc b/basicsuite/Qt5 Particles Demo/shared/shared.qrc new file mode 100644 index 0000000..4ac856e --- /dev/null +++ b/basicsuite/Qt5 Particles Demo/shared/shared.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/shared"> + <file>LauncherList.qml</file> + <file>SimpleLauncherDelegate.qml</file> + <file>Button.qml</file> + <file>images/back.png</file> + </qresource> +</RCC> |