diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-09-06 10:40:21 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-08 08:16:48 +0200 |
commit | 1aa012a1c83ce8905e5440d3e7ae11192dc73878 (patch) | |
tree | 813b36a8637c21e9f33c858daed24b57e2b2115e /examples/declarative/particles | |
parent | 63982ebb2cd0aa28c456e25cc9edb400b5b881d9 (diff) |
Particles module refactoring en masse
All the little changes in one commit.
StochasticDirection -> Direction
AngledDirection -> AngleDirection
TargetedDirection -> TargetDirection
QSGCustomParticle is now Affector's implementation (C++ only refactor)
FollowEmitter -> TrailEmitter
Kill -> Age and gained lifeLeft property
ModelParticle is removed, use ItemParticle instead.
Added RectangleShape to replace Shape for the case of Rectangles
Abstract Types are no longer createable, despite sensible defaults.
GLSL variables in CustomParticle now begin with qt_
JS variables are now such that x,vx,ax are current (old ones are now
initialX, initialVX, initialAX). Same for y. A few more were extended.
Emitter::emitCap -> Emitter::maximumEmitted. Set to -1 for noCap: false
Emitter::noCap is gone.
Emitter::emitting -> Emitter::enabled
Affector::active -> Affector::enabled
Affector::collisionParticles -> Affector::whenCollidingWith
Affector::signal is gone.
PointAttractor -> Attractor
Attractor/Wander::physics -> ::affectedParameter
ParticleSystem::fastForward is gone
ParticleSystem::startTime is gone (use Emitter::startTime)
ParticleSystem::clear -> ParticleSystem::empty
And various Doc fixes.
Change-Id: Ia3b02b987f692e6f1bd14c42e575381bdfb7bbb5
Reviewed-on: http://codereview.qt-project.org/4231
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'examples/declarative/particles')
47 files changed, 110 insertions, 1593 deletions
diff --git a/examples/declarative/particles/allsmiles/plain.qml b/examples/declarative/particles/allsmiles/plain.qml index 890a5782d1..89198845b8 100644 --- a/examples/declarative/particles/allsmiles/plain.qml +++ b/examples/declarative/particles/allsmiles/plain.qml @@ -17,7 +17,7 @@ Rectangle{ emitRate: 1000 size: 20 lifeSpan: 10000 - speed: AngledDirection{angleVariation: 360; magnitudeVariation: 100;} + speed: AngleDirection{angleVariation: 360; magnitudeVariation: 100;} } MouseArea{ anchors.fill: parent diff --git a/examples/declarative/particles/allsmiles/smile.qml b/examples/declarative/particles/allsmiles/smile.qml index bfce60cc4a..e091d99e80 100644 --- a/examples/declarative/particles/allsmiles/smile.qml +++ b/examples/declarative/particles/allsmiles/smile.qml @@ -77,8 +77,8 @@ Rectangle{ uniform lowp float qt_Opacity; void main() { - fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight); - highp float t = (timestamp - vData.x) / vData.y; + fTex2 = vec2(qt_ParticlePos.x / maxWidth, qt_ParticlePos.y / maxHeight); + highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity; defaultMain(); } @@ -88,19 +88,19 @@ Rectangle{ fragmentShader: " uniform sampler2D particleTexture; uniform sampler2D pictureTexture; - varying highp vec2 fTex; + varying highp vec2 qt_TexCoord0; varying highp vec2 fTex2; varying lowp float fFade; void main() { - gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, fTex).w * fFade; + gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade; }" } Emitter{ id: emitter system: sys - emitting: false + enabled: false lifeSpan: 4000 - emitCap: 1200 + maximumEmitted: 1200 anchors.fill: parent size: 32 speed: PointDirection{ xVariation: 12; yVariation: 12 } diff --git a/examples/declarative/particles/allsmiles/smilefactory.qml b/examples/declarative/particles/allsmiles/smilefactory.qml index 5b36eee3cd..fe651491b9 100644 --- a/examples/declarative/particles/allsmiles/smilefactory.qml +++ b/examples/declarative/particles/allsmiles/smilefactory.qml @@ -58,33 +58,33 @@ Rectangle{ system: sys particles: ["goingDown"] source: "content/squarefacespriteXX.png" - rotation: 180 yVector: PointDirection{ y: 0.5; yVariation: 0.25; xVariation: 0.25; } + rotation: 180 } Timer{ running: true repeat: false interval: 100 - onTriggered: emitA.emitting = true; + onTriggered: emitA.enabled = true; } Timer{ running: true repeat: false interval: 4200 - onTriggered: emitB.emitting = true; + onTriggered: emitB.enabled = true; } Timer{ running: true repeat: false interval: 8400 - onTriggered: emitC.emitting = true; + onTriggered: emitC.enabled = true; } Emitter{ id: emitA x: 0 y: 120 system: sys - emitting: false + enabled: false particle: "goingRight" speed: PointDirection{ x: 100 } lifeSpan: 4000 @@ -96,7 +96,7 @@ Rectangle{ x: 400 y: 240 system: sys - emitting: false + enabled: false particle: "goingLeft" speed: PointDirection{ x: -100 } lifeSpan: 4000 @@ -108,7 +108,7 @@ Rectangle{ x: 0 y: 360 system: sys - emitting: false + enabled: false particle: "goingDown" speed: PointDirection{ x: 100 } lifeSpan: 4000 diff --git a/examples/declarative/particles/allsmiles/spriteparticles.qml b/examples/declarative/particles/allsmiles/spriteparticles.qml index f5479f1570..705016e050 100644 --- a/examples/declarative/particles/allsmiles/spriteparticles.qml +++ b/examples/declarative/particles/allsmiles/spriteparticles.qml @@ -78,7 +78,6 @@ Rectangle{ id: particles2 emitRate: 6000 lifeSpan: 720 - emitting: true size: 10 shape: mask } @@ -89,7 +88,6 @@ Rectangle{ id: particles emitRate: 60 lifeSpan: 1440 - emitting: true speed: PointDirection{xVariation: 10; yVariation: 10;} size: 30 sizeVariation: 10 diff --git a/examples/declarative/particles/allsmiles/spritestateparticles.qml b/examples/declarative/particles/allsmiles/spritestateparticles.qml index a599c69a63..06b78cdba4 100644 --- a/examples/declarative/particles/allsmiles/spritestateparticles.qml +++ b/examples/declarative/particles/allsmiles/spritestateparticles.qml @@ -172,8 +172,7 @@ Rectangle{ system: sys emitRate: 16 lifeSpan: 10000 - emitting: true - speed: AngledDirection{angle: 90; magnitude: 60; angleVariation: 5} + speed: AngleDirection{angle: 90; magnitude: 60; angleVariation: 5} acceleration: PointDirection{ y: 10 } size: 30 sizeVariation: 10 diff --git a/examples/declarative/particles/allsmiles/spritevariedparticles.qml b/examples/declarative/particles/allsmiles/spritevariedparticles.qml index d6e13727ff..4696bfb4ff 100644 --- a/examples/declarative/particles/allsmiles/spritevariedparticles.qml +++ b/examples/declarative/particles/allsmiles/spritevariedparticles.qml @@ -98,8 +98,7 @@ Rectangle{ width: parent.width emitRate: 16 lifeSpan: 8000 - emitting: true - speed: AngledDirection{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5} + speed: AngleDirection{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5} acceleration: PointDirection{ y: 10 } size: 30 sizeVariation: 10 diff --git a/examples/declarative/particles/allsmiles/ultraparticles.qml b/examples/declarative/particles/allsmiles/ultraparticles.qml index eda1c8f859..9094e83801 100644 --- a/examples/declarative/particles/allsmiles/ultraparticles.qml +++ b/examples/declarative/particles/allsmiles/ultraparticles.qml @@ -86,8 +86,7 @@ Rectangle{ id: particles emitRate: 200 lifeSpan: 6000 - emitting: true - speed: AngledDirection{angleVariation: 360; magnitude: 80; magnitudeVariation: 40} + speed: AngleDirection{angleVariation: 360; magnitude: 80; magnitudeVariation: 40} size: 40 endSize: 80 } diff --git a/examples/declarative/particles/asteroid/asteroid.qml b/examples/declarative/particles/asteroid/asteroid.qml index 2ecfc42a98..ea2fabd51d 100644 --- a/examples/declarative/particles/asteroid/asteroid.qml +++ b/examples/declarative/particles/asteroid/asteroid.qml @@ -94,7 +94,6 @@ Item { particle: "meteor" emitRate: 12 lifeSpan: 5000 - emitting: true acceleration: PointDirection{ xVariation: 80; yVariation: 80; } size: 15 endSize: 300 diff --git a/examples/declarative/particles/asteroid/blackhole.qml b/examples/declarative/particles/asteroid/blackhole.qml index 57474f955e..7e8a7a9edc 100644 --- a/examples/declarative/particles/asteroid/blackhole.qml +++ b/examples/declarative/particles/asteroid/blackhole.qml @@ -70,7 +70,7 @@ Rectangle{ system: particles emitRate: 40 lifeSpan: 4000 - emitting: true + enabled: true size: 30 sizeVariation: 10 speed: PointDirection{ x: 220; xVariation: 40 } @@ -81,7 +81,7 @@ Rectangle{ system: particles emitRate: 10 lifeSpan: 4000 - emitting: true + enabled: true size: 30 sizeVariation: 10 speed: PointDirection{ x: 220; xVariation: 40 } @@ -145,16 +145,16 @@ Rectangle{ colorVariation: 0.2 } - PointAttractor{ + Attractor{ id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000; system: particles - physics: PointAttractor.Acceleration - proportionalToDistance: PointAttractor.InverseQuadratic + affectedParameter: Attractor.Acceleration + proportionalToDistance: Attractor.InverseQuadratic } - Kill{ + Age{ system: particles - x: gs.x - 8; - y: gs.y - 8; + x: gs.pointX - 8; + y: gs.pointY - 8; width: 16 height: 16 } @@ -174,7 +174,6 @@ Rectangle{ system: particles emitRate: 200 lifeSpan: 1000 - emitting: true size: 10 endSize: 4 sizeVariation: 4 @@ -187,7 +186,7 @@ Rectangle{ system: particles emitRate: 32 lifeSpan: 2000 - emitting: spacePressed + enabled: spacePressed size: 40 speed: PointDirection{ x: 256; } x: parent.width diff --git a/examples/declarative/particles/custom/blurparticles.qml b/examples/declarative/particles/custom/blurparticles.qml index 238608c002..df0fa18971 100644 --- a/examples/declarative/particles/custom/blurparticles.qml +++ b/examples/declarative/particles/custom/blurparticles.qml @@ -75,7 +75,7 @@ Rectangle{ void main() { defaultMain(); - highp float t = (timestamp - vData.x) / vData.y; + highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; highp float fadeIn = min(t * 10., 1.); highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); @@ -126,11 +126,11 @@ Rectangle{ fragmentShader: " uniform sampler2D source; uniform sampler2D blurred; - varying highp vec2 fTex; + varying highp vec2 qt_TexCoord0; varying highp float fBlur; varying highp float fFade; void main() { - gl_FragColor = mix(texture2D(source, fTex), texture2D(blurred, fTex), min(1.0,fBlur*3.0)) * fFade; + gl_FragColor = mix(texture2D(source, qt_TexCoord0), texture2D(blurred, qt_TexCoord0), min(1.0,fBlur*3.0)) * fFade; }" } diff --git a/examples/declarative/particles/custom/custom.qml b/examples/declarative/particles/custom/custom.qml index 4b75cf6ebe..50de60b332 100644 --- a/examples/declarative/particles/custom/custom.qml +++ b/examples/declarative/particles/custom/custom.qml @@ -5,6 +5,7 @@ ParticleSystem{ id: sys width: 360 height: 600 + running: true Rectangle{ z: -1 anchors.fill: parent @@ -33,14 +34,14 @@ ParticleSystem{ size: 12 anchors.centerIn: parent onEmitParticle:{ - particle.size = Math.max(12,Math.min(492,Math.tan(particle.t/2)*24)); + particle.startSize = Math.max(12,Math.min(492,Math.tan(particle.t/2)*24)); var theta = Math.floor(Math.random() * 6.0) / 6.0; theta *= 2.0*Math.PI; theta += sys.convert(sys.petalRotation); - particle.vx = petalLength * Math.cos(theta); - particle.vy = petalLength * Math.sin(theta); - particle.ax = particle.vx * -0.5; - particle.ay = particle.vy * -0.5; + particle.initialVX = petalLength * Math.cos(theta); + particle.initialVY = petalLength * Math.sin(theta); + particle.initialAX = particle.initialVX * -0.5; + particle.initialAY = particle.initialVY * -0.5; } } CustomParticle{ @@ -50,21 +51,21 @@ ParticleSystem{ varying highp vec2 fPos; void main() { - fTex = vTex; - highp float size = vData.z; - highp float endSize = vData.w; + qt_TexCoord0 = qt_ParticleTex; + highp float size = qt_ParticleData.z; + highp float endSize = qt_ParticleData.w; - highp float t = (timestamp - vData.x) / vData.y; + highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; highp float currentSize = mix(size, endSize, t * t); if (t < 0. || t > 1.) currentSize = 0.; - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); + highp vec2 pos = qt_ParticlePos + - currentSize / 2. + currentSize * qt_ParticleTex // adjust size + + qt_ParticleVec.xy * t * qt_ParticleData.y // apply speed vector.. + + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.); gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); @@ -78,9 +79,9 @@ ParticleSystem{ fragmentShader: " varying highp vec2 fPos; varying lowp float fFade; - varying highp vec2 fTex; + varying highp vec2 qt_TexCoord0; void main() {//*2 because this generates dark colors mostly - highp vec2 circlePos = fTex*2.0 - vec2(1.0,1.0); + highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0); highp float dist = length(circlePos); highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0); gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade; diff --git a/examples/declarative/particles/custom/delegates.qml b/examples/declarative/particles/custom/delegates.qml index 4b01c66396..960a398fcb 100644 --- a/examples/declarative/particles/custom/delegates.qml +++ b/examples/declarative/particles/custom/delegates.qml @@ -75,7 +75,7 @@ Rectangle{ emitRate: 1 lifeSpan: 4800 lifeSpanVariation: 1600 - speed: AngledDirection{angleVariation: 360; magnitude: 40; magnitudeVariation: 20} + speed: AngleDirection{angleVariation: 360; magnitude: 40; magnitudeVariation: 20} } ItemParticle{ delegate: Text{ diff --git a/examples/declarative/particles/custom/fallingleaves.qml b/examples/declarative/particles/custom/fallingleaves.qml index 3572490451..55fa77ffe9 100644 --- a/examples/declarative/particles/custom/fallingleaves.qml +++ b/examples/declarative/particles/custom/fallingleaves.qml @@ -53,6 +53,7 @@ Item { particle.r -= particle.rotation * coefficient; if (particle.r == 0.0) particle.r -= particle.rotation * 0.000001; + particle.update = 1; } } @@ -65,16 +66,17 @@ Item { anchors.bottom: parent.bottom onAffectParticle:{ var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1; - var yslow = pseudoRand * 0.001 + 1.01; - var xslow = pseudoRand * 0.0005 + 1.0; - if (particle.curVY < 1) - particle.curVY == 0; + var yslow = pseudoRand * 0.01 + 1.01; + var xslow = pseudoRand * 0.005 + 1.0; + if (particle.vy < 1) + particle.vy = 0; else - particle.curVY = (particle.curVY / yslow); - if (particle.curVX < 1) - particle.curVX == 0; + particle.vy = (particle.vy / yslow); + if (particle.vx < 1) + particle.vx = 0; else - particle.curVX = (particle.curVX / xslow); + particle.vx = (particle.vx / xslow); + particle.update = 1; } } ImageParticle{ diff --git a/examples/declarative/particles/custom/shader.qml b/examples/declarative/particles/custom/shader.qml index 6253679cb7..df0e3660cf 100644 --- a/examples/declarative/particles/custom/shader.qml +++ b/examples/declarative/particles/custom/shader.qml @@ -33,21 +33,21 @@ ParticleSystem{ varying highp vec2 fPos; void main() { - fTex = vTex; - highp float size = vData.z; - highp float endSize = vData.w; + qt_TexCoord0 = qt_ParticleTex; + highp float size = qt_ParticleData.z; + highp float endSize = qt_ParticleData.w; - highp float t = (timestamp - vData.x) / vData.y; + highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; highp float currentSize = mix(size, endSize, t * t); if (t < 0. || t > 1.) currentSize = 0.; - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); + highp vec2 pos = qt_ParticlePos + - currentSize / 2. + currentSize * qt_ParticleTex // adjust size + + qt_ParticleVec.xy * t * qt_ParticleData.y // apply speed vector.. + + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.); gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); @@ -61,9 +61,9 @@ ParticleSystem{ fragmentShader: " varying highp vec2 fPos; varying lowp float fFade; - varying highp vec2 fTex; + varying highp vec2 qt_TexCoord0; void main() {//*2 because this generates dark colors mostly - highp vec2 circlePos = fTex*2.0 - vec2(1.0,1.0); + highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0); highp float dist = length(circlePos); highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0); gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade; diff --git a/examples/declarative/particles/exampleslauncher.qml b/examples/declarative/particles/exampleslauncher.qml index dfb966536a..91641e595b 100644 --- a/examples/declarative/particles/exampleslauncher.qml +++ b/examples/declarative/particles/exampleslauncher.qml @@ -55,17 +55,12 @@ Rectangle{ VisualDataModel{//TODO: Transitions between modes id: vdm model: [ - "../spaceexplorer/spaceexplorer.qml", "../snow/snow.qml", "../asteroid/asteroid.qml", "../asteroid/blackhole.qml", "../custom/blurparticles.qml", "../custom/custom.qml", "../custom/fallingleaves.qml", - "../modelparticles/bubbles.qml", - "../modelparticles/gridsplosion.qml", - "../modelparticles/package.qml", - "../modelparticles/stream.qml", "../allsmiles/plain.qml", "../allsmiles/smile.qml", "../allsmiles/smilefactory.qml", diff --git a/examples/declarative/particles/modelparticles/bubbles.qml b/examples/declarative/particles/modelparticles/bubbles.qml deleted file mode 100644 index 23f0b82d01..0000000000 --- a/examples/declarative/particles/modelparticles/bubbles.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "../../modelviews/listview/content" as OtherDemo -import "content/script.js" as Script -import "content" -//Needs OtherDemo to be updated to QtQuick 2.0 - -Item{ - id: root - width: 400 - height: 400 - Rectangle{ - anchors.fill: parent - color: "lightsteelblue" - } - ParticleSystem{ - id: sys; - } - Emitter{ - system: sys - particle: "A" - width: parent.width/2 - x: parent.width/4 - y:parent.height - speed: PointDirection{ y: -64; yVariation: 16 } - emitRate: 1 - lifeSpan: 8000 - } - Wander{ - system: sys - xVariance: 400 - pace: 200 - } - ModelParticle{ - id: mp - z: 0 - system: sys - particles: ["A"] - model: OtherDemo.RecipesModel{} - delegate: ExpandingDelegate{} - } -} diff --git a/examples/declarative/particles/modelparticles/content/Delegate.qml b/examples/declarative/particles/modelparticles/content/Delegate.qml deleted file mode 100644 index ae1dffb63b..0000000000 --- a/examples/declarative/particles/modelparticles/content/Delegate.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -//![0] -Package { - Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' } - Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' } - - Rectangle { - id: wrapper - width: 200; height: 25 - color: 'lightsteelblue' - - Text { text: display; anchors.centerIn: parent } - MouseArea { - anchors.fill: parent - onClicked: { - if (wrapper.state == 'inList') - wrapper.state = 'inGrid'; - else - wrapper.state = 'inList'; - } - } - - state: 'inList' - states: [ - State { - name: 'inList' - ParentChange { target: wrapper; parent: listDelegate } - }, - State { - name: 'inGrid' - ParentChange { - target: wrapper; parent: gridDelegate - x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height - } - } - ] - - transitions: [ - Transition { - ParentAnimation { - NumberAnimation { properties: 'x,y,width,height'; duration: 300 } - } - } - ] - } -} -//![0] diff --git a/examples/declarative/particles/modelparticles/content/Delegate2.qml b/examples/declarative/particles/modelparticles/content/Delegate2.qml deleted file mode 100644 index a05fa348b9..0000000000 --- a/examples/declarative/particles/modelparticles/content/Delegate2.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -//![0] -Package { - Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' } - Item { id: particleDelegate; width: w; height: h; Package.name: 'particles' - - Rectangle { - id: wrapper - width: w; height: h; - color: col - rotation: Math.random()*360 - Behavior on rotation{RotationAnimation{}} - - states: State{ - name: "gridded" - when: root.inGrid - PropertyChanges{ - target: wrapper - rotation: 0 - } - ParentChange{ - target: wrapper - parent: gridDelegate - x:0 - y:0 - } - } - transitions: [ - Transition { - ParentAnimation { - NumberAnimation { properties: 'x,y,width,height'; duration: 300 } - } - } - ] - } - } -} -//![0] diff --git a/examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml b/examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml deleted file mode 100644 index e6fcb6dcf7..0000000000 --- a/examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../../../modelviews/listview/content" - -// This example illustrates expanding a list item to show a more detailed view. - - // Delegate for the recipes. This delegate has two modes: - // 1. List mode (default), which just shows the picture and title of the recipe. - // 2. Details mode, which also shows the ingredients and method. - Component { - id: recipeDelegate - - Item { - id: recipe - - // Create a property to contain the visibility of the details. - // We can bind multiple element's opacity to this one property, - // rather than having a "PropertyChanges" line for each element we - // want to fade. - property real detailsOpacity : 0 - - //this bit changed for aesthetics - width: 70 - height: 70 - // A simple rounded rectangle for the background - Rectangle { - id: background - x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 - color: "ivory" - border.color: "orange" - radius: 5 - } - Image{ - anchors.fill:parent - anchors.margins: -32 - source: "bubble.png" - } - - - // This mouse region covers the entire delegate. - // When clicked it changes mode to 'Details'. If we are already - // in Details mode, then no change will happen. - MouseArea { - anchors.fill: parent - onClicked: recipe.state = 'Details'; - } - - // Lay out the page: picture, title and ingredients at the top, and method at the - // bottom. Note that elements that should not be visible in the list - // mode have their opacity set to recipe.detailsOpacity. - Row { - id: topLayout - x: 10; y: 10; height: recipeImage.height; width: parent.width - spacing: 10 - - Image { - id: recipeImage - width: 50; height: 50 - source: "../../modelviews/listview/" + picture - } - - Column { - width: background.width - recipeImage.width - 20; height: recipeImage.height - spacing: 5 - - Text { - text: title - font.bold: true; font.pointSize: 16 - } - - Text { - text: "Ingredients" - font.pointSize: 12; font.bold: true - opacity: recipe.detailsOpacity - } - - Text { - text: ingredients - wrapMode: Text.WordWrap - width: parent.width - opacity: recipe.detailsOpacity - } - } - } - - Item { - id: details - x: 10; width: parent.width - 20 - anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } - opacity: recipe.detailsOpacity - - Text { - id: methodTitle - anchors.top: parent.top - text: "Method" - font.pointSize: 12; font.bold: true - } - - Flickable { - id: flick - width: parent.width - anchors { top: methodTitle.bottom; bottom: parent.bottom } - contentHeight: methodText.height - clip: true - - Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } - } - - Image { - anchors { right: flick.right; top: flick.top } - source: "../../modelviews/listview/" + "content/pics/moreUp.png" - opacity: flick.atYBeginning ? 0 : 1 - } - - Image { - anchors { right: flick.right; bottom: flick.bottom } - source: "../../modelviews/listview/" + "content/pics/moreDown.png" - opacity: flick.atYEnd ? 0 : 1 - } - } - - // A button to close the detailed view, i.e. set the state back to default (''). - TextButton { - y: 10 - anchors { right: background.right; rightMargin: 10 } - opacity: recipe.detailsOpacity - text: "Close" - - onClicked: recipe.state = ''; - } - - states: State { - name: "Details" - - PropertyChanges { target: background; color: "white" } - PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger - PropertyChanges { target: recipe; detailsOpacity: 1; x: 0; opacity: 1 } // Make details visible - PropertyChanges { target: recipe; height: root.height; width: root.height; x:0; y:0; z:100} // Fill the entire list area with the detailed view - - // Move the list so that this item is at the top. - //PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } - - // Disallow flicking while we're in detailed view - //PropertyChanges { target: recipe.ListView.view; interactive: false } - } - - transitions: Transition { - //The only strictly necessary particle specific lines - to: "Details" - reversible: true - ScriptAction{script:{ - if(state == "Details") - mp.freeze(index); - else - mp.unfreeze(index); - } - } - // Make the state changes smooth - ParallelAnimation { - ColorAnimation { property: "color"; duration: 500 } - NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" } - } - } - } - } diff --git a/examples/declarative/particles/modelparticles/content/RssModel.qml b/examples/declarative/particles/modelparticles/content/RssModel.qml deleted file mode 100644 index edb3ceac42..0000000000 --- a/examples/declarative/particles/modelparticles/content/RssModel.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** 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 - -XmlListModel { - property string tags : "" - - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "") - query: "/feed/entry" - namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" - - XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "content"; query: "content/string()" } - XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" } -} diff --git a/examples/declarative/particles/modelparticles/content/bubble.png b/examples/declarative/particles/modelparticles/content/bubble.png Binary files differdeleted file mode 100644 index c7f479e9e3..0000000000 --- a/examples/declarative/particles/modelparticles/content/bubble.png +++ /dev/null diff --git a/examples/declarative/particles/modelparticles/content/script.js b/examples/declarative/particles/modelparticles/content/script.js deleted file mode 100644 index e8ef93a847..0000000000 --- a/examples/declarative/particles/modelparticles/content/script.js +++ /dev/null @@ -1,27 +0,0 @@ -.pragma library - -function getWidth(string) { - return (string.match(/width=\"([0-9]+)\"/))[1] -} - -function getHeight(string) { - return (string.match(/height=\"([0-9]+)\"/))[1] -} - -function getImagePath(string) { - var pattern = /src=\"http:\/\/(\S+)\"/ - return (string.match(pattern))[1] -} - -function calculateScale(width, height, cellSize) { - var widthScale = (cellSize * 1.0) / width - var heightScale = (cellSize * 1.0) / height - var scale = 0 - - if (widthScale <= heightScale) { - scale = widthScale; - } else if (heightScale < widthScale) { - scale = heightScale; - } - return scale; -} diff --git a/examples/declarative/particles/modelparticles/gridsplosion.qml b/examples/declarative/particles/modelparticles/gridsplosion.qml deleted file mode 100644 index 9232eb426d..0000000000 --- a/examples/declarative/particles/modelparticles/gridsplosion.qml +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" - -Rectangle{ - id: root - width: 240 - height: 240 - property bool inGrid: false - ParticleSystem{ id: sys } - Emitter{ - system: sys - id: burster; - emitting: false - emitRate: 1000 - lifeSpan: 50000 - emitCap: 100; - speed: PointDirection{xVariation: 400; yVariation: 400} - anchors.centerIn: parent - Timer{ - interval: 1000 - running: true - repeat: false - onTriggered: burster.pulse(0.1); - } - Timer{ - interval: 2000 - running: true - repeat: false - onTriggered: {inGrid = true;}// sys.running = false;} - } - } - ImageParticle{ - system: sys - source: "../trails/content/particle.png" - color: "black" - colorVariation: 0.0 - } - GridView{ id: grid; cellWidth: 40; cellHeight: 40 - model: theModel.parts.grid - width: 120 - height: 120 - } - ModelParticle{ - system: sys - model: theModel.parts.particles - fade: false - } - Friction{ - system: sys - factor: 5 - } - VisualDataModel{ - id: theModel - delegate: Delegate2{} - model: ListModel{ - ListElement{ - w: 40 - h: 20 - col: "forestgreen" - } - ListElement{ - w: 20 - h: 40 - col: "salmon" - } - ListElement{ - w: 20 - h: 20 - col: "lightsteelblue" - } - ListElement{ - w: 40 - h: 40 - col: "goldenrod" - } - ListElement{ - w: 40 - h: 20 - col: "forestgreen" - } - ListElement{ - w: 20 - h: 40 - col: "salmon" - } - ListElement{ - w: 20 - h: 20 - col: "lightsteelblue" - } - ListElement{ - w: 40 - h: 40 - col: "goldenrod" - } - ListElement{ - w: 0 - h: 0 - col: "white"//Hack because add isn't working well with old stuff - } - } - } -} diff --git a/examples/declarative/particles/modelparticles/package.qml b/examples/declarative/particles/modelparticles/package.qml deleted file mode 100644 index d374a93446..0000000000 --- a/examples/declarative/particles/modelparticles/package.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" - -Rectangle { - color: "white" - width: 400 - height: 200 - - ListModel { - id: myModel - ListElement { display: "One" } - ListElement { display: "Two" } - ListElement { display: "Three" } - ListElement { display: "Four" } - ListElement { display: "Five" } - ListElement { display: "Six" } - ListElement { display: "Seven" } - ListElement { display: "Eight" } - } - //![0] - VisualDataModel { - id: visualModel - delegate: Delegate {} - model: myModel - } - - ListView { - width: 200; height:200 - model: visualModel.parts.list - } - ModelParticle{ - x: 200; width: 200; height:200 - model: visualModel.parts.grid - system: sys - clip: true; - } - //![0] - ParticleSystem{ - id: sys - anchors.fill: parent - } - Emitter{ - system: sys - width: 100 - x: 250 - speed: PointDirection{ y: 40 } - lifeSpan: 5000 - emitRate: 1.6 - } -} diff --git a/examples/declarative/particles/modelparticles/stream.qml b/examples/declarative/particles/modelparticles/stream.qml deleted file mode 100644 index 0938f17cd4..0000000000 --- a/examples/declarative/particles/modelparticles/stream.qml +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content/script.js" as Script -import "content" - -Item{ - id: root - width: 640 - height: 480 - Rectangle{ - anchors.fill: parent - color: "black" - z: -1 - } - Item{ - id: loading - Behavior on opacity{NumberAnimation{}} - anchors.fill: parent - Text{ - anchors.centerIn: parent - text: "Loading" - color: "white" - } - } - ParticleSystem{ - id: sys; - running: true - startTime: 12000//Doesn't actually work with the loading time though... - } - Emitter{ - id: emitter - system: sys - height: parent.height - 132/2 - x: -132/2 - y: 132/2 - speed: PointDirection{ x: 32; xVariation: 8 } - emitRate: 0.5 - lifeSpan: 120000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first) - particle: "photos" - } - Kill{ - system: sys - x: parent.width + 132/2 - height: parent.height - width: 1000 - } - ImageParticle{ - system: sys - particles: ["fireworks"] - source: "../trails/content/star.png" - color: "lightsteelblue" - alpha: 0 - colorVariation: 0 - z: 1000 - } - ItemParticle{ - id: mp - z: 0 - system: sys - fade: false - particles: ["photos"] - } - Component{ - id: alertDelegate - Rectangle{ - width: 132 - height: 132 - NumberAnimation on scale{ - running: true - loops: 1 - from: 0.2 - to: 1 - } - Image{ - source: "../asteroid/content/rocket.png" - anchors.centerIn: parent - } - Text{ - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - text: "A new ship has arrived!" - } - } - } - property Item alertItem; - function alert(){ - //resetter.active = false - force.active = true; - alertItem = alertDelegate.createObject(root); - alertItem.x = root.width/2 - alertItem.width/2 - alertItem.y = root.height/2 - alertItem.height/2 - spawnFireworks.pulse(0.2); - stopAlert.start(); - } - focus: true - Keys.onSpacePressed: alert(); - Timer{ - id: stopAlert - running: false - repeat: false - interval: 800 - onTriggered: { - force.active = false - //resetter.active = true; - mp.take(alertItem, true); - centerEmitter.burst(1); - } - } - PointAttractor{ - id: force - system: sys - pointX: root.width/2 - pointY: root.height/2 - strength: -10000 - active: false - anchors.centerIn: parent - width: parent.width/2 - height: parent.height/2 - particles:["photos"] - physics: PointAttractor.Position - } - Emitter{ - id: centerEmitter - speed: PointDirection{ x: 32; xVariation: 8;} - emitRate: 0.5 - lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first) - emitCap: 20 - particle: "photos" - system: sys - anchors.centerIn: parent - emitting: false - - //TODO: Zoom in effect - } - Emitter{ - id: spawnFireworks - particle: "fireworks" - system: sys - emitCap: 400 - emitRate: 400 - lifeSpan: 2800 - x: parent.width/2 - y: parent.height/2 - 64 - width: 8 - height: 8 - emitting: false - size: 32 - endSize: 8 - speed: AngledDirection{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 } - acceleration: PointDirection{ y: 160 } - } - Item{ x: -1000; y: -1000 //offscreen - Repeater{//Load them here, add to system on completed - model: theModel - delegate: theDelegate - } - } - RssModel{id: theModel; tags:"particle,particles"} - Component { - id: theDelegate - Rectangle { - id: container - border.width: 2 - property real myRand: Math.random();//'depth' - z: Math.floor(myRand * 100) - scale: (myRand + 1.0)/2; - //TODO: Darken based on 'depth' - width: 132 - height: 132 - //ItemParticle.onAttached: console.log("I'm in" + x + "," + y + ":" + opacity); - ItemParticle.onDetached: mp.take(container);//respawns - function manage() - { - if(state == "selected"){ - // console.log("Taking " + index); - mp.freeze(container); - }else{ - // console.log("Returning " +index); - mp.unfreeze(container); - } - } - Image{ - id: img - anchors.centerIn: parent - smooth: true; source: "http://" + Script.getImagePath(content); cache: true - fillMode: Image.PreserveAspectFit; - width: parent.width-4; height: parent.height-4 - onStatusChanged: if(img.status == Image.Ready){ - container.opacity = 0; - loading.opacity = 0; - mp.take(container); - } - } - Text{ - anchors.bottom: parent.bottom - width: parent.width - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideRight - text: title - color: "black" - } - MouseArea{ - anchors.fill: parent - onClicked: container.state == "selected" ? container.state = "" : container.state = "selected" - } - states: State{ - name: "selected" - ParentChange{ - target: container - parent: root - x: 0 - y: 0 - } - PropertyChanges{ - target: container - width: root.width - height: root.height - z: 101 - opacity: 1 - rotation: 0 - } - } - transitions: Transition{ - to: "selected" - reversible: true - SequentialAnimation{ - ScriptAction{script: container.manage();} - ParallelAnimation{ - ParentAnimation{NumberAnimation{ properties: "x,y" }}//Doesn't work, particles takes control of x,y instantly - NumberAnimation{ properties: "width, height, z, rotation" } - } - } - } - } - } -} diff --git a/examples/declarative/particles/snow/snow.qml b/examples/declarative/particles/snow/snow.qml index b988c53f4a..39e322fe84 100644 --- a/examples/declarative/particles/snow/snow.qml +++ b/examples/declarative/particles/snow/snow.qml @@ -61,14 +61,13 @@ Rectangle{ id: wanderer system: particles anchors.fill: parent - xVariance: 360/(wanderer.physics+1); - pace: 100*(wanderer.physics+1); + xVariance: 360/(wanderer.affectedParameter+1); + pace: 100*(wanderer.affectedParameter+1); } Emitter { system: particles emitRate: 20 lifeSpan: 7000 - emitting: true speed: PointDirection{ y:80; yVariation: 40; } acceleration: PointDirection{ y: 4 } size: 20 @@ -81,15 +80,15 @@ Rectangle{ anchors.horizontalCenter: parent.horizontalCenter UI.Button{ text:"dx/dt" - onClicked: wanderer.physics = Wander.Position; + onClicked: wanderer.affectedParameter = Wander.Position; } UI.Button{ text:"dv/dt" - onClicked: wanderer.physics = Wander.Velocity; + onClicked: wanderer.affectedParameter = Wander.Velocity; } UI.Button{ text:"da/dt" - onClicked: wanderer.physics = Wander.Acceleration; + onClicked: wanderer.affectedParameter = Wander.Acceleration; } } } diff --git a/examples/declarative/particles/spaceexplorer/content/helpers.js b/examples/declarative/particles/spaceexplorer/content/helpers.js deleted file mode 100644 index c38c4c0eed..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/helpers.js +++ /dev/null @@ -1,8 +0,0 @@ -function intersects(item, x, y, e){ - return x+e >= item.x && x-e <= item.x + item.width && y+e >= item.y && y-e <= item.y + item.height; -} - -function direction(x1, y1, x2, y2){ - return Math.atan2(y2-y1, x2-x1) * (180/Math.PI); -} - diff --git a/examples/declarative/particles/spaceexplorer/content/particle4.png b/examples/declarative/particles/spaceexplorer/content/particle4.png Binary files differdeleted file mode 100644 index bc95b703c1..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/particle4.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore.png b/examples/declarative/particles/spaceexplorer/content/powerupScore.png Binary files differdeleted file mode 100644 index e8c368aea7..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/powerupScore.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png Binary files differdeleted file mode 100644 index 4076327a1a..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png Binary files differdeleted file mode 100644 index 4297245d49..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/rocket.png b/examples/declarative/particles/spaceexplorer/content/rocket.png Binary files differdeleted file mode 100644 index a171610b03..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/rocket.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/rocket2.png b/examples/declarative/particles/spaceexplorer/content/rocket2.png Binary files differdeleted file mode 100644 index 7110f8fdc6..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/rocket2.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/rocketEye.png b/examples/declarative/particles/spaceexplorer/content/rocketEye.png Binary files differdeleted file mode 100644 index 20005937d2..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/rocketEye.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/content/star.png b/examples/declarative/particles/spaceexplorer/content/star.png Binary files differdeleted file mode 100644 index 0d592cfa87..0000000000 --- a/examples/declarative/particles/spaceexplorer/content/star.png +++ /dev/null diff --git a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml deleted file mode 100644 index cb8acb815e..0000000000 --- a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml +++ /dev/null @@ -1,417 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content/helpers.js" as Helpers - -Rectangle{ - id: root - width: 360 - height: 540 - color: "black" - Image{ - anchors.centerIn: parent - source: "../asteroid/content/finalfrontier.png" - } - property bool spacePressed: false - property int holeSize: 4 - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Space) { - spacePressed = true; - event.accepted = true; - } - } - Keys.onReleased: { - if (event.key == Qt.Key_Space) { - spacePressed = false; - event.accepted = true; - } - } - - function fakeMove(){ - fakeMoving = rocket.x < 80 || rocket.x+rocket.width-root.width > -80 || rocket.y < 80 || rocket.y+rocket.height-root.height > -80; - if(fakeMoving) - fakeMovementDir = Helpers.direction(root.width/2, root.height/2, rocket.x, rocket.y) + 180; - } - property bool fakeMoving: false - property real fakeMovementDir: 0 - - Emitter{ - particle: "stars2" - system: background - emitRate: 60 - lifeSpan: 4000 - emitting: true - size: 10 - sizeVariation: 10 - anchors.fill: parent - } - ParticleSystem{ id: background } - ImageParticle{ - particles: ["stars2"] - system: background - anchors.fill: parent - source: "content/star.png" - color: "white" - colorVariation: 0.1 - } - Gravity{ - system: background - anchors.fill: parent - acceleration: fakeMoving?10:0 - angle: fakeMovementDir - } - Text{ - color: "white" - anchors.bottom: parent.bottom - anchors.right: parent.right - text:"Drag the ship, but don't hit a black hole!" - font.pixelSize: 10 - } - Text{ - color: "white" - font.pixelSize: 36 - anchors.centerIn: parent - text: "GAME OVER" - opacity: gameOver ? 1 : 0 - Behavior on opacity{NumberAnimation{}} - } - Text{ - color: "white" - font.pixelSize: 18 - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.margins: 8 - text: "Score: " + score - } - Image{ - source: "content/star.png" - width: 40 - height: 40 - anchors.right: parent.right - anchors.top: parent.top - MouseArea{ - anchors.fill: parent - anchors.margins: -20 - onClicked: shoot = !shoot - } - } - property int score: 0 - property bool gameOver: false - property bool shoot: true - property int maxLives: 3 - property int lives: maxLives - property bool alive: !Helpers.intersects(rocket, gs1.x, gs1.y, holeSize) && !Helpers.intersects(rocket, gs2.x, gs2.y, holeSize) && !Helpers.intersects(rocket, gs3.x, gs3.y, holeSize) && !Helpers.intersects(rocket, gs4.x, gs4.y, holeSize); - onAliveChanged: if(!alive){ - lives -= 1; - if(lives == -1){ - console.log("game over"); - gameOver = true; - } - } - Row{ - Repeater{ - model: maxLives - delegate: Image{ - opacity: index < lives ? 1 : 0 - Behavior on opacity{NumberAnimation{}} - source: "content/rocket.png" - } - } - } - - property real courseDur: 10000 - property real vorteX: width/4 - property real vorteY: height/4 - Behavior on vorteX{NumberAnimation{duration: courseDur}} - Behavior on vorteY{NumberAnimation{duration: courseDur}} - property real vorteX2: width/4 - property real vorteY2: 3*height/4 - Behavior on vorteX2{NumberAnimation{duration: courseDur}} - Behavior on vorteY2{NumberAnimation{duration: courseDur}} - property real vorteX3: 3*width/4 - property real vorteY3: height/4 - Behavior on vorteX3{NumberAnimation{duration: courseDur}} - Behavior on vorteY3{NumberAnimation{duration: courseDur}} - property real vorteX4: 3*width/4 - property real vorteY4: 3*height/4 - Behavior on vorteX4{NumberAnimation{duration: courseDur}} - Behavior on vorteY4{NumberAnimation{duration: courseDur}} - Timer{ - id: vorTimer - interval: courseDur - running: true - repeat: true - triggeredOnStart: true - onTriggered: { - vorteX = Math.random() * width * 2 - width * 0.5; - vorteY = Math.random() * height * 2 - height * 0.5; - vorteX2 = Math.random() * width * 2 - width * 0.5; - vorteY2 = Math.random() * height * 2 - height * 0.5; - vorteX3 = Math.random() * width * 2 - width * 0.5; - vorteY3 = Math.random() * height * 2 - height * 0.5; - vorteX4 = Math.random() * width * 2 - width * 0.5; - vorteY4 = Math.random() * height * 2 - height * 0.5; - } - } - - - - ParticleSystem{ id: foreground } - ImageParticle{ - particles: ["stars"] - anchors.fill: parent - system: foreground - source: "content/star.png" - color: "white" - colorVariation: 0.1 - } - ImageParticle{ - particles: ["shot"] - anchors.fill: parent - system: foreground - source: "content/star.png" - - color: "orange" - colorVariation: 0.3 - } - ImageParticle{ - id: engine - particles: ["engine"] - anchors.fill: parent - system: foreground - source: "content/particle4.png" - - color: "orange" - SequentialAnimation on color { - loops: Animation.Infinite - ColorAnimation { - from: "red" - to: "cyan" - duration: 1000 - } - ColorAnimation { - from: "cyan" - to: "red" - duration: 1000 - } - } - - colorVariation: 0.2 - } - ImageParticle{ - particles: ["powerups"] - anchors.fill: parent - system: foreground - sprites:[Sprite{ - name: "norm" - source: "content/powerupScore.png" - frames: 35 - duration: 40 - to: {"norm":1, "got":0} - }, - Sprite{ - name: "got" - source: "content/powerupScore_got.png" - frames: 22 - duration: 40 - to: {"null":1} - }, - Sprite{ - name: "null" - source: "content/powerupScore_gone.png" - frames: 1 - duration: 1000 - } - ] - } - SpriteGoal{ - x: rocket.x - 30 - y: rocket.y - 30 - width: 60 - height: 60 - goalState: "got" - jump: true - onAffected: if(!gameOver) score += 1000 - system: foreground - } - PointAttractor{ - proportionalToDistance: PointAttractor.InverseQuadratic; - id: gs1; pointX: vorteX; pointY: vorteY; strength: 800000; - system: foreground - } - Kill{ - x: gs1.pointX - holeSize; - y: gs1.pointY - holeSize; - width: holeSize * 2 - height: holeSize * 2 - system: foreground - } - - PointAttractor{ - proportionalToDistance: PointAttractor.InverseQuadratic; - id: gs2; pointX: vorteX2; pointY: vorteY2; strength: 800000; - system: foreground - } - Kill{ - x: gs2.pointX - holeSize; - y: gs2.pointY - holeSize; - width: holeSize * 2 - height: holeSize * 2 - system: foreground - } - - PointAttractor{ - proportionalToDistance: PointAttractor.InverseQuadratic; - id: gs3; pointX: vorteX3; pointY: vorteY3; strength: 800000; - system: foreground - } - Kill{ - x: gs3.pointX - holeSize; - y: gs3.pointY - holeSize; - width: holeSize * 2 - height: holeSize * 2 - system: foreground - } - PointAttractor{ - id: gs4; pointX: vorteX4; pointY: vorteY4; strength: 800000; - proportionalToDistance: PointAttractor.InverseQuadratic; - system: foreground - } - Kill{ - x: gs4.pointX - holeSize; - y: gs4.pointY - holeSize; - width: holeSize * 2 - height: holeSize * 2 - system: foreground - } - Emitter{ - particle: "powerups" - system: foreground - emitRate: 1 - lifeSpan: 6000 - emitting: !gameOver - size: 60 - sizeVariation: 10 - anchors.fill: parent - } - Emitter{ - particle: "stars" - system: foreground - emitRate: 40 - lifeSpan: 4000 - emitting: !gameOver - size: 30 - sizeVariation: 10 - anchors.fill: parent - } - SpriteImage{ - id: rocket - //Sprites or children for default? - Sprite{ - name: "normal" - source: "content/rocket2.png" - frames: 1 - duration: 1000 - to: {"normal": 0.9, "winking" : 0.1} - } - Sprite{ - name: "winking" - source: "content/rocketEye.png" - frames: 10 - duration: 40 - to: {"normal" : 1} - } - x: root.width/2 - y: root.height/2 - property int lx: 0 - property int ly: 0 - property int lastX: 0 - property int lastY: 0 - width: 45 - height: 22 - onXChanged:{ lastX = lx; lx = x; fakeMove()} - onYChanged:{ lastY = ly; ly = y; fakeMove()} - rotation: Helpers.direction(lastX, lastY, x, y) - data:[ - MouseArea{ - id: ma - anchors.fill: parent; - drag.axis: Drag.XandYAxis - drag.target: rocket - }, - Emitter{ - system: foreground - particle: "engine" - emitRate: 100 - lifeSpan: 1000 - emitting: !gameOver - size: 10 - endSize: 4 - sizeVariation: 4 - speed: PointDirection{ - x: -128 * Math.cos(rocket.rotation * (Math.PI / 180)) - y: -128 * Math.sin(rocket.rotation * (Math.PI / 180)) - } - anchors.verticalCenter: parent.verticalCenter - height: 4 - width: 4 - - }, - Emitter{ - system: foreground - particle: "shot" - emitRate: 16 - lifeSpan: 1600 - emitting: !gameOver && shoot - size: 40 - speed: PointDirection{ - x: 256 * Math.cos(rocket.rotation * (Math.PI / 180)) - y: 256 * Math.sin(rocket.rotation * (Math.PI / 180)) - } - x: parent.width - 4 - y: parent.height/2 - } - ] - } -} - diff --git a/examples/declarative/particles/trails/combustion.qml b/examples/declarative/particles/trails/combustion.qml index f244300524..e4a21e9beb 100644 --- a/examples/declarative/particles/trails/combustion.qml +++ b/examples/declarative/particles/trails/combustion.qml @@ -70,7 +70,7 @@ Rectangle { color: "#2060160f" } SpriteGoal{ - collisionParticles: ["lit"] + whenCollidingWith: ["lit"] goalState: "lighting" jump: true systemStates: true @@ -85,7 +85,7 @@ Rectangle { name: "lit" duration: 10000 onEntered: score++; - FollowEmitter{ + TrailEmitter{ id: fireballFlame particle: "flame" @@ -99,7 +99,7 @@ Rectangle { endSize: 4 } - FollowEmitter{ + TrailEmitter{ id: fireballSmoke particle: "smoke" @@ -185,7 +185,7 @@ Rectangle { goalState: "lighting" jump: true systemStates: true - active: ma.pressed + enabled: ma.pressed width: 18 height: 18 x: ma.mouseX - width/2 diff --git a/examples/declarative/particles/trails/dynamicemitters.qml b/examples/declarative/particles/trails/dynamicemitters.qml index dbf3f8fa82..dac5d93035 100644 --- a/examples/declarative/particles/trails/dynamicemitters.qml +++ b/examples/declarative/particles/trails/dynamicemitters.qml @@ -63,12 +63,11 @@ Rectangle{ Emitter{ id: emitMore system: sys - emitting: true emitRate: 128 lifeSpan: 600 size: 16 endSize: 8 - speed: AngledDirection{angleVariation:360; magnitude: 60} + speed: AngleDirection{angleVariation:360; magnitude: 60} } property int life: 2600 @@ -77,10 +76,9 @@ Rectangle{ function go(){ xAnim.start(); yAnim.start(); - container.emitting = true + container.enabled = true } system: sys - emitting: true emitRate: 32 lifeSpan: 600 size: 24 diff --git a/examples/declarative/particles/trails/fireballs.qml b/examples/declarative/particles/trails/fireballs.qml index 4cc2eacc25..97a0c0ac5f 100644 --- a/examples/declarative/particles/trails/fireballs.qml +++ b/examples/declarative/particles/trails/fireballs.qml @@ -98,7 +98,7 @@ Rectangle { sizeVariation: 8 endSize: 4 } - FollowEmitter{ + TrailEmitter{ id: fireSmoke particle: "B" system: particles @@ -116,7 +116,7 @@ Rectangle { sizeVariation: 8 endSize: 16 } - FollowEmitter{ + TrailEmitter{ id: fireballFlame anchors.fill: parent system: particles @@ -133,7 +133,7 @@ Rectangle { endSize: 4 } - FollowEmitter{ + TrailEmitter{ id: fireballSmoke anchors.fill: parent system: particles diff --git a/examples/declarative/particles/trails/fireworks.qml b/examples/declarative/particles/trails/fireworks.qml index a84f5d8b3c..437d9ee3d6 100644 --- a/examples/declarative/particles/trails/fireworks.qml +++ b/examples/declarative/particles/trails/fireworks.qml @@ -59,13 +59,13 @@ Rectangle{ name: "splode" duration: 400 to: {"dead":1} - FollowEmitter{ + TrailEmitter{ particle: "works" emitRatePerParticle: 100 lifeSpan: 1000 - emitCap: 1200 + maximumEmitted: 1200 size: 8 - speed: AngledDirection{angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} + speed: AngleDirection{angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} acceleration: PointDirection{y:100; yVariation: 20} } }, @@ -73,8 +73,7 @@ Rectangle{ name: "dead" duration: 1000 Affector{ - onceOff: true - signal: true + once: true onAffected: worksEmitter.burst(400,x,y) } } @@ -91,7 +90,7 @@ Rectangle{ particle: "fire" width: parent.width y: parent.height - emitting: false + enabled: false emitRate: 80 lifeSpan: 6000 speed: PointDirection{y:-100;} @@ -100,14 +99,14 @@ Rectangle{ Emitter{ id: worksEmitter particle: "works" - emitting: false + enabled: false emitRate: 100 lifeSpan: 1600 - emitCap: 6400 + maximumEmitted: 6400 size: 8 speed: CumulativeDirection{ PointDirection{y:-100} - AngledDirection{angleVariation: 360; magnitudeVariation: 80;} + AngleDirection{angleVariation: 360; magnitudeVariation: 80;} } acceleration: PointDirection{y:100; yVariation: 20} } diff --git a/examples/declarative/particles/trails/layered.qml b/examples/declarative/particles/trails/layered.qml index d4a823b556..9af5f0bd64 100644 --- a/examples/declarative/particles/trails/layered.qml +++ b/examples/declarative/particles/trails/layered.qml @@ -53,7 +53,6 @@ Rectangle{ } ParticleSystem{ id: sys - startTime: 4000 } Emitter{ system: sys @@ -61,6 +60,7 @@ Rectangle{ width: root.width emitRate: 200 lifeSpan: 4000 + startTime: 4000 speed: PointDirection{ y: -120; } } ImageParticle{ diff --git a/examples/declarative/particles/trails/list.qml b/examples/declarative/particles/trails/list.qml index 7e8fb44003..b64e49456b 100644 --- a/examples/declarative/particles/trails/list.qml +++ b/examples/declarative/particles/trails/list.qml @@ -57,6 +57,7 @@ Rectangle { source: "content/star.png" color: "white" colorVariation: 0.0 + rotationSpeed: 360 } // Define a delegate component. A component will be @@ -95,11 +96,12 @@ Rectangle { Emitter{ anchors.fill: parent system: particles; - emitting: anim.running + enabled: anim.running emitRate: 600 lifeSpan: 600 size: 16 endSize: 8 + sizeVariation: 8 } } } diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml index 620ae46088..baf1bf3046 100644 --- a/examples/declarative/particles/trails/overburst.qml +++ b/examples/declarative/particles/trails/overburst.qml @@ -47,7 +47,7 @@ Rectangle{ height: 540 ParticleSystem{ id: sys - onClearChanged: if (clear) sys.pause(); + onEmptyChanged: if (empty) sys.pause(); } ImageParticle{ system: sys @@ -60,12 +60,12 @@ Rectangle{ //burst on click id: bursty system: sys - emitting: ma.pressed + enabled: ma.pressed x: ma.mouseX y: ma.mouseY emitRate: 16000 - emitCap: 4000 - acceleration: AngledDirection{angleVariation: 360; magnitude: 360; } + maximumEmitted: 4000 + acceleration: AngleDirection{angleVariation: 360; magnitude: 360; } size: 8 endSize: 16 sizeVariation: 4 @@ -78,7 +78,7 @@ Rectangle{ MouseArea{ width: 100 height: 100 - onClicked: bursty.noCap = true; + onClicked: bursty.maximumEmitted = -1; id: ma2 Rectangle{ anchors.fill: parent diff --git a/examples/declarative/particles/trails/portal.qml b/examples/declarative/particles/trails/portal.qml index 8cf323b0f5..85efd9a594 100644 --- a/examples/declarative/particles/trails/portal.qml +++ b/examples/declarative/particles/trails/portal.qml @@ -52,7 +52,6 @@ Rectangle{ } ParticleSystem{ id: particles - startTime: 2000 } ImageParticle{ particles: ["center","edge"] @@ -68,12 +67,11 @@ Rectangle{ system: particles emitRate: 200 lifeSpan: 2000 - emitting: true size: 20 sizeVariation: 2 endSize: 0 shape: EllipseShape{fill: false} - speed: TargetedDirection{ + speed: TargetDirection{ targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true @@ -83,22 +81,22 @@ Rectangle{ Emitter{ anchors.fill: parent particle: "edge" + startTime: 2000 system: particles emitRate: 4000 lifeSpan: 2000 - emitting: true size: 20 sizeVariation: 2 endSize: 0 shape: EllipseShape{fill: false} - speed: TargetedDirection{ + speed: TargetDirection{ targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true magnitude: 0.1 magnitudeVariation: 0.1 } - acceleration: TargetedDirection{ + acceleration: TargetDirection{ targetX: root.width/2 targetY: root.height/2 targetVariation: 200 diff --git a/examples/declarative/particles/trails/shimmer.qml b/examples/declarative/particles/trails/shimmer.qml index d195a4477b..90b47bc6b7 100644 --- a/examples/declarative/particles/trails/shimmer.qml +++ b/examples/declarative/particles/trails/shimmer.qml @@ -72,7 +72,6 @@ Rectangle{ system: particles emitRate: 2000 lifeSpan: 2000 - emitting: true size: 30 sizeVariation: 10 } diff --git a/examples/declarative/particles/trails/trails.qml b/examples/declarative/particles/trails/trails.qml index 689de4eb41..1b6f9e00c7 100644 --- a/examples/declarative/particles/trails/trails.qml +++ b/examples/declarative/particles/trails/trails.qml @@ -57,10 +57,10 @@ Rectangle{ //burst on click id: bursty system: sys - emitting: false + enabled: false emitRate: 2000 lifeSpan: 500 - acceleration: AngledDirection{ angle: 90; angleVariation: 360; magnitude: 640; } + acceleration: AngleDirection{ angle: 90; angleVariation: 360; magnitude: 640; } size: 8 endSize: 16 sizeVariation: 4 @@ -68,12 +68,12 @@ Rectangle{ Emitter{ system: sys speedFromMovement: 4.0 - emitting: ma.pressed + enabled: ma.pressed x: ma.mouseX y: ma.mouseY emitRate: 400 lifeSpan: 2000 - acceleration: AngledDirection{ angle: 90; angleVariation: 22; magnitude: 32; } + acceleration: AngleDirection{ angle: 90; angleVariation: 22; magnitude: 32; } size: 8 endSize: 16 sizeVariation: 8 diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml index 3f822c7889..62216c3460 100644 --- a/examples/declarative/particles/trails/turbulence.qml +++ b/examples/declarative/particles/trails/turbulence.qml @@ -91,9 +91,9 @@ Rectangle{ endSize: 10 sizeVariation: 10 acceleration: PointDirection{ y: -40 } - speed: AngledDirection{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } + speed: AngleDirection{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } } - FollowEmitter{ + TrailEmitter{ id: smoke1 width: root.width height: 258 @@ -108,9 +108,9 @@ Rectangle{ endSize: 8 sizeVariation: 8 acceleration: PointDirection{ y: -40 } - speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + speed: AngleDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } - FollowEmitter{ + TrailEmitter{ id: smoke2 width: root.width height: 232 @@ -124,6 +124,6 @@ Rectangle{ endSize: 24 sizeVariation: 8 acceleration: PointDirection{ y: -40 } - speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + speed: AngleDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } } |