From 1aa012a1c83ce8905e5440d3e7ae11192dc73878 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 6 Sep 2011 10:40:21 +1000 Subject: 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 --- .../declarative/flickr/content/ImageDetails.qml | 47 +-- examples/declarative/flickr/content/Progress.qml | 4 +- examples/declarative/flickr/content/StreamView.qml | 107 ------ .../declarative/flickr/content/UnifiedDelegate.qml | 8 - examples/declarative/flickr/flickr.qml | 74 ++-- examples/declarative/particles/allsmiles/plain.qml | 2 +- examples/declarative/particles/allsmiles/smile.qml | 12 +- .../particles/allsmiles/smilefactory.qml | 14 +- .../particles/allsmiles/spriteparticles.qml | 2 - .../particles/allsmiles/spritestateparticles.qml | 3 +- .../particles/allsmiles/spritevariedparticles.qml | 3 +- .../particles/allsmiles/ultraparticles.qml | 3 +- .../declarative/particles/asteroid/asteroid.qml | 1 - .../declarative/particles/asteroid/blackhole.qml | 19 +- .../declarative/particles/custom/blurparticles.qml | 6 +- examples/declarative/particles/custom/custom.qml | 31 +- .../declarative/particles/custom/delegates.qml | 2 +- .../declarative/particles/custom/fallingleaves.qml | 18 +- examples/declarative/particles/custom/shader.qml | 20 +- .../declarative/particles/exampleslauncher.qml | 5 - .../particles/modelparticles/bubbles.qml | 82 ---- .../particles/modelparticles/content/Delegate.qml | 88 ----- .../particles/modelparticles/content/Delegate2.qml | 79 ---- .../modelparticles/content/ExpandingDelegate.qml | 204 ---------- .../particles/modelparticles/content/RssModel.qml | 53 --- .../particles/modelparticles/content/bubble.png | Bin 3413 -> 0 bytes .../particles/modelparticles/content/script.js | 27 -- .../particles/modelparticles/gridsplosion.qml | 144 ------- .../particles/modelparticles/package.qml | 91 ----- .../particles/modelparticles/stream.qml | 276 -------------- examples/declarative/particles/snow/snow.qml | 11 +- .../particles/spaceexplorer/content/helpers.js | 8 - .../particles/spaceexplorer/content/particle4.png | Bin 1799 -> 0 bytes .../spaceexplorer/content/powerupScore.png | Bin 83169 -> 0 bytes .../spaceexplorer/content/powerupScore_gone.png | Bin 140 -> 0 bytes .../spaceexplorer/content/powerupScore_got.png | Bin 81528 -> 0 bytes .../particles/spaceexplorer/content/rocket.png | Bin 7315 -> 0 bytes .../particles/spaceexplorer/content/rocket2.png | Bin 1918 -> 0 bytes .../particles/spaceexplorer/content/rocketEye.png | Bin 2073 -> 0 bytes .../particles/spaceexplorer/content/star.png | Bin 1550 -> 0 bytes .../particles/spaceexplorer/spaceexplorer.qml | 417 --------------------- .../declarative/particles/trails/combustion.qml | 8 +- .../particles/trails/dynamicemitters.qml | 6 +- .../declarative/particles/trails/fireballs.qml | 6 +- .../declarative/particles/trails/fireworks.qml | 17 +- examples/declarative/particles/trails/layered.qml | 2 +- examples/declarative/particles/trails/list.qml | 4 +- .../declarative/particles/trails/overburst.qml | 10 +- examples/declarative/particles/trails/portal.qml | 10 +- examples/declarative/particles/trails/shimmer.qml | 1 - examples/declarative/particles/trails/trails.qml | 8 +- .../declarative/particles/trails/turbulence.qml | 10 +- .../plasmapatrol/content/BlasterHardpoint.qml | 10 +- .../plasmapatrol/content/CannonHardpoint.qml | 6 +- .../declarative/plasmapatrol/content/Cruiser.qml | 10 +- .../declarative/plasmapatrol/content/Frigate.qml | 4 +- .../plasmapatrol/content/LaserHardpoint.qml | 8 +- .../plasmapatrol/content/PlasmaPatrolParticles.qml | 10 +- .../declarative/plasmapatrol/content/Sloop.qml | 4 +- examples/declarative/plasmapatrol/plasmapatrol.qml | 4 +- .../samegame/SamegameCore/BoomBlock.qml | 6 +- 61 files changed, 184 insertions(+), 1821 deletions(-) delete mode 100644 examples/declarative/flickr/content/StreamView.qml delete mode 100644 examples/declarative/particles/modelparticles/bubbles.qml delete mode 100644 examples/declarative/particles/modelparticles/content/Delegate.qml delete mode 100644 examples/declarative/particles/modelparticles/content/Delegate2.qml delete mode 100644 examples/declarative/particles/modelparticles/content/ExpandingDelegate.qml delete mode 100644 examples/declarative/particles/modelparticles/content/RssModel.qml delete mode 100644 examples/declarative/particles/modelparticles/content/bubble.png delete mode 100644 examples/declarative/particles/modelparticles/content/script.js delete mode 100644 examples/declarative/particles/modelparticles/gridsplosion.qml delete mode 100644 examples/declarative/particles/modelparticles/package.qml delete mode 100644 examples/declarative/particles/modelparticles/stream.qml delete mode 100644 examples/declarative/particles/spaceexplorer/content/helpers.js delete mode 100644 examples/declarative/particles/spaceexplorer/content/particle4.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/powerupScore.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/powerupScore_got.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/rocket.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/rocket2.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/rocketEye.png delete mode 100644 examples/declarative/particles/spaceexplorer/content/star.png delete mode 100644 examples/declarative/particles/spaceexplorer/spaceexplorer.qml (limited to 'examples') diff --git a/examples/declarative/flickr/content/ImageDetails.qml b/examples/declarative/flickr/content/ImageDetails.qml index d45f8e80e9..8d3cdfb494 100644 --- a/examples/declarative/flickr/content/ImageDetails.qml +++ b/examples/declarative/flickr/content/ImageDetails.qml @@ -164,7 +164,7 @@ Flipable { anchors.fill: parent frequency: 100 strength: 250 - active: false + enabled: false } Item{ @@ -180,7 +180,7 @@ Flipable { function imageOutAnim(){ bigImage.visible = false; noiseIn.visible = false; - turbulence.active = true; + turbulence.enabled = true; endEffectTimer.start(); pixelEmitter.burst(2048); } @@ -190,7 +190,7 @@ Flipable { repeat: false running: false onTriggered:{ - turbulence.active = false; + turbulence.enabled = false; noiseIn.visible = false; bigImage.visible = true; } @@ -245,7 +245,7 @@ Flipable { size: 4 lifeSpan: flipDuration emitRate: 2048 - emitting: false + enabled: false } CustomParticle{ id: blowOut @@ -253,54 +253,23 @@ Flipable { property real maxWidth: effectBox.width property real maxHeight: effectBox.height vertexShader:" - attribute highp vec2 vPos; - attribute highp vec2 vTex; - attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize - attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration - attribute highp float r; - uniform highp float maxWidth; uniform highp float maxHeight; - uniform highp mat4 qt_Matrix; - uniform highp float timestamp; - uniform lowp float qt_Opacity; - varying highp vec2 fTex2; - varying lowp float fFade; void main() { - fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight); - highp float size = vData.z; - highp float endSize = vData.w; - - highp float t = (timestamp - vData.x) / vData.y; - - highp float currentSize = mix(size, endSize, t * t); - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); - - gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); - - highp float fadeIn = min(t * 10., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); - - fFade = 1.0;//fadeIn * fadeOut * qt_Opacity; + defaultMain(); + fTex2 = vec2(qt_ParticlePos.x / maxWidth, qt_ParticlePos.y / maxHeight); } " property variant pictureTexture: pictureSource fragmentShader: " + uniform lowp float qt_Opacity; uniform sampler2D pictureTexture; varying highp vec2 fTex2; - varying highp float fFade; void main() { - gl_FragColor = texture2D(pictureTexture, fTex2) * fFade; + gl_FragColor = texture2D(pictureTexture, fTex2) * qt_Opacity; }" } diff --git a/examples/declarative/flickr/content/Progress.qml b/examples/declarative/flickr/content/Progress.qml index 28fa0c3bac..598ff7123c 100644 --- a/examples/declarative/flickr/content/Progress.qml +++ b/examples/declarative/flickr/content/Progress.qml @@ -69,14 +69,14 @@ Item{ Emitter{ y: 2; height: parent.height-4; x: 2; width: Math.max(parent.width * progress - 4, 0); - speed: AngledDirection{ angleVariation: 180; magnitudeVariation: 12 } + speed: AngleDirection{ angleVariation: 180; magnitudeVariation: 12 } system: barSys emitRate: width; lifeSpan: 1000 size: 20 sizeVariation: 4 endSize: 12 - emitCap: parent.width; + maximumEmitted: parent.width; } Text { diff --git a/examples/declarative/flickr/content/StreamView.qml b/examples/declarative/flickr/content/StreamView.qml deleted file mode 100644 index 9aa6b746a8..0000000000 --- a/examples/declarative/flickr/content/StreamView.qml +++ /dev/null @@ -1,107 +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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item{ - id: container - property alias model: mp.model - property alias delegate: mp.delegate - property bool jumpStarted: false - ParticleSystem{ - id: sys - anchors.fill:parent - } - ModelParticle{ - id: mp - fade: false - system: sys - anchors.fill: parent - onModelCountChanged: { - if(!jumpStarted && modelCount > 0){ - console.log("Jumping"); - jumpStarted = true; - sys.fastForward(8000); - } - } - } - property real emitterSpacing: parent.width/3 - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*0 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*1 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*2 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Kill{ - system: sys - y: container.height + 64 - width: container.width - height: 6400 - } -} diff --git a/examples/declarative/flickr/content/UnifiedDelegate.qml b/examples/declarative/flickr/content/UnifiedDelegate.qml index 24bd146b9f..5c8ce75d05 100644 --- a/examples/declarative/flickr/content/UnifiedDelegate.qml +++ b/examples/declarative/flickr/content/UnifiedDelegate.qml @@ -65,12 +65,6 @@ Package { id: streamwrapper; width: 80; height: 80 Package.name: "stream" - function pleaseFreeze(){ - ModelParticle.particle.freeze(streamwrapper); - } - function pleaseUnfreeze(){ - ModelParticle.particle.unfreeze(streamwrapper); - } } Item { //anchors.centerIn: parent//Doesn't animate :( @@ -112,7 +106,6 @@ Package { transitions: [ Transition { from: "Show"; to: "Details" - ScriptAction{ script: streamwrapper.pleaseFreeze(); } ParentAnimation { via: foreground NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } @@ -125,7 +118,6 @@ Package { via: foreground NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } - ScriptAction{ script: streamwrapper.pleaseUnfreeze(); } } } ] diff --git a/examples/declarative/flickr/flickr.qml b/examples/declarative/flickr/flickr.qml index a222b41341..14e4fcaedf 100644 --- a/examples/declarative/flickr/flickr.qml +++ b/examples/declarative/flickr/flickr.qml @@ -45,7 +45,7 @@ import "content" Item { id: screen; width: 320; height: 480 - property bool inGridView : false + property bool inGridView : true Rectangle { id: background @@ -54,40 +54,38 @@ Item { Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } ParticleSystem { id: bgParticles - startTime: 16000 - } - ImageParticle { - particles: ["trail"] - source: "content/images/particle.png" - color: "#1A1A6F" - alpha: 0.1 - colorVariation: 0.01 - blueVariation: 0.8 - system: bgParticles - } - Emitter { - particle: "drops" - width: parent.width - emitRate: 0.5 - lifeSpan: 20000 - speed: PointDirection{ - y: {screen.height/18} - } - system: bgParticles - } - FollowEmitter { - follow: "drops" - particle: "trail" - emitRatePerParticle: 18 - size: 32 - endSize: 0 - sizeVariation: 4 - lifeSpan: 1200 - system: bgParticles anchors.fill: parent - emitWidth: 16 - emitHeight: 16 - emitShape: EllipseShape{} + ImageParticle { + particles: ["trail"] + source: "content/images/particle.png" + color: "#1A1A6F" + alpha: 0.1 + colorVariation: 0.01 + blueVariation: 0.8 + } + Emitter { + particle: "drops" + width: parent.width + emitRate: 0.5 + lifeSpan: 20000 + startTime: 16000 + speed: PointDirection{ + y: {screen.height/18} + } + } + TrailEmitter { + follow: "drops" + particle: "trail" + emitRatePerParticle: 18 + size: 32 + endSize: 0 + sizeVariation: 4 + lifeSpan: 1200 + anchors.fill: parent + emitWidth: 16 + emitHeight: 16 + emitShape: EllipseShape{} + } } VisualDataModel{ @@ -107,14 +105,8 @@ Item { cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height } - StreamView{ - id: photoStreamView - model: vdm.parts.stream - width: parent.width; height: parent.height - } - states: State { - name: "GridView"; when: screen.inGridView == true + name: "GridView"; when: state.inGridView == true } transitions: Transition { 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 deleted file mode 100644 index c7f479e9e3..0000000000 Binary files a/examples/declarative/particles/modelparticles/content/bubble.png and /dev/null differ 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 deleted file mode 100644 index bc95b703c1..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/particle4.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore.png b/examples/declarative/particles/spaceexplorer/content/powerupScore.png deleted file mode 100644 index e8c368aea7..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/powerupScore.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png deleted file mode 100644 index 4076327a1a..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/powerupScore_gone.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png b/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png deleted file mode 100644 index 4297245d49..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/powerupScore_got.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/rocket.png b/examples/declarative/particles/spaceexplorer/content/rocket.png deleted file mode 100644 index a171610b03..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/rocket.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/rocket2.png b/examples/declarative/particles/spaceexplorer/content/rocket2.png deleted file mode 100644 index 7110f8fdc6..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/rocket2.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/rocketEye.png b/examples/declarative/particles/spaceexplorer/content/rocketEye.png deleted file mode 100644 index 20005937d2..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/rocketEye.png and /dev/null differ diff --git a/examples/declarative/particles/spaceexplorer/content/star.png b/examples/declarative/particles/spaceexplorer/content/star.png deleted file mode 100644 index 0d592cfa87..0000000000 Binary files a/examples/declarative/particles/spaceexplorer/content/star.png and /dev/null differ 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 } } } diff --git a/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml b/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml index 87c1822c05..384275fc94 100644 --- a/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml +++ b/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml @@ -57,10 +57,10 @@ Item { id: visualization particle: "blaster" system: container.system - emitting: show + enabled: show anchors.fill: parent shape: EllipseShape{} - speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} + speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} lifeSpan: 1000 emitRate: 64 @@ -115,17 +115,17 @@ Item { Emitter{ id: emitter particle: "blaster" - emitting: false + enabled: false system: container.system anchors.centerIn: parent lifeSpan: 1000 emitRate: 16 - emitCap: blasts + maximumEmitted: blasts size: 24 endSize:16 sizeVariation: 8 - speed: TargetedDirection{ + speed: TargetDirection{ id: blastVector targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true } diff --git a/examples/declarative/plasmapatrol/content/CannonHardpoint.qml b/examples/declarative/plasmapatrol/content/CannonHardpoint.qml index e0c23c1d63..b2c7aca1fd 100644 --- a/examples/declarative/plasmapatrol/content/CannonHardpoint.qml +++ b/examples/declarative/plasmapatrol/content/CannonHardpoint.qml @@ -52,7 +52,7 @@ Item { Emitter{ id: visualization particle: "cannon" - emitting: container.show + enabled: container.show system: container.system anchors.centerIn: parent lifeSpan: 2000 @@ -81,7 +81,7 @@ Item { Emitter{ id: emitter particle: "cannon" - emitting: false + enabled: false system: container.system anchors.centerIn: parent @@ -89,7 +89,7 @@ Item { emitRate: 1 size: 8 endSize: 4 - speed: TargetedDirection{ + speed: TargetDirection{ id: blastVector targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true } diff --git a/examples/declarative/plasmapatrol/content/Cruiser.qml b/examples/declarative/plasmapatrol/content/Cruiser.qml index 4f600b961f..b0d20023db 100644 --- a/examples/declarative/plasmapatrol/content/Cruiser.qml +++ b/examples/declarative/plasmapatrol/content/Cruiser.qml @@ -66,20 +66,20 @@ Item { emitRate: hp > 0 ? hp * 1 + 20 : 0 lifeSpan: 2400 - emitCap: (maxHP * 1 + 20)*2.4 + maximumEmitted: (maxHP * 1 + 20)*2.4 size: 48 sizeVariation: 16 endSize: 16 - speed: AngledDirection{angleVariation:360; magnitudeVariation: 32} + speed: AngleDirection{angleVariation:360; magnitudeVariation: 32} } Emitter{ system: container.system particle: "cruiserArmor" anchors.fill: parent shape: EllipseShape{ fill: false } - emitting: hp>0 + enabled: hp>0 emitRate: 16 lifeSpan: 2000 @@ -90,12 +90,12 @@ Item { SpriteGoal{ id: destructor system: container.system - active: container.hp <=0 + enabled: container.hp <=0 anchors.fill: parent particles: ["cruiserArmor"] goalState: "death" // jump: true - onceOff: true + once: true } } diff --git a/examples/declarative/plasmapatrol/content/Frigate.qml b/examples/declarative/plasmapatrol/content/Frigate.qml index 5c61177f66..8d493b81d5 100644 --- a/examples/declarative/plasmapatrol/content/Frigate.qml +++ b/examples/declarative/plasmapatrol/content/Frigate.qml @@ -61,7 +61,7 @@ Item { size: 92 emitRate: 1 lifeSpan: 4800 - emitting: hp > 0 + enabled: hp > 0 } Emitter{ system: container.system @@ -76,7 +76,7 @@ Item { endSize: 8 emitRate: hp > 0 ? hp * 1 + 20 : 0 lifeSpan: 1200 - emitCap: (maxHP * 1 + 20)*2 + maximumEmitted: (maxHP * 1 + 20)*2 } Timer{ id: fireControl diff --git a/examples/declarative/plasmapatrol/content/LaserHardpoint.qml b/examples/declarative/plasmapatrol/content/LaserHardpoint.qml index ffc4be7acb..45712bf68a 100644 --- a/examples/declarative/plasmapatrol/content/LaserHardpoint.qml +++ b/examples/declarative/plasmapatrol/content/LaserHardpoint.qml @@ -54,9 +54,9 @@ Item { particle: "laser" system: container.system anchors.fill: parent - emitting: container.show + enabled: container.show shape: EllipseShape{} - speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } + speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } lifeSpan: 1000 emitRate: 64 @@ -87,7 +87,7 @@ Item { Emitter{ id: emitter particle: "laser" - emitting: false + enabled: false system: container.system x: Math.min(container.width/2, target.x); width: Math.max(container.width/2, target.x) - x; @@ -99,7 +99,7 @@ Item { lifeSpan: 1000 emitRate: 8000 - emitCap: 800 + maximumEmitted: 800 size: 16 endSize: 0 diff --git a/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml index 1ce1d065a5..792ba7ab72 100644 --- a/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml +++ b/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml @@ -144,21 +144,21 @@ Item{ } ] } - FollowEmitter{ + TrailEmitter{ system: sys particle: "cannonWake" follow: "cannon" emitRatePerParticle: 64 lifeSpan: 600 - speed: AngledDirection{ angleVariation: 360; magnitude: 48} + speed: AngleDirection{ angleVariation: 360; magnitude: 48} size: 16 endSize: 8 sizeVariation: 2 - emitting: true + enabled: true width: 1000//XXX: Terrible hack height: 1000 } - FollowEmitter{ + TrailEmitter{ system: sys particle: "cannonCore" follow: "cannon" @@ -166,7 +166,7 @@ Item{ lifeSpan: 128 size: 24 endSize: 8 - emitting: true + enabled: true width: 1000//XXX: Terrible hack height: 1000 } diff --git a/examples/declarative/plasmapatrol/content/Sloop.qml b/examples/declarative/plasmapatrol/content/Sloop.qml index cfb5798ec6..82e57f5161 100644 --- a/examples/declarative/plasmapatrol/content/Sloop.qml +++ b/examples/declarative/plasmapatrol/content/Sloop.qml @@ -65,9 +65,9 @@ Item { emitRate: hp > 0 ? hp + 20 : 0 lifeSpan: blinkInterval - emitCap: (maxHP + 20) + maximumEmitted: (maxHP + 20) - acceleration: AngledDirection{angleVariation: 360; magnitude: 8} + acceleration: AngleDirection{angleVariation: 360; magnitude: 8} size: 24 endSize: 4 diff --git a/examples/declarative/plasmapatrol/plasmapatrol.qml b/examples/declarative/plasmapatrol/plasmapatrol.qml index be6d15ec13..4ea464b9f8 100644 --- a/examples/declarative/plasmapatrol/plasmapatrol.qml +++ b/examples/declarative/plasmapatrol/plasmapatrol.qml @@ -96,7 +96,7 @@ Rectangle { Emitter{ anchors.fill: parent system: particles - emitting: true + enabled: true particle: "default" emitRate: 1200 lifeSpan: 1200 @@ -104,7 +104,7 @@ Rectangle { size: 16 endSize: 0 sizeVariation: 8 - speed: AngledDirection{angleVariation:360; magnitudeVariation: 6} + speed: AngleDirection{angleVariation:360; magnitudeVariation: 6} } } Button{ diff --git a/examples/declarative/samegame/SamegameCore/BoomBlock.qml b/examples/declarative/samegame/SamegameCore/BoomBlock.qml index 4f8ef70851..1c84fa8614 100644 --- a/examples/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/examples/declarative/samegame/SamegameCore/BoomBlock.qml @@ -86,12 +86,12 @@ Item { } anchors.fill: parent - speed: TargetedDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} + speed: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} shape: EllipseShape{fill:true} - emitting: false; + enabled: false; lifeSpan: 700; lifeSpanVariation: 100 emitRate: 1000 - emitCap: 100 //only fires 0.1s bursts (still 2x old number, ImageParticle wants less than 16000 max though) + maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) size: 28 endSize: 14 } -- cgit v1.2.3