diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-09-20 17:16:36 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-21 07:11:25 +0200 |
commit | c07ea77a6201ef5595ff5714fba891be4408fa9a (patch) | |
tree | a76327735961f81130bffeeb9a62f2fcb7fec8bb /examples | |
parent | ef98f5a80369e3f014585edc3dd63a2ec331d1ea (diff) |
Add whitespace
Change-Id: Iad55228ffa86bbf63b12a33d0f00ce734807c071
Reviewed-on: http://codereview.qt-project.org/5199
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'examples')
50 files changed, 738 insertions, 669 deletions
diff --git a/examples/declarative/particles/affectors/age.qml b/examples/declarative/particles/affectors/age.qml index f2361a2997..7dc2ebefdb 100644 --- a/examples/declarative/particles/affectors/age.qml +++ b/examples/declarative/particles/affectors/age.qml @@ -46,10 +46,12 @@ Rectangle { width: 360 height: 600 color: "white" - ParticleSystem{ id: particles } + + ParticleSystem { id: particles } + ImageParticle { system: particles - sprites: Sprite{ + sprites: Sprite { name: "snow" source: "../images/snowflake.png" frames: 51 @@ -57,31 +59,34 @@ Rectangle { durationVariation: 8 } } + Emitter { system: particles emitRate: 20 lifeSpan: 8000 - speed: PointDirection{ y:80; yVariation: 40; } - acceleration: PointDirection{ y: 4 } + speed: PointDirection { y:80; yVariation: 40; } + acceleration: PointDirection { y: 4 } size: 36 endSize: 12 sizeVariation: 8 width: parent.width height: 100 } - MouseArea{ + + MouseArea { id: ma anchors.fill: parent hoverEnabled: true } - Rectangle{ + + Rectangle { color: "#803333AA" border.color: "black" x: ma.mouseX - 36 y: ma.mouseY - 36 width: 72 height: 72 - Age{ + Age { anchors.fill: parent system: particles once: true diff --git a/examples/declarative/particles/affectors/attractor.qml b/examples/declarative/particles/affectors/attractor.qml index 8012e710df..d6660d6a0d 100644 --- a/examples/declarative/particles/affectors/attractor.qml +++ b/examples/declarative/particles/affectors/attractor.qml @@ -41,14 +41,14 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root width: 360 height: 540 color: "black" property bool spacePressed: false focus: true - Image{ + Image { source: "../images/finalfrontier.png" anchors.centerIn:parent } @@ -65,7 +65,7 @@ Rectangle{ } } - Emitter{ + Emitter { group: "stars" system: particles emitRate: 40 @@ -73,10 +73,10 @@ Rectangle{ enabled: true size: 30 sizeVariation: 10 - speed: PointDirection{ x: 220; xVariation: 40 } + speed: PointDirection { x: 220; xVariation: 40 } height: parent.height } - Emitter{ + Emitter { group: "roids" system: particles emitRate: 10 @@ -84,14 +84,14 @@ Rectangle{ enabled: true size: 30 sizeVariation: 10 - speed: PointDirection{ x: 220; xVariation: 40 } + speed: PointDirection { x: 220; xVariation: 40 } height: parent.height } - ParticleSystem{ + ParticleSystem { id: particles anchors.fill: parent } - ImageParticle{ + ImageParticle { id: stars groups: ["stars"] system: particles @@ -100,11 +100,11 @@ Rectangle{ colorVariation: 0.1 alpha: 0 } - ImageParticle{ + ImageParticle { id: roids groups: ["roids"] system: particles - sprites: Sprite{ + sprites: Sprite { id: spinState name: "spinning" source: "../images/meteor.png" @@ -113,7 +113,7 @@ Rectangle{ speedModifiesDuration: -0.1 } } - ImageParticle{ + ImageParticle { id: shot groups: ["shot"] system: particles @@ -122,7 +122,7 @@ Rectangle{ color: "#0FF06600" colorVariation: 0.3 } - ImageParticle{ + ImageParticle { id: engine groups: ["engine"] system: particles @@ -145,20 +145,20 @@ Rectangle{ colorVariation: 0.2 } - Attractor{ + Attractor { id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000; system: particles affectedParameter: Attractor.Acceleration proportionalToDistance: Attractor.InverseQuadratic } - Age{ + Age { system: particles x: gs.pointX - 8; y: gs.pointY - 8; width: 16 height: 16 } - Rectangle{ + Rectangle { color: "black" width: 8 height: 8 @@ -166,18 +166,19 @@ Rectangle{ x: gs.pointX - 4 y: gs.pointY - 4 } - Image{ + + Image { source:"../images/rocket2.png" id: ship width: 45 height: 22 - MouseArea{ + MouseArea { id: ma anchors.fill: parent; drag.axis: Drag.XandYAxis drag.target: ship } - Emitter{ + Emitter { group: "engine" system: particles emitRate: 200 @@ -185,23 +186,24 @@ Rectangle{ size: 10 endSize: 4 sizeVariation: 4 - speed: PointDirection{ x: -128; xVariation: 32 } + speed: PointDirection { x: -128; xVariation: 32 } height: parent.height width: 20 } - Emitter{ + Emitter { group: "shot" system: particles emitRate: 32 lifeSpan: 2000 enabled: spacePressed size: 40 - speed: PointDirection{ x: 256; } + speed: PointDirection { x: 256; } x: parent.width y: parent.height/2 } } - Text{ + + Text { color: "white" anchors.bottom: parent.bottom text:"Drag the ship, Spacebar to fire." diff --git a/examples/declarative/particles/affectors/customaffector.qml b/examples/declarative/particles/affectors/customaffector.qml index e9aea62a5a..f3c14e2bb3 100644 --- a/examples/declarative/particles/affectors/customaffector.qml +++ b/examples/declarative/particles/affectors/customaffector.qml @@ -45,18 +45,20 @@ Item { width: 360 height: 600 - Image{ + Image { source: "../images/backgroundLeaves.jpg" anchors.fill: parent } - ParticleSystem{ id: sys } - Emitter{ + ParticleSystem { + id: sys + } + Emitter { system: sys width: parent.width emitRate: 4 lifeSpan: 14000 size: 80 - speed: PointDirection{ y: 60 } + speed: PointDirection { y: 60 } } Wander { system: sys @@ -65,21 +67,22 @@ Item { xVariance: 60 pace: 60 } - Affector{ + + Affector { system: sys property real coefficient: 0.1 property real speed: 1.5 width: parent.width height: parent.height - 100 - onAffectParticles:{ + onAffectParticles: { /* //Linear movement - if (particle.r == 0){ + if (particle.r == 0) { particle.r = Math.random() > 0.5 ? -1 : 1; - }else if (particle.r == 1){ + }else if (particle.r == 1) { particle.rotation += speed * dt; if(particle.rotation >= maxAngle) particle.r = -1; - }else if (particle.r == -1){ + }else if (particle.r == -1) { particle.rotation -= speed * dt; if(particle.rotation <= -1 * maxAngle) particle.r = 1; @@ -100,14 +103,14 @@ Item { } } - Affector{//Custom Friction, adds some 'randomness' + Affector {//Custom Friction, adds some 'randomness' system: sys //onceOff: true x: -60 width: parent.width + 120 height: 100 anchors.bottom: parent.bottom - onAffectParticles:{ + onAffectParticles: { for (var i=0; i<particles.length; i++) { var particle = particles[i]; var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1; @@ -125,34 +128,35 @@ Item { } } } - ImageParticle{ + + ImageParticle { anchors.fill: parent id: particles system: sys - sprites: [Sprite{ + sprites: [Sprite { source: "../images/realLeaf1.png" frames: 1 duration: 1 to: {"a":1, "b":1, "c":1, "d":1} - }, Sprite{ + }, Sprite { name: "a" source: "../images/realLeaf1.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "b" source: "../images/realLeaf2.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "c" source: "../images/realLeaf3.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "d" source: "../images/realLeaf4.png" frames: 1 diff --git a/examples/declarative/particles/affectors/friction.qml b/examples/declarative/particles/affectors/friction.qml index 823f924e22..f3301b1826 100644 --- a/examples/declarative/particles/affectors/friction.qml +++ b/examples/declarative/particles/affectors/friction.qml @@ -45,47 +45,48 @@ Item { width: 360 height: 600 - Image{ + Image { source: "../images/backgroundLeaves.jpg" anchors.fill: parent } - ParticleSystem{ id: sys } - Emitter{ + ParticleSystem { id: sys } + Emitter { system: sys width: parent.width emitRate: 4 lifeSpan: 14000 size: 80 - speed: PointDirection{ y: 160; yVariation: 80; xVariation: 20 } + speed: PointDirection { y: 160; yVariation: 80; xVariation: 20 } } - ImageParticle{ + + ImageParticle { anchors.fill: parent id: particles system: sys - sprites: [Sprite{ + sprites: [Sprite { source: "../images/realLeaf1.png" frames: 1 duration: 1 to: {"a":1, "b":1, "c":1, "d":1} - }, Sprite{ + }, Sprite { name: "a" source: "../images/realLeaf1.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "b" source: "../images/realLeaf2.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "c" source: "../images/realLeaf3.png" frames: 1 duration: 10000 }, - Sprite{ + Sprite { name: "d" source: "../images/realLeaf4.png" frames: 1 diff --git a/examples/declarative/particles/affectors/gravity.qml b/examples/declarative/particles/affectors/gravity.qml index d1f54a37fa..97d9c8569a 100644 --- a/examples/declarative/particles/affectors/gravity.qml +++ b/examples/declarative/particles/affectors/gravity.qml @@ -58,6 +58,7 @@ Item { } } } + Rectangle { id: ground width: parent.width * 2 @@ -71,13 +72,15 @@ Item { GradientStop { position: 1.0; color: "DarkGreen"; } } } - MouseArea{ + + MouseArea { anchors.fill: parent onPositionChanged: { var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI; ground.rotation = rot; } } + ParticleSystem { id: sys } Gravity { system: sys @@ -91,7 +94,7 @@ Item { lifeSpan: 10000 size: 64 } - ImageParticle{ + ImageParticle { anchors.fill: parent system: sys source: "../images/realLeaf1.png" diff --git a/examples/declarative/particles/affectors/groupgoal.qml b/examples/declarative/particles/affectors/groupgoal.qml index ad45b87d1c..35febf3353 100644 --- a/examples/declarative/particles/affectors/groupgoal.qml +++ b/examples/declarative/particles/affectors/groupgoal.qml @@ -49,40 +49,41 @@ Rectangle { color: "black" property int score: 0 - Text{ + Text { color: "white" anchors.right: parent.right text: score } - ParticleSystem{ + + ParticleSystem { id: particles anchors.fill: parent - ParticleGroup{ + ParticleGroup { name: "unlit" duration: 1000 to: {"lighting":1, "unlit":99} - ImageParticle{ + ImageParticle { source: "../images/particleA.png" colorVariation: 0.1 color: "#2060160f" } - SpriteGoal{ + SpriteGoal { whenCollidingWith: ["lit"] goalState: "lighting" jump: true systemStates: true } } - ParticleGroup{ + ParticleGroup { name: "lighting" duration: 100 to: {"lit":1} } - ParticleGroup{ + ParticleGroup { name: "lit" duration: 10000 onEntered: score++; - TrailEmitter{ + TrailEmitter { id: fireballFlame group: "flame" @@ -96,7 +97,7 @@ Rectangle { endSize: 4 } - TrailEmitter{ + TrailEmitter { id: fireballSmoke group: "smoke" @@ -105,8 +106,8 @@ Rectangle { emitWidth: 16 emitHeight: 16 - speed: PointDirection{yVariation: 16; xVariation: 16} - acceleration: PointDirection{y: -16} + speed: PointDirection {yVariation: 16; xVariation: 16} + acceleration: PointDirection {y: -16} size: 24 sizeVariation: 8 @@ -114,7 +115,7 @@ Rectangle { } } - ImageParticle{ + ImageParticle { id: smoke anchors.fill: parent groups: ["smoke"] @@ -122,7 +123,7 @@ Rectangle { colorVariation: 0 color: "#00111111" } - ImageParticle{ + ImageParticle { id: pilot anchors.fill: parent groups: ["pilot"] @@ -131,7 +132,7 @@ Rectangle { blueVariation: 0.4 color: "#0010004f" } - ImageParticle{ + ImageParticle { id: flame anchors.fill: parent groups: ["flame", "lit", "lighting"] @@ -140,18 +141,18 @@ Rectangle { color: "#00ff400f" } - Emitter{ + Emitter { height: parent.height/2 emitRate: 4 lifeSpan: 4000//TODO: Infinite & kill zone size: 24 sizeVariation: 4 - speed: PointDirection{x:120; xVariation: 80; yVariation: 50} - acceleration: PointDirection{y:120} + speed: PointDirection {x:120; xVariation: 80; yVariation: 50} + acceleration: PointDirection {y:120} group: "unlit" } - Emitter{ + Emitter { id: flamer x: 100 y: 300 @@ -161,8 +162,8 @@ Rectangle { size: 24 sizeVariation: 2 endSize: 0 - speed: PointDirection{ y:-100; yVariation: 4; xVariation: 4 } - SpriteGoal{ + speed: PointDirection { y:-100; yVariation: 4; xVariation: 4 } + SpriteGoal { groups: ["unlit"] goalState: "lit" jump: true @@ -172,11 +173,11 @@ Rectangle { y: -55 height: 75 width: 30 - shape: MaskShape{source: "../images/matchmask.png"} + shape: MaskShape {source: "../images/matchmask.png"} } } //Click to enflame - SpriteGoal{//TODO: Aux emiiters in the state definition (which allows the occasional ball to spontaneously combust) + SpriteGoal {//TODO: Aux emiiters in the state definition (which allows the occasional ball to spontaneously combust) groups: ["unlit"] goalState: "lighting" jump: true @@ -187,7 +188,7 @@ Rectangle { x: ma.mouseX - width/2 y: ma.mouseY - height/2 } - MouseArea{ + MouseArea { id: ma anchors.fill: parent } diff --git a/examples/declarative/particles/affectors/spritegoal.qml b/examples/declarative/particles/affectors/spritegoal.qml index a7b602954c..043edbd6cc 100644 --- a/examples/declarative/particles/affectors/spritegoal.qml +++ b/examples/declarative/particles/affectors/spritegoal.qml @@ -46,7 +46,7 @@ Item { id: root width: 360 height: 540 - MouseArea{ + MouseArea { id: ma anchors.fill: parent } @@ -82,27 +82,27 @@ Item { anchors.centerIn: parent - //acceleration: AngledDirection{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed? - acceleration: PointDirection{ xVariation: 200; yVariation: 200; } + //acceleration: AngledDirection {angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed? + acceleration: PointDirection { xVariation: 200; yVariation: 200; } size: 0 endSize: 80 sizeVariation: 10 } - Emitter{ + Emitter { system: sys group: "meteor" emitRate: 12 lifeSpan: 5000 - acceleration: PointDirection{ xVariation: 80; yVariation: 80; } + acceleration: PointDirection { xVariation: 80; yVariation: 80; } size: 15 endSize: 300 anchors.centerIn: parent } - ImageParticle{ + ImageParticle { system: sys groups: ["meteor"] - sprites:[Sprite{ + sprites:[Sprite { id: spinState name: "spinning" source: "../images/meteor.png" @@ -110,14 +110,14 @@ Item { duration: 40 speedModifiesDuration: -0.1 to: {"explode":0, "spinning":1} - },Sprite{ + },Sprite { name: "explode" source: "../images/_explo.png" frames: 22 duration: 40 speedModifiesDuration: -0.1 to: {"nullFrame":1} - },Sprite{//Not sure if this is needed, but seemed easiest + },Sprite {//Not sure if this is needed, but seemed easiest name: "nullFrame" source: "../images/nullRock.png" frames: 1 @@ -125,7 +125,7 @@ Item { } ] } - SpriteGoal{ + SpriteGoal { groups: ["meteor"] system: sys goalState: "explode" @@ -167,7 +167,8 @@ Item { } } - ImageParticle{ + + ImageParticle { z:0 system: sys groups: ["exhaust"] @@ -190,7 +191,8 @@ Item { colorVariation: 0.2 } - Emitter{ + + Emitter { id: trailsNormal2 system: sys group: "exhaust" @@ -201,10 +203,10 @@ Item { y: holder.y x: holder.x - speed: PointDirection{ xVariation: 40; yVariation: 40; } + speed: PointDirection { xVariation: 40; yVariation: 40; } speedFromMovement: 16 - acceleration: PointDirection{ xVariation: 10; yVariation: 10; } + acceleration: PointDirection { xVariation: 10; yVariation: 10; } size: 4 sizeVariation: 4 diff --git a/examples/declarative/particles/affectors/turbulence.qml b/examples/declarative/particles/affectors/turbulence.qml index 75737240bc..a69f1a4159 100644 --- a/examples/declarative/particles/affectors/turbulence.qml +++ b/examples/declarative/particles/affectors/turbulence.qml @@ -41,26 +41,27 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { width: 360 height: 600 color: "#222222" id: root - Image{ + Image { source: "../images/candle.png" anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.bottomMargin: -8 anchors.horizontalCenterOffset: 2 } - ParticleSystem{ + ParticleSystem { id: ps } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: turb.enabled = !turb.enabled } - Turbulence{ + + Turbulence { id: turb system: ps enabled: true @@ -70,21 +71,22 @@ Rectangle{ anchors.fill: parent strength: 32 } - ImageParticle{ + + ImageParticle { groups: ["smoke"] system: ps source: "../images/particle.png" color: "#11111111" colorVariation: 0 } - ImageParticle{ + ImageParticle { groups: ["flame"] system: ps source: "../images/particle.png" color: "#11ff400f" colorVariation: 0.1 } - Emitter{ + Emitter { anchors.centerIn: parent system: ps group: "flame" @@ -94,10 +96,10 @@ Rectangle{ size: 20 endSize: 10 sizeVariation: 10 - acceleration: PointDirection{ y: -40 } - speed: AngleDirection{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection { y: -40 } + speed: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } } - TrailEmitter{ + TrailEmitter { id: smoke1 width: root.width height: root.height/2 - 20 @@ -111,10 +113,10 @@ Rectangle{ size: 16 endSize: 8 sizeVariation: 8 - acceleration: PointDirection{ y: -40 } - speed: AngleDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection { y: -40 } + speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } - TrailEmitter{ + TrailEmitter { id: smoke2 width: root.width height: root.height/2 - 40 @@ -127,7 +129,7 @@ Rectangle{ size: 36 endSize: 24 sizeVariation: 12 - acceleration: PointDirection{ y: -40 } - speed: AngleDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection { y: -40 } + speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } } diff --git a/examples/declarative/particles/affectors/wander.qml b/examples/declarative/particles/affectors/wander.qml index 8d9e55e710..1a61d97abb 100644 --- a/examples/declarative/particles/affectors/wander.qml +++ b/examples/declarative/particles/affectors/wander.qml @@ -42,13 +42,13 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 import "../exampleslauncher/content" as UI -Rectangle{ +Rectangle { width: 360 height: 540 ParticleSystem { id: particles } ImageParticle { system: particles - sprites: Sprite{ + sprites: Sprite { name: "snow" source: "../images/snowflake.png" frames: 51 @@ -56,6 +56,7 @@ Rectangle{ durationVariation: 8 } } + Wander { id: wanderer system: particles @@ -63,29 +64,30 @@ Rectangle{ xVariance: 360/(wanderer.affectedParameter+1); pace: 100*(wanderer.affectedParameter+1); } + Emitter { system: particles emitRate: 20 lifeSpan: 7000 - speed: PointDirection{ y:80; yVariation: 40; } - acceleration: PointDirection{ y: 4 } + speed: PointDirection { y:80; yVariation: 40; } + acceleration: PointDirection { y: 4 } size: 20 sizeVariation: 10 width: parent.width height: 100 } - Row{ + Row { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - UI.Button{ + UI.Button { text:"dx/dt" onClicked: wanderer.affectedParameter = Wander.Position; } - UI.Button{ + UI.Button { text:"dv/dt" onClicked: wanderer.affectedParameter = Wander.Velocity; } - UI.Button{ + UI.Button { text:"da/dt" onClicked: wanderer.affectedParameter = Wander.Acceleration; } diff --git a/examples/declarative/particles/customparticle/blurparticles.qml b/examples/declarative/particles/customparticle/blurparticles.qml index 4c33d14969..9767818bd3 100644 --- a/examples/declarative/particles/customparticle/blurparticles.qml +++ b/examples/declarative/particles/customparticle/blurparticles.qml @@ -41,32 +41,32 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "white" width: 240 height: 360 - ParticleSystem{ + ParticleSystem { id: sys } - Emitter{ + Emitter { system:sys height: parent.height emitRate: 1 lifeSpan: 12000 - speed: PointDirection{x:20;} + speed: PointDirection {x:20;} size: 64 } - ShaderEffectSource{ + ShaderEffectSource { id: theSource sourceItem: theItem hideSource: true } - Image{ + Image { id: theItem source: "../images/smile.png" } - CustomParticle{ + CustomParticle { system: sys vertexShader:" uniform lowp float qt_Opacity; diff --git a/examples/declarative/particles/customparticle/fragmentshader.qml b/examples/declarative/particles/customparticle/fragmentshader.qml index ecc06a6be6..6dc9e41db2 100644 --- a/examples/declarative/particles/customparticle/fragmentshader.qml +++ b/examples/declarative/particles/customparticle/fragmentshader.qml @@ -41,15 +41,15 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -ParticleSystem{ +ParticleSystem { id: root width: 1024 height: 768 - Rectangle{ + Rectangle { z: -1 anchors.fill: parent color: "black" - Text{ + Text { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 36 @@ -57,16 +57,18 @@ ParticleSystem{ text: "It's all in the fragment shader." } } - Emitter{ + + Emitter { emitRate: 400 lifeSpan: 8000 size: 24 sizeVariation: 16 - speed: PointDirection{x: root.width/10; y: root.height/10;} - //acceleration: AngledDirection{angle:225; magnitude: root.width/36; angleVariation: 45; magnitudeVariation: 80} - acceleration: PointDirection{x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20} + speed: PointDirection {x: root.width/10; y: root.height/10;} + //acceleration: AngledDirection {angle:225; magnitude: root.width/36; angleVariation: 45; magnitudeVariation: 80} + acceleration: PointDirection {x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20} } - CustomParticle{ + + CustomParticle { vertexShader:" uniform lowp float qt_Opacity; varying lowp float fFade; diff --git a/examples/declarative/particles/customparticle/imagecolors.qml b/examples/declarative/particles/customparticle/imagecolors.qml index 20d6220ee3..591fd2421f 100644 --- a/examples/declarative/particles/customparticle/imagecolors.qml +++ b/examples/declarative/particles/customparticle/imagecolors.qml @@ -41,35 +41,35 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { width: 400 height: 400 - Rectangle{ + Rectangle { id: root color: "white" width: 310 height: 300 anchors.centerIn: parent - ParticleSystem{ id: sys } - CustomParticle{ + ParticleSystem { id: sys } + CustomParticle { system: sys property real maxWidth: root.width property real maxHeight: root.height - ShaderEffectSource{ + ShaderEffectSource { id: pictureSource sourceItem: picture hideSource: true } - Image{ + Image { id: picture source: "../images/smile.png" } - ShaderEffectSource{ + ShaderEffectSource { id: particleSource sourceItem: particle hideSource: true } - Image{ + Image { id: particle source: "../images/particle.png" } @@ -99,7 +99,8 @@ Rectangle{ gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade; }" } - Emitter{ + + Emitter { id: emitter system: sys enabled: false @@ -107,9 +108,9 @@ Rectangle{ maximumEmitted: 1200 anchors.fill: parent size: 32 - speed: PointDirection{ xVariation: 12; yVariation: 12 } + speed: PointDirection { xVariation: 12; yVariation: 12 } } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: emitter.burst(1200); } diff --git a/examples/declarative/particles/emitters/customemitter.qml b/examples/declarative/particles/emitters/customemitter.qml index 39e2d066f6..7fbc529db6 100644 --- a/examples/declarative/particles/emitters/customemitter.qml +++ b/examples/declarative/particles/emitters/customemitter.qml @@ -41,32 +41,34 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -ParticleSystem{ +ParticleSystem { id: sys width: 360 height: 600 running: true - Rectangle{ + Rectangle { z: -1 anchors.fill: parent color: "black" } + property real petalLength: 180 property real petalRotation: 0 - NumberAnimation on petalRotation{ + NumberAnimation on petalRotation { from: 0; to: 360; loops: -1; running: true duration: 24000 } - function convert(a){return a*(Math.PI/180);} - Emitter{ + + function convert(a) {return a*(Math.PI/180);} + Emitter { lifeSpan: 4000 emitRate: 120 size: 12 anchors.centerIn: parent - onEmitParticles:{ + onEmitParticles: { for (var i=0; i<particles.length; i++) { var particle = particles[i]; particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24)); @@ -80,7 +82,8 @@ ParticleSystem{ } } } - ImageParticle{ + + ImageParticle { source: "../images/particle4.png" alpha: 0.0 redVariation: 0.6 diff --git a/examples/declarative/particles/emitters/emitmask.qml b/examples/declarative/particles/emitters/emitmask.qml index fddf567d97..1703ab2d20 100644 --- a/examples/declarative/particles/emitters/emitmask.qml +++ b/examples/declarative/particles/emitters/emitmask.qml @@ -41,29 +41,32 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "goldenrod" width: 400 height: 400 - ParticleSystem{ + ParticleSystem { width: 300 height: 300 anchors.centerIn: parent - ImageParticle{ + + ImageParticle { source: "../images/particle.png" z: 2 anchors.fill: parent color: "#336666CC" colorVariation: 0.0 } - Emitter{ + + Emitter { anchors.fill: parent emitRate: 6000 lifeSpan: 720 size: 10 - shape: MaskShape{ + shape: MaskShape { source: "../images/smileMask.png" } } + } } diff --git a/examples/declarative/particles/emitters/maximumemitted.qml b/examples/declarative/particles/emitters/maximumemitted.qml index 6342eb338e..d9beb60cce 100644 --- a/examples/declarative/particles/emitters/maximumemitted.qml +++ b/examples/declarative/particles/emitters/maximumemitted.qml @@ -41,22 +41,24 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "black" width: 360 height: 540 - ParticleSystem{ + ParticleSystem { id: sys onEmptyChanged: if (empty) sys.pause(); } - ImageParticle{ + + ImageParticle { system: sys id: cp source: "../images/particle.png" colorVariation: 0.4 color: "#000000FF" } - Emitter{ + + Emitter { //burst on click id: bursty system: sys @@ -65,12 +67,13 @@ Rectangle{ y: ma.mouseY emitRate: 16000 maximumEmitted: 4000 - acceleration: AngleDirection{angleVariation: 360; magnitude: 360; } + acceleration: AngleDirection {angleVariation: 360; magnitude: 360; } size: 8 endSize: 16 sizeVariation: 4 } - MouseArea{ + + MouseArea { anchors.fill: parent onPressed: sys.resume() id: ma diff --git a/examples/declarative/particles/emitters/shapeanddirection.qml b/examples/declarative/particles/emitters/shapeanddirection.qml index 9e7a990ef8..13ecdd4421 100644 --- a/examples/declarative/particles/emitters/shapeanddirection.qml +++ b/examples/declarative/particles/emitters/shapeanddirection.qml @@ -41,19 +41,21 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root width: 360 height: 540 color: "black" - Image{ + Image { anchors.fill: parent source: "../images/portal_bg.png" } - ParticleSystem{ - id: particles + + ParticleSystem { + id: particles } - ImageParticle{ + + ImageParticle { groups: ["center","edge"] anchors.fill: parent system: particles @@ -61,7 +63,8 @@ Rectangle{ colorVariation: 0.1 color: "#009999FF" } - Emitter{ + + Emitter { anchors.fill: parent group: "center" system: particles @@ -70,15 +73,16 @@ Rectangle{ size: 20 sizeVariation: 2 endSize: 0 - shape: EllipseShape{fill: false} - speed: TargetDirection{ + shape: EllipseShape {fill: false} + speed: TargetDirection { targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true magnitude: 0.5 } } - Emitter{ + + Emitter { anchors.fill: parent group: "edge" startTime: 2000 @@ -88,15 +92,15 @@ Rectangle{ size: 28 sizeVariation: 2 endSize: 16 - shape: EllipseShape{fill: false} - speed: TargetDirection{ + shape: EllipseShape {fill: false} + speed: TargetDirection { targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true magnitude: 0.1 magnitudeVariation: 0.1 } - acceleration: TargetDirection{ + acceleration: TargetDirection { targetX: root.width/2 targetY: root.height/2 targetVariation: 200 diff --git a/examples/declarative/particles/emitters/timedgroupchanges.qml b/examples/declarative/particles/emitters/timedgroupchanges.qml index e76a4439b1..5da64f1e50 100644 --- a/examples/declarative/particles/emitters/timedgroupchanges.qml +++ b/examples/declarative/particles/emitters/timedgroupchanges.qml @@ -41,49 +41,50 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { width: 360 height: 600 color: "black" - ParticleSystem{ + ParticleSystem { anchors.fill: parent id: syssy - ParticleGroup{ + ParticleGroup { name: "fire" duration: 2000 durationVariation: 2000 to: {"splode":1} } - ParticleGroup{ + ParticleGroup { name: "splode" duration: 400 to: {"dead":1} - TrailEmitter{ + TrailEmitter { group: "works" emitRatePerParticle: 100 lifeSpan: 1000 maximumEmitted: 1200 size: 8 - speed: AngleDirection{angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} - acceleration: PointDirection{y:100; yVariation: 20} + speed: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} + acceleration: PointDirection {y:100; yVariation: 20} } } - ParticleGroup{ + ParticleGroup { name: "dead" duration: 1000 - Affector{ + Affector { once: true onAffected: worksEmitter.burst(400,x,y) } } - Timer{ + + Timer { interval: 6000 running: true triggeredOnStart: true repeat: true onTriggered:startingEmitter.pulse(0.1); } - Emitter{ + Emitter { id: startingEmitter group: "fire" width: parent.width @@ -91,10 +92,11 @@ Rectangle{ enabled: false emitRate: 80 lifeSpan: 6000 - speed: PointDirection{y:-100;} + speed: PointDirection {y:-100;} size: 32 } - Emitter{ + + Emitter { id: worksEmitter group: "works" enabled: false @@ -102,13 +104,14 @@ Rectangle{ lifeSpan: 1600 maximumEmitted: 6400 size: 8 - speed: CumulativeDirection{ - PointDirection{y:-100} - AngleDirection{angleVariation: 360; magnitudeVariation: 80;} + speed: CumulativeDirection { + PointDirection {y:-100} + AngleDirection {angleVariation: 360; magnitudeVariation: 80;} } - acceleration: PointDirection{y:100; yVariation: 20} + acceleration: PointDirection {y:100; yVariation: 20} } - ImageParticle{ + + ImageParticle { groups: ["works", "fire", "splode"] source: "../images/particle.png" entryEffect: ImageParticle.Scale diff --git a/examples/declarative/particles/emitters/trailemitter.qml b/examples/declarative/particles/emitters/trailemitter.qml index d5986cc9b8..e246b6605f 100644 --- a/examples/declarative/particles/emitters/trailemitter.qml +++ b/examples/declarative/particles/emitters/trailemitter.qml @@ -47,11 +47,11 @@ Rectangle { height: 540 color: "black" - ParticleSystem{ + ParticleSystem { id: particles } - ImageParticle{ + ImageParticle { id: smoke system: particles anchors.fill: parent @@ -60,7 +60,7 @@ Rectangle { colorVariation: 0 color: "#00111111" } - ImageParticle{ + ImageParticle { id: flame anchors.fill: parent system: particles @@ -69,7 +69,8 @@ Rectangle { colorVariation: 0.1 color: "#00ff400f" } - Emitter{ + + Emitter { id: fire system: particles group: "C" @@ -80,14 +81,15 @@ Rectangle { emitRate: 350 lifeSpan: 3500 - acceleration: PointDirection{ y: -17; xVariation: 3 } - speed: PointDirection{xVariation: 3} + acceleration: PointDirection { y: -17; xVariation: 3 } + speed: PointDirection {xVariation: 3} size: 24 sizeVariation: 8 endSize: 4 } - TrailEmitter{ + + TrailEmitter { id: fireSmoke group: "B" system: particles @@ -98,14 +100,15 @@ Rectangle { emitRatePerParticle: 1 lifeSpan: 2000 - speed: PointDirection{y:-17*6; yVariation: -17; xVariation: 3} - acceleration: PointDirection{xVariation: 3} + speed: PointDirection {y:-17*6; yVariation: -17; xVariation: 3} + acceleration: PointDirection {xVariation: 3} size: 36 sizeVariation: 8 endSize: 16 } - TrailEmitter{ + + TrailEmitter { id: fireballFlame anchors.fill: parent system: particles @@ -122,7 +125,7 @@ Rectangle { endSize: 4 } - TrailEmitter{ + TrailEmitter { id: fireballSmoke anchors.fill: parent system: particles @@ -134,14 +137,15 @@ Rectangle { emitWidth: 16 emitHeight: 16 - speed: PointDirection{yVariation: 16; xVariation: 16} - acceleration: PointDirection{y: -16} + speed: PointDirection {yVariation: 16; xVariation: 16} + acceleration: PointDirection {y: -16} size: 24 sizeVariation: 8 endSize: 8 } - Emitter{ + + Emitter { id: balls system: particles group: "E" @@ -152,12 +156,13 @@ Rectangle { emitRate: 2 lifeSpan: 7000 - speed: PointDirection{y:-17*4*2; xVariation: 6*6} - acceleration: PointDirection{y: 17*2; xVariation: 6*6} + speed: PointDirection {y:-17*4*2; xVariation: 6*6} + acceleration: PointDirection {y: 17*2; xVariation: 6*6} size: 12 sizeVariation: 4 } + Turbulence { //A bit of turbulence makes the smoke look better anchors.fill: parent groups: ["A","B"] diff --git a/examples/declarative/particles/emitters/velocityfrommotion.qml b/examples/declarative/particles/emitters/velocityfrommotion.qml index e42a72c94e..60d35558f0 100644 --- a/examples/declarative/particles/emitters/velocityfrommotion.qml +++ b/examples/declarative/particles/emitters/velocityfrommotion.qml @@ -56,26 +56,10 @@ Rectangle { MouseArea { id: mouseArea anchors.fill: root - -/* - onPressed: stopAndStart() - onReleased: stopAndStart() - function stopAndStart() { - trailsNormal.emitting = false; - trailsNormal.emitting = true; - trailsStars.emitting = false; - trailsStars.emitting = true; - trailsNormal2.emitting = false; - trailsNormal2.emitting = true; - trailsStars2.emitting = false; - trailsStars2.emitting = true; - print("stop and start") - } -*/ } - ParticleSystem{ id: sys1 } - ImageParticle{ + ParticleSystem { id: sys1 } + ImageParticle { system: sys1 source: "../images/particle.png" color: "cyan" @@ -105,7 +89,7 @@ Rectangle { } colorVariation: 0.3 } - Emitter{ + Emitter { id: trailsNormal system: sys1 @@ -116,15 +100,15 @@ Rectangle { y: mouseArea.pressed ? mouseArea.mouseY : circle.cy x: mouseArea.pressed ? mouseArea.mouseX : circle.cx - speed: PointDirection{xVariation: 4; yVariation: 4;} - acceleration: PointDirection{xVariation: 10; yVariation: 10;} + speed: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} speedFromMovement: 8 size: 8 sizeVariation: 4 } ParticleSystem { id: sys2 } - ImageParticle{ + ImageParticle { color: "cyan" system: sys2 alpha: 0 @@ -144,7 +128,7 @@ Rectangle { colorVariation: 0.5 source: "../images/star.png" } - Emitter{ + Emitter { id: trailsStars system: sys2 @@ -155,15 +139,15 @@ Rectangle { y: mouseArea.pressed ? mouseArea.mouseY : circle.cy x: mouseArea.pressed ? mouseArea.mouseX : circle.cx - speed: PointDirection{xVariation: 4; yVariation: 4;} - acceleration: PointDirection{xVariation: 10; yVariation: 10;} + speed: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} speedFromMovement: 8 size: 22 sizeVariation: 4 } ParticleSystem { id: sys3; } - ImageParticle{ + ImageParticle { source: "../images/particle.png" system: sys3 color: "orange" @@ -185,7 +169,7 @@ Rectangle { colorVariation: 0.2 } - Emitter{ + Emitter { id: trailsNormal2 system: sys3 @@ -197,14 +181,14 @@ Rectangle { speedFromMovement: 16 - speed: PointDirection{xVariation: 4; yVariation: 4;} - acceleration: PointDirection{xVariation: 10; yVariation: 10;} + speed: PointDirection {xVariation: 4; yVariation: 4;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} size: 12 sizeVariation: 4 } ParticleSystem { id: sys4; } - ImageParticle{ + ImageParticle { system: sys4 source: "../images/star.png" color: "green" @@ -225,7 +209,7 @@ Rectangle { colorVariation: 0.5 } - Emitter{ + Emitter { id: trailsStars2 system: sys4 @@ -237,8 +221,8 @@ Rectangle { x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx speedFromMovement: 16 - speed: PointDirection{xVariation: 2; yVariation: 2;} - acceleration: PointDirection{xVariation: 10; yVariation: 10;} + speed: PointDirection {xVariation: 2; yVariation: 2;} + acceleration: PointDirection {xVariation: 10; yVariation: 10;} size: 22 sizeVariation: 4 diff --git a/examples/declarative/particles/exampleslauncher/content/Shell.qml b/examples/declarative/particles/exampleslauncher/content/Shell.qml index 3a327915ed..8f9d5b3fc6 100644 --- a/examples/declarative/particles/exampleslauncher/content/Shell.qml +++ b/examples/declarative/particles/exampleslauncher/content/Shell.qml @@ -40,36 +40,36 @@ import QtQuick 2.0 -Loader{ +Loader { id: ldr visible: false focus: visible onVisibleChanged: source = "" opacity: visible?1:0 - Behavior on opacity{NumberAnimation{}} + Behavior on opacity {NumberAnimation {}} - function setDemo(str){ + function setDemo(str) { visible = true; source = str; } - Image{//TODO: Augment with PARTICLES + Image {//TODO: Augment with PARTICLES z: 1 source: "../../images/launcherIcons/close.png" - MouseArea{ + MouseArea { anchors.fill: parent onClicked: ldr.visible = false; } } - Rectangle{ + Rectangle { z: -1 anchors.fill: parent color:"black" - Text{ + Text { color: "white" anchors.centerIn: parent text: ldr.Status == Loader.Error ? "Error :(" : "Loading..." } - MouseArea{ + MouseArea { id: graball anchors.fill: parent onClicked:; diff --git a/examples/declarative/particles/exampleslauncher/exampleslauncher.qml b/examples/declarative/particles/exampleslauncher/exampleslauncher.qml index 92dd797ea1..b86aad05e5 100644 --- a/examples/declarative/particles/exampleslauncher/exampleslauncher.qml +++ b/examples/declarative/particles/exampleslauncher/exampleslauncher.qml @@ -43,16 +43,17 @@ import QtQuick.Particles 2.0 import "content/launcher.js" as Util import "content" -Rectangle{ +Rectangle { color: "black" width: 360 height: 600 - Shell{ + Shell { z: 1 id: shell anchors.fill: parent } - VisualDataModel{//TODO: Transitions between modes (and a second mode...) + + VisualDataModel {//TODO: Transitions between modes (and a second mode...) id: vdm model: [ "../../affectors/attractor.qml", @@ -83,29 +84,30 @@ Rectangle{ "../../simple/startstop.qml", "../../plasmapatrol/plasmapatrol.qml" ] - delegate: Rectangle{ + delegate: Rectangle { color: "white" width: 96 height: 96 - Image{ + Image { width: 72 height: 72 anchors.centerIn: parent source: Util.iconFromPath(modelData) } - Text{ + Text { text: Util.nameFromPath(modelData) anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 8 } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: shell.setDemo(modelData) } } } - GridView{ + + GridView { anchors.fill: parent cellWidth: 120 cellHeight: 120 diff --git a/examples/declarative/particles/imageparticle/allatonce.qml b/examples/declarative/particles/imageparticle/allatonce.qml index b37bf00d69..0d5a11f386 100644 --- a/examples/declarative/particles/imageparticle/allatonce.qml +++ b/examples/declarative/particles/imageparticle/allatonce.qml @@ -41,30 +41,31 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "white" width: 640 height: 480 - ParticleSystem{ + ParticleSystem { id: sys } - ImageParticle{ + + ImageParticle { sprites: [ - Sprite{ + Sprite { name: "licking" source: "../images/squarefacewhite.png" frames: 6 duration: 120 to: {"dying":1, "licking":5} }, - Sprite{ + Sprite { name: "dying" source: "../images/squarefacewhiteX.png" frames: 4 duration: 120 to: {"dead":1} }, - Sprite{ + Sprite { name: "dead" source: "../images/squarefacewhiteXX.png" frames: 1 @@ -76,28 +77,31 @@ Rectangle{ system: sys colorTable: "../trails/../images/colortable.png" } - Friction{ + + Friction { factor: 0.1 system: sys } - Emitter{ + + Emitter { system: sys anchors.centerIn: parent id: particles emitRate: 200 lifeSpan: 6000 - speed: AngleDirection{angleVariation: 360; magnitude: 80; magnitudeVariation: 40} + speed: AngleDirection {angleVariation: 360; magnitude: 80; magnitudeVariation: 40} size: 40 endSize: 80 } - Text{ + + Text { x: 16 y: 16 text: "QML..." style: Text.Outline; styleColor: "#AAAAAA" font.pixelSize: 32 } - Text{ + Text { anchors.bottom: parent.bottom anchors.right: parent.right anchors.margins: 16 diff --git a/examples/declarative/particles/imageparticle/colored.qml b/examples/declarative/particles/imageparticle/colored.qml index 82b48ed962..44a326e47a 100644 --- a/examples/declarative/particles/imageparticle/colored.qml +++ b/examples/declarative/particles/imageparticle/colored.qml @@ -41,18 +41,18 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { width: 360 height: 540 color: "black" - ParticleSystem{ + ParticleSystem { anchors.fill: parent - ImageParticle{ + ImageParticle { groups: ["stars"] anchors.fill: parent source: "../images/star.png" } - Emitter{ + Emitter { group: "stars" emitRate: 800 lifeSpan: 2400 @@ -60,22 +60,25 @@ Rectangle{ sizeVariation: 8 anchors.fill: parent } - ImageParticle{ + + ImageParticle { anchors.fill: parent source: "../images/star.png" alpha: 0 alphaVariation: 0.2 colorVariation: 1.0 } - Emitter{ + + Emitter { anchors.centerIn: parent emitRate: 400 lifeSpan: 2400 size: 48 sizeVariation: 8 - speed: AngleDirection{angleVariation: 180; magnitude: 60} + speed: AngleDirection {angleVariation: 180; magnitude: 60} } - Turbulence{ + + Turbulence { anchors.fill: parent strength: 2 } diff --git a/examples/declarative/particles/imageparticle/colortable.qml b/examples/declarative/particles/imageparticle/colortable.qml index b499b0733d..b0426605db 100644 --- a/examples/declarative/particles/imageparticle/colortable.qml +++ b/examples/declarative/particles/imageparticle/colortable.qml @@ -47,8 +47,9 @@ Rectangle { height: 540 color: "black" - ParticleSystem{ id: particles } - ImageParticle{ + ParticleSystem { id: particles } + + ImageParticle { system: particles colorVariation: 0.5 alpha: 0 @@ -57,7 +58,8 @@ Rectangle { colorTable: "../images/colortable.png" sizeTable: "../images/colortable.png" } - Emitter{ + + Emitter { system: particles emitRate: 500 lifeSpan: 2000 @@ -72,8 +74,8 @@ Rectangle { speedFromMovement: 20 - speed: PointDirection{ xVariation: 5; yVariation: 5;} - acceleration: PointDirection{ xVariation: 5; yVariation: 5;} + speed: PointDirection { xVariation: 5; yVariation: 5;} + acceleration: PointDirection { xVariation: 5; yVariation: 5;} size: 16 //endSize: 8 diff --git a/examples/declarative/particles/imageparticle/deformation.qml b/examples/declarative/particles/imageparticle/deformation.qml index 0fdeadf283..3787b1e402 100644 --- a/examples/declarative/particles/imageparticle/deformation.qml +++ b/examples/declarative/particles/imageparticle/deformation.qml @@ -41,12 +41,13 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "goldenrod" width: 400 height: 400 - ParticleSystem{id:sys} - ImageParticle{ + ParticleSystem {id:sys} + + ImageParticle { system: sys groups: ["goingLeft", "goingRight"] source: "../images/singlesmile.png" @@ -54,63 +55,65 @@ Rectangle{ rotationSpeed: 90 autoRotation: true } - ImageParticle{ + ImageParticle { system: sys groups: ["goingDown"] source: "../images/squarefacespriteXX.png" - yVector: PointDirection{ y: 0.5; yVariation: 0.25; xVariation: 0.25; } + yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; } rotation: 180 } - Timer{ + + Timer { running: true repeat: false interval: 100 onTriggered: emitA.enabled = true; } - Timer{ + Timer { running: true repeat: false interval: 4200 onTriggered: emitB.enabled = true; } - Timer{ + Timer { running: true repeat: false interval: 8400 onTriggered: emitC.enabled = true; } - Emitter{ + + Emitter { id: emitA x: 0 y: 120 system: sys enabled: false group: "goingRight" - speed: PointDirection{ x: 100 } + speed: PointDirection { x: 100 } lifeSpan: 4000 emitRate: 2 size: 32 } - Emitter{ + Emitter { id: emitB x: 400 y: 240 system: sys enabled: false group: "goingLeft" - speed: PointDirection{ x: -100 } + speed: PointDirection { x: -100 } lifeSpan: 4000 emitRate: 2 size: 32 } - Emitter{ + Emitter { id: emitC x: 0 y: 360 system: sys enabled: false group: "goingDown" - speed: PointDirection{ x: 100 } + speed: PointDirection { x: 100 } lifeSpan: 4000 emitRate: 2 size: 32 diff --git a/examples/declarative/particles/imageparticle/rotation.qml b/examples/declarative/particles/imageparticle/rotation.qml index c7d950642b..fe77e43f73 100644 --- a/examples/declarative/particles/imageparticle/rotation.qml +++ b/examples/declarative/particles/imageparticle/rotation.qml @@ -41,25 +41,27 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "goldenrod" width: 2000 height: 2000 - ParticleSystem{id: sys} - ImageParticle{ + ParticleSystem {id: sys} + ImageParticle { id: up system: sys source: "../images/smile.png" } - Emitter{ + + Emitter { anchors.centerIn: parent system: sys emitRate: 1000 size: 20 lifeSpan: 10000 - speed: AngleDirection{angleVariation: 360; magnitudeVariation: 100;} + speed: AngleDirection {angleVariation: 360; magnitudeVariation: 100;} } - MouseArea{ + + MouseArea { anchors.fill: parent onClicked: up.autoRotation = !up.autoRotation } diff --git a/examples/declarative/particles/imageparticle/sharing.qml b/examples/declarative/particles/imageparticle/sharing.qml index 621f672430..14a107415e 100644 --- a/examples/declarative/particles/imageparticle/sharing.qml +++ b/examples/declarative/particles/imageparticle/sharing.qml @@ -100,6 +100,7 @@ Rectangle { } } } + ListView { id: listView width: 200; height: parent.height @@ -121,7 +122,7 @@ Rectangle { lifeSpan: 10000 size: 24 sizeVariation: 8 - speed: AngleDirection{ angleVariation: 360; magnitude: 3 } + speed: AngleDirection { angleVariation: 360; magnitude: 3 } maximumEmitted: 10 startTime: 5000 } diff --git a/examples/declarative/particles/imageparticle/sprites.qml b/examples/declarative/particles/imageparticle/sprites.qml index a5afc61830..ad18c48640 100644 --- a/examples/declarative/particles/imageparticle/sprites.qml +++ b/examples/declarative/particles/imageparticle/sprites.qml @@ -41,61 +41,62 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { color: "goldenrod" width: 800 height: 800 id: root - SpriteImage{ - sprites: [Sprite{ + + SpriteImage { + sprites: [Sprite { name: "happy" source: "../images/squarefacesprite2.png" frames: 6 duration: 120 to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0} - }, Sprite{ + }, Sprite { name: "silly" source: "../images/squarefacesprite.png" frames: 6 duration: 120 to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "sad" source: "../images/squarefacesprite3.png" frames: 6 duration: 120 to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "cyclops" source: "../images/squarefacesprite4.png" frames: 6 duration: 120 to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0} - }, Sprite{ + }, Sprite { name: "evil" source: "../images/squarefacesprite5.png" frames: 6 duration: 120 to: {"happy": 1.0} - }, Sprite{ + }, Sprite { name: "love" source: "../images/squarefacesprite6.png" frames: 6 duration: 120 to: {"sad": 0.6, "evil":0.4, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "boggled" source: "../images/squarefacesprite7.png" frames: 6 duration: 120 to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2} - }, Sprite{ + }, Sprite { name: "dying" source: "../images/squarefacespriteX.png" frames: 4 duration: 120 to: {"dead":1.0} - }, Sprite{ + }, Sprite { name: "dead" source: "../images/squarefacespriteXX.png" frames: 1 @@ -108,78 +109,82 @@ Rectangle{ y: 20 z:4 } - ParticleSystem{ id: sys } - ImageParticle{ + + ParticleSystem { id: sys } + + ImageParticle { anchors.fill: parent id: particles system: sys - sprites: [Sprite{ + sprites: [Sprite { name: "happy" source: "../images/squarefacesprite2.png" frames: 6 duration: 120 to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0} - }, Sprite{ + }, Sprite { name: "silly" source: "../images/squarefacesprite.png" frames: 6 duration: 120 to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "sad" source: "../images/squarefacesprite3.png" frames: 6 duration: 120 to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "cyclops" source: "../images/squarefacesprite4.png" frames: 6 duration: 120 to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0} - }, Sprite{ + }, Sprite { name: "evil" source: "../images/squarefacesprite5.png" frames: 6 duration: 120 to: {"happy": 1.0} - }, Sprite{ + }, Sprite { name: "love" source: "../images/squarefacesprite6.png" frames: 6 duration: 120 to: {"sad": 0.6, "evil":0.4, "boggled":0.2} - }, Sprite{ + }, Sprite { name: "boggled" source: "../images/squarefacesprite7.png" frames: 6 duration: 120 to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2} - }, Sprite{ + }, Sprite { name: "dying" source: "../images/squarefacespriteX.png" frames: 4 duration: 120 to: {"dead":1.0} - }, Sprite{ + }, Sprite { name: "dead" source: "../images/squarefacespriteXX.png" frames: 1 duration: 10000 }] } - Emitter{ + + Emitter { system: sys emitRate: 16 lifeSpan: 10000 - speed: AngleDirection{angle: 90; magnitude: 60; angleVariation: 5} - acceleration: PointDirection{ y: 10 } + speed: AngleDirection {angle: 90; magnitude: 60; angleVariation: 5} + acceleration: PointDirection { y: 10 } size: 30 sizeVariation: 10 width: parent.width height: 100 } - SpriteGoal{ + + SpriteGoal { system: sys width: root.width; height: root.height/2; diff --git a/examples/declarative/particles/itemparticle/content/Delegate2.qml b/examples/declarative/particles/itemparticle/content/Delegate2.qml index a05fa348b9..7364ab61b9 100644 --- a/examples/declarative/particles/itemparticle/content/Delegate2.qml +++ b/examples/declarative/particles/itemparticle/content/Delegate2.qml @@ -50,16 +50,16 @@ Package { width: w; height: h; color: col rotation: Math.random()*360 - Behavior on rotation{RotationAnimation{}} + Behavior on rotation {RotationAnimation {}} - states: State{ + states: State { name: "gridded" when: root.inGrid - PropertyChanges{ + PropertyChanges { target: wrapper rotation: 0 } - ParentChange{ + ParentChange { target: wrapper parent: gridDelegate x:0 diff --git a/examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml b/examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml index e6fcb6dcf7..b01ae8b623 100644 --- a/examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml +++ b/examples/declarative/particles/itemparticle/content/ExpandingDelegate.qml @@ -69,7 +69,7 @@ import "../../../modelviews/listview/content" border.color: "orange" radius: 5 } - Image{ + Image { anchors.fill:parent anchors.margins: -32 source: "bubble.png" @@ -187,7 +187,7 @@ import "../../../modelviews/listview/content" //The only strictly necessary particle specific lines to: "Details" reversible: true - ScriptAction{script:{ + ScriptAction {script: { if(state == "Details") mp.freeze(index); else diff --git a/examples/declarative/particles/itemparticle/delegates.qml b/examples/declarative/particles/itemparticle/delegates.qml index 960a398fcb..371d0b8185 100644 --- a/examples/declarative/particles/itemparticle/delegates.qml +++ b/examples/declarative/particles/itemparticle/delegates.qml @@ -41,12 +41,14 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root; width: 360 height: 600 - function newPithySaying(){ - switch (Math.floor(Math.random()*16)){ + color: "black" + + function newPithySaying() { + switch (Math.floor(Math.random()*16)) { case 0: return "Hello World"; case 1: return "G'day Mate"; case 2: return "Code Less"; @@ -66,19 +68,19 @@ Rectangle{ default: return "OMGWTFBBQ"; } } - color: "black" - ParticleSystem{ + + ParticleSystem { anchors.fill: parent id: syssy - Emitter{ + Emitter { anchors.centerIn: parent emitRate: 1 lifeSpan: 4800 lifeSpanVariation: 1600 - speed: AngleDirection{angleVariation: 360; magnitude: 40; magnitudeVariation: 20} + speed: AngleDirection {angleVariation: 360; magnitude: 40; magnitudeVariation: 20} } - ItemParticle{ - delegate: Text{ + ItemParticle { + delegate: Text { text: root.newPithySaying(); color: "white" font.pixelSize: 18 diff --git a/examples/declarative/particles/itemparticle/particleview.qml b/examples/declarative/particles/itemparticle/particleview.qml index fb529c5294..5d393e6a06 100644 --- a/examples/declarative/particles/itemparticle/particleview.qml +++ b/examples/declarative/particles/itemparticle/particleview.qml @@ -43,47 +43,47 @@ import QtQuick.Particles 2.0 import "content/script.js" as Script import "content" -Item{ +Item { id: root width: 640 height: 480 - Rectangle{ + Rectangle { anchors.fill: parent color: "black" z: -1 } - Item{ + Item { id: loading - Behavior on opacity{NumberAnimation{}} + Behavior on opacity {NumberAnimation {}} anchors.fill: parent - Text{ + Text { anchors.centerIn: parent text: "Loading" color: "white" } } - ParticleSystem{ + ParticleSystem { id: sys; running: true } - Emitter{ + Emitter { id: emitter system: sys height: parent.height - 132/2 x: -132/2 y: 132/2 - speed: PointDirection{ x: 32; xVariation: 8 } + speed: PointDirection { x: 32; xVariation: 8 } emitRate: 0.5 lifeSpan: Emitter.InfiniteLife group: "photos" } - Age{ + Age { system: sys x: parent.width + 132/2 height: parent.height width: 1000 } - ImageParticle{ + ImageParticle { system: sys groups: ["fireworks"] source: "../trails/../images/star.png" @@ -92,29 +92,29 @@ Item{ colorVariation: 0 z: 1000 } - ItemParticle{ + ItemParticle { id: mp z: 0 system: sys fade: false groups: ["photos"] } - Component{ + Component { id: alertDelegate - Rectangle{ + Rectangle { width: 132 height: 132 - NumberAnimation on scale{ + NumberAnimation on scale { running: true loops: 1 from: 0.2 to: 1 } - Image{ + Image { source: "../asteroid/../images/rocket.png" anchors.centerIn: parent } - Text{ + Text { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter text: "A new ship has arrived!" @@ -122,7 +122,7 @@ Item{ } } property Item alertItem; - function alert(){ + function alert() { //resetter.active = false force.active = true; alertItem = alertDelegate.createObject(root); @@ -133,7 +133,7 @@ Item{ } focus: true Keys.onSpacePressed: alert(); - Timer{ + Timer { id: stopAlert running: false repeat: false @@ -145,7 +145,7 @@ Item{ centerEmitter.burst(1); } } - Attractor{ + Attractor { id: force system: sys pointX: root.width/2 @@ -158,9 +158,9 @@ Item{ groups:["photos"] affectedParameter: Attractor.Position } - Emitter{ + Emitter { id: centerEmitter - speed: PointDirection{ x: 32; xVariation: 8;} + speed: PointDirection { x: 32; xVariation: 8;} emitRate: 0.5 lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first) maximumEmitted: 20 @@ -171,7 +171,7 @@ Item{ //TODO: Zoom in effect } - Emitter{ + Emitter { id: spawnFireworks group: "fireworks" system: sys @@ -185,16 +185,16 @@ Item{ enabled: false size: 32 endSize: 8 - speed: AngleDirection{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 } - acceleration: PointDirection{ y: 160 } + speed: AngleDirection { 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 + 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"} + RssModel {id: theModel; tags:"particle,particles"} Component { id: theDelegate Rectangle { @@ -210,27 +210,27 @@ Item{ ItemParticle.onDetached: mp.take(container);//respawns function manage() { - if(state == "selected"){ + if (state == "selected") { console.log("Taking " + index); mp.freeze(container); - }else{ + } else { console.log("Returning " +index); mp.unfreeze(container); } } - Image{ + 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){ + onStatusChanged: if (img.status == Image.Ready) { container.opacity = 0; loading.opacity = 0; mp.take(container); } } - Text{ + Text { anchors.bottom: parent.bottom width: parent.width horizontalAlignment: Text.AlignHCenter @@ -238,19 +238,19 @@ Item{ text: title color: "black" } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: container.state == "selected" ? container.state = "" : container.state = "selected" } - states: State{ + states: State { name: "selected" - ParentChange{ + ParentChange { target: container parent: root x: 0 y: 0 } - PropertyChanges{ + PropertyChanges { target: container width: root.width height: root.height @@ -259,14 +259,14 @@ Item{ rotation: 0 } } - transitions: Transition{ + 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" } + 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/plasmapatrol/content/BlasterHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml index 3e751f4e15..4d34c6c37f 100644 --- a/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml +++ b/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml @@ -53,14 +53,14 @@ Item { width: 24 height: 24 - Emitter{ + Emitter { id: visualization group: "blaster" system: container.system enabled: show anchors.fill: parent - shape: EllipseShape{} - speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} + shape: EllipseShape {} + speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} lifeSpan: 1000 emitRate: 64 @@ -70,7 +70,7 @@ Item { } property int blastsLeft: 0 - function fireAt(targetArg, container){ + function fireAt(targetArg, container) { target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); targetObj = targetArg; hardpoint = container; @@ -78,22 +78,22 @@ Item { rofTimer.repeat = true; rofTimer.start(); } - Timer{ + Timer { id: rofTimer interval: 30;//Has to be greater than 1 frame or they stack up running: false repeat: false - onTriggered:{ - if(targetObj.hp <= 0) + onTriggered: { + if (targetObj.hp <= 0) return; //TODO: calculate hit and damage at target, which must be a Ship var hit; - if(blastsLeft >= bonusBlasts) + if (blastsLeft >= bonusBlasts) hit = Math.random() > targetObj.dodge; else hit = false; //purely aesthetic shots, because the damage isn't that fine grained - if(hit == true){ - switch(targetObj.shipType){ + if (hit == true) { + switch (targetObj.shipType) { case 1: hardpoint.damageDealt += 4; break; case 2: hardpoint.damageDealt += 5; break; case 3: hardpoint.damageDealt += 1; break; @@ -102,17 +102,17 @@ Item { } blastVector.targetX = target.x; blastVector.targetY = target.y; - if(!hit){//TODO: Actual targetVariation + if (!hit) {//TODO: Actual targetVariation blastVector.targetX += (128 * Math.random() - 64); blastVector.targetY += (128 * Math.random() - 64); } emitter.burst(1); blastsLeft--; - if(!blastsLeft) + if (!blastsLeft) rofTimer.repeat = false; } } - Emitter{ + Emitter { id: emitter group: "blaster" enabled: false @@ -125,7 +125,7 @@ Item { size: 24 endSize:16 sizeVariation: 8 - speed: TargetDirection{ + speed: TargetDirection { id: blastVector targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true } diff --git a/examples/declarative/particles/plasmapatrol/content/Button.qml b/examples/declarative/particles/plasmapatrol/content/Button.qml index 9ca7912037..4ec29c8a06 100644 --- a/examples/declarative/particles/plasmapatrol/content/Button.qml +++ b/examples/declarative/particles/plasmapatrol/content/Button.qml @@ -41,25 +41,25 @@ import QtQuick 2.0 //TODO: Add particles to this component too -Rectangle{ +Rectangle { id: container property alias text: txt.text signal clicked //color: "lightsteelblue" - gradient: Gradient{ - GradientStop{ position: 0.0; color: "lightsteelblue" } - GradientStop{ position: 1.0; color: "steelblue" } + gradient: Gradient { + GradientStop { position: 0.0; color: "lightsteelblue" } + GradientStop { position: 1.0; color: "steelblue" } } height: 64 radius: 16 width: 128 - Text{ + Text { id: txt anchors.centerIn: parent font.pixelSize: 24 color: "white" } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: container.clicked() } diff --git a/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml index dc15f0cae1..48f7dd045b 100644 --- a/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml +++ b/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml @@ -49,7 +49,7 @@ Item { width: 24 height: 24 - Emitter{ + Emitter { id: visualization group: "cannon" enabled: container.show @@ -62,14 +62,14 @@ Item { endSize: 0 } - function fireAt(targetArg, hardpoint){ + function fireAt(targetArg, hardpoint) { target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); - if(container.hp <= 0 || targetArg.hp <= 0) + if (container.hp <= 0 || targetArg.hp <= 0) return; //TODO: calculate hit and damage at target, which must be a Ship var hit = Math.random() > targetArg.dodge - if(hit){ - switch(targetArg.shipType){ + if (hit) { + switch (targetArg.shipType) { case 1: hardpoint.damageDealt += 8; break; case 2: hardpoint.damageDealt += 10; break; case 3: hardpoint.damageDealt += 16; break; @@ -78,7 +78,7 @@ Item { } emitter.burst(1); } - Emitter{ + Emitter { id: emitter group: "cannon" enabled: false @@ -89,7 +89,7 @@ Item { emitRate: 1 size: 8 endSize: 4 - speed: TargetDirection{ + speed: TargetDirection { id: blastVector targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true } diff --git a/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml b/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml index 8a4363d663..6f02b789e8 100644 --- a/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml +++ b/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml @@ -41,27 +41,27 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Item{ +Item { id: container width: 360 height: 160 property ParticleSystem system - Ship{ + Ship { id: nully system: system } property Item target: nully /* - Component.onCompleted:{ + Component.onCompleted: { container.target.shipType = 1 container.target.gunType = 1 } */ - Row{ + Row { anchors.horizontalCenter: parent.horizontalCenter height: parent.height spacing: 8 - Button{ + Button { width: 80 height: 80 anchors.verticalCenter: parent.verticalCenter @@ -75,11 +75,11 @@ Item{ container.target.shipType = nextVal; } } - Item{ + Item { width: 128 height: 128 anchors.verticalCenter: parent.verticalCenter - Ship{ + Ship { hp: 20 anchors.centerIn: parent shipType: container.target.shipType @@ -87,7 +87,7 @@ Item{ system: container.system } } - Button{ + Button { width: 80 height: 80 anchors.verticalCenter: parent.verticalCenter diff --git a/examples/declarative/particles/plasmapatrol/content/Cruiser.qml b/examples/declarative/particles/plasmapatrol/content/Cruiser.qml index a4983fc2a0..8497f7abe1 100644 --- a/examples/declarative/particles/plasmapatrol/content/Cruiser.qml +++ b/examples/declarative/particles/plasmapatrol/content/Cruiser.qml @@ -54,7 +54,7 @@ Item { property int gunType: 0 width: 128 height: 128 - Emitter{ + Emitter { //TODO: Cooler would be an 'orbiting' affector //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles system: container.system @@ -62,7 +62,7 @@ Item { anchors.centerIn: parent width: 64 height: 64 - shape: EllipseShape{} + shape: EllipseShape {} emitRate: hp > 0 ? hp * 1 + 20 : 0 lifeSpan: 2400 @@ -72,13 +72,13 @@ Item { sizeVariation: 16 endSize: 16 - speed: AngleDirection{angleVariation:360; magnitudeVariation: 32} + speed: AngleDirection {angleVariation:360; magnitudeVariation: 32} } - Emitter{ + Emitter { system: container.system group: "cruiserArmor" anchors.fill: parent - shape: EllipseShape{ fill: false } + shape: EllipseShape { fill: false } enabled: hp>0 emitRate: 16 @@ -87,7 +87,7 @@ Item { size: 48 sizeVariation: 24 - SpriteGoal{ + SpriteGoal { id: destructor system: container.system enabled: container.hp <=0 @@ -99,27 +99,27 @@ Item { } } - Timer{ + Timer { id: fireControl property int next: Math.floor(Math.random() * 3) + 1 interval: 800 running: root.readySetGo repeat: true - onTriggered:{ - if(next == 1){ + onTriggered: { + if (next == 1) { gun1.fireAt(container.target); next = Math.floor(Math.random() * 3) + 1; - }else if(next == 2){ + } else if (next == 2) { gun2.fireAt(container.target); next = Math.floor(Math.random() * 3) + 1; - }else if(next == 3){ + } else if (next == 3) { gun3.fireAt(container.target); next = Math.floor(Math.random() * 3) + 1; } } } - Hardpoint{//TODO: Hardpoint abstraction + Hardpoint {//TODO: Hardpoint abstraction x: 112 - 12 - 8*2 y: 128 - 12 - 12*2 id: gun1 @@ -127,7 +127,7 @@ Item { show: hp > 0 hardpointType: gunType } - Hardpoint{ + Hardpoint { x: 64 - 12 y: 0 - 12 + 12*2 id: gun2 @@ -135,7 +135,7 @@ Item { show: hp > 0 hardpointType: gunType } - Hardpoint{ + Hardpoint { x: 16 - 12 + 8*2 y: 128 - 12 - 12*2 id: gun3 diff --git a/examples/declarative/particles/plasmapatrol/content/Frigate.qml b/examples/declarative/particles/plasmapatrol/content/Frigate.qml index f26e7e881c..c7088cf1a5 100644 --- a/examples/declarative/particles/plasmapatrol/content/Frigate.qml +++ b/examples/declarative/particles/plasmapatrol/content/Frigate.qml @@ -54,7 +54,7 @@ Item { property int gunType: 0 width: 128 height: 128 - Emitter{ + Emitter { system: container.system group: "frigateShield" anchors.centerIn: parent @@ -63,13 +63,13 @@ Item { lifeSpan: 4800 enabled: hp > 0 } - Emitter{ + Emitter { system: container.system group: container.shipParticle anchors.centerIn: parent width: 64 height: 16 - shape: EllipseShape{} + shape: EllipseShape {} size: 16 sizeVariation: 8 @@ -78,24 +78,24 @@ Item { lifeSpan: 1200 maximumEmitted: (maxHP * 1 + 20)*2 } - Timer{ + Timer { id: fireControl property int next: Math.floor(Math.random() * 2) + 1 interval: 800 running: root.readySetGo repeat: true - onTriggered:{ - if(next == 1){ + onTriggered: { + if (next == 1) { gun1.fireAt(container.target); next = Math.floor(Math.random() * 2) + 1; - }else if(next == 2){ + } else if (next == 2) { gun2.fireAt(container.target); next = Math.floor(Math.random() * 2) + 1; } } } - Hardpoint{ + Hardpoint { x: 128 - 32 - 12 y: 64 - 12 id: gun1 @@ -103,7 +103,7 @@ Item { show: hp > 0 hardpointType: gunType } - Hardpoint{ + Hardpoint { x: 0 + 32 - 12 y: 64 - 12 id: gun2 diff --git a/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml b/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml index c6af805856..62a6ceb2c5 100644 --- a/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml +++ b/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml @@ -53,7 +53,7 @@ Item { property Item targetObj: null property int damageDealt: 0 onDamageDealtChanged: dealDamageTimer.start(); - Timer{ + Timer { id: dealDamageTimer interval: 16 running: false @@ -62,49 +62,51 @@ Item { } width: 24 height: 24 - function fireAt(targetArg){//Each implement own - if(targetArg != null){ + function fireAt(targetArg) {//Each implement own + if (targetArg != null) { hardpointLoader.item.fireAt(targetArg, container); targetObj = targetArg; } } - Loader{ + Loader { id: hardpointLoader - sourceComponent: {switch(hardpointType){ - case 1: laserComponent; break; - case 2: blasterComponent; break; - case 3: cannonComponent; break; - default: emptyComponent; - }} + sourceComponent: { + switch (hardpointType) { + case 1: laserComponent; break; + case 2: blasterComponent; break; + case 3: cannonComponent; break; + default: emptyComponent; + } + } } - Component{ + Component { id: laserComponent - LaserHardpoint{ + LaserHardpoint { target: container.target system: container.system show: container.show } } - Component{ + Component { id: blasterComponent - BlasterHardpoint{ + BlasterHardpoint { target: container.target system: container.system show: container.show } } - Component{ + Component { id: cannonComponent - CannonHardpoint{ + CannonHardpoint { target: container.target system: container.system show: container.show } } - Component{ + Component { id: emptyComponent Item { - function fireAt(obj){ + function fireAt(obj) { console.log("Firing null weapon. It hurts."); } } diff --git a/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml b/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml index c5ae949edd..91bbee5d50 100644 --- a/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml +++ b/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml @@ -45,25 +45,25 @@ SequentialLoader { id: hLdr signal exitDesired Component.onCompleted: advance(); - ParticleSystem{ id: helpSystem } - PlasmaPatrolParticles{ sys: helpSystem } + ParticleSystem { id: helpSystem } + PlasmaPatrolParticles { sys: helpSystem } pages: [ - Component{Item{ + Component {Item { id: story - Text{ + Text { color: "white" text: "Story" font.pixelSize: 48 } /* - Flickable{ + Flickable { y: 60 width: 360 height: 500 contentHeight: txt1.height contentWidth: 360//TODO: Less magic numbers? */ - Text{ + Text { id: txt1 color: "white" y: 60 @@ -77,7 +77,7 @@ You must select one such patrol unit for the border, heading into an inevitable wrapMode: Text.WordWrap } // } - Button{ + Button { x: 20 y: 560 height: 40 @@ -85,7 +85,7 @@ You must select one such patrol unit for the border, heading into an inevitable text: "Next" onClicked: hLdr.advance(); } - Button{ + Button { x: 220 y: 560 height: 40 @@ -94,51 +94,51 @@ You must select one such patrol unit for the border, heading into an inevitable onClicked: hLdr.exitDesired(); } }}, - Component{Item{ + Component {Item { id: ships - Text{ + Text { color: "white" text: "Vessels" font.pixelSize: 48 } - Column{ + Column { spacing: 16 y: 60 - Row{ + Row { height: 128 - Sloop{ + Sloop { system: helpSystem } - Text{ + Text { text: "The nimble sloop" color: "white" font.pixelSize: 18 } } - Row{ + Row { height: 128 - Frigate{ + Frigate { system: helpSystem } - Text{ + Text { text: "The versitile shield frigate" color: "white" font.pixelSize: 18 } } - Row{ + Row { height: 128 - Cruiser{ + Cruiser { system: helpSystem } - Text{ + Text { text: "The armored cruiser" color: "white" font.pixelSize: 18 } } } - Button{ + Button { x: 20 y: 560 height: 40 @@ -146,7 +146,7 @@ You must select one such patrol unit for the border, heading into an inevitable text: "Next" onClicked: hLdr.advance(); } - Button{ + Button { x: 220 y: 560 height: 40 @@ -155,22 +155,22 @@ You must select one such patrol unit for the border, heading into an inevitable onClicked: hLdr.exitDesired(); } }}, - Component{Item{ + Component {Item { id: guns - Text{ + Text { color: "white" text: "Hardpoints" font.pixelSize: 48 } - Column{ + Column { spacing: 16 y: 60 - Row{ + Row { height: 128 - LaserHardpoint{ + LaserHardpoint { system: helpSystem } - Text{ + Text { text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields" width: 332 wrapMode: Text.WordWrap @@ -178,12 +178,12 @@ You must select one such patrol unit for the border, heading into an inevitable font.pixelSize: 18 } } - Row{ + Row { height: 128 - BlasterHardpoint{ + BlasterHardpoint { system: helpSystem } - Text{ + Text { text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser" width: 332 wrapMode: Text.WordWrap @@ -191,12 +191,12 @@ You must select one such patrol unit for the border, heading into an inevitable font.pixelSize: 18 } } - Row{ + Row { height: 128 - CannonHardpoint{ + CannonHardpoint { system: helpSystem } - Text{ + Text { text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser" width: 332 wrapMode: Text.WordWrap @@ -205,7 +205,7 @@ You must select one such patrol unit for the border, heading into an inevitable } } } - Button{ + Button { x: 20 y: 560 height: 40 @@ -213,7 +213,7 @@ You must select one such patrol unit for the border, heading into an inevitable text: "Next" onClicked: hLdr.advance(); } - Button{ + Button { x: 220 y: 560 height: 40 @@ -222,20 +222,20 @@ You must select one such patrol unit for the border, heading into an inevitable onClicked: hLdr.exitDesired(); } }}, - Component{Item{ + Component {Item { id: strategy - Text{ + Text { color: "white" text: "Strategy" font.pixelSize: 48 } - Flickable{ + Flickable { y: 60 width: 360 height: 500 contentHeight: txt1.height contentWidth: 360//TODO: Less magic numbers? - Text{ + Text { id: txt1 color: "white" font.pixelSize: 18 @@ -247,7 +247,7 @@ More to come after thorough playtesting. wrapMode: Text.WordWrap } } - Button{ + Button { x: 20 y: 560 height: 40 @@ -255,7 +255,7 @@ More to come after thorough playtesting. text: "Story" onClicked: {hLdr.at=0; hLdr.advance();} } - Button{ + Button { x: 220 y: 560 height: 40 diff --git a/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml index 56fd91b5b3..007d533b56 100644 --- a/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml +++ b/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml @@ -49,14 +49,14 @@ Item { width: 24 height: 24 - Emitter{ + Emitter { id: visualization group: "laser" system: container.system anchors.fill: parent enabled: container.show - shape: EllipseShape{} - speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } + shape: EllipseShape {} + speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } lifeSpan: 1000 emitRate: 64 @@ -65,26 +65,26 @@ Item { endSize: 8 } - function fireAt(targetArg, hardpoint){ - if(targetArg.hp <= 0) + function fireAt(targetArg, hardpoint) { + if (targetArg.hp <= 0) return; //TODO: calculate hit and damage at target, which must be a Ship var offset = 0; - if(Math.random() < 0.99){ - switch(targetArg.shipType){ + if (Math.random() < 0.99) { + switch (targetArg.shipType) { case 1: hardpoint.damageDealt += 16; break; case 2: hardpoint.damageDealt += 4; break; case 3: hardpoint.damageDealt += 8; break; default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels } - }else{//Misses with Lasers are really rare + } else {//Misses with Lasers are really rare offset = Math.random() * 100; } target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2); emitter.pulse(0.10); // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y))); } - Emitter{ + Emitter { id: emitter group: "laser" enabled: false @@ -93,7 +93,7 @@ Item { width: Math.max(container.width/2, target.x) - x; y: Math.min(container.height/2, target.y); height: Math.max(container.height/2, target.y) - y; - shape: LineShape{ + shape: LineShape { mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR } @@ -103,6 +103,6 @@ Item { size: 16 endSize: 0 - speed: PointDirection{xVariation: 4; yVariation: 4} + speed: PointDirection {xVariation: 4; yVariation: 4} } } diff --git a/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml index 7a8c3e61b3..c68ba3b98e 100644 --- a/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml +++ b/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml @@ -41,9 +41,9 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Item{ +Item { property ParticleSystem sys - ImageParticle{ + ImageParticle { system: sys groups: ["default"] source: "pics/blur-circle3.png" @@ -51,7 +51,7 @@ Item{ colorVariation: 0.1 z: 0 } - ImageParticle{ + ImageParticle { system: sys groups: ["redTeam"] source: "pics/blur-circle3.png" @@ -59,7 +59,7 @@ Item{ colorVariation: 0.1 z: 0 } - ImageParticle{ + ImageParticle { system: sys groups: ["greenTeam"] source: "pics/blur-circle3.png" @@ -67,7 +67,7 @@ Item{ colorVariation: 0.1 z: 0 } - ImageParticle{ + ImageParticle { system: sys groups: ["blaster"] source: "pics/star2.png" @@ -76,7 +76,7 @@ Item{ colorVariation: 0.2 z: 2 } - ImageParticle{ + ImageParticle { system: sys groups: ["laser"] source: "pics/star3.png" @@ -85,7 +85,7 @@ Item{ colorVariation: 0.2 z: 2 } - ImageParticle{ + ImageParticle { system: sys groups: ["cannon"] source: "pics/particle.png" @@ -93,7 +93,7 @@ Item{ colorVariation: 0.1 z: 2 } - ImageParticle{ + ImageParticle { system: sys groups: ["cannonCore"] source: "pics/particle.png" @@ -101,7 +101,7 @@ Item{ colorVariation: 0.8 z: 1 } - ImageParticle{ + ImageParticle { system: sys groups: ["cannonWake"] source: "pics/star.png" @@ -109,7 +109,7 @@ Item{ colorVariation: 0.2 z: 1 } - ImageParticle{ + ImageParticle { system: sys groups: ["frigateShield"] source: "pics/blur-circle2.png" @@ -119,24 +119,24 @@ Item{ greenVariation: 0.1 z: 3 } - ImageParticle{ + ImageParticle { system: sys groups: ["cruiserArmor"] z: 1 - sprites:[Sprite{ + sprites:[Sprite { id: spinState name: "spinning" source: "pics/meteor.png" frames: 35 duration: 40 to: {"death":0, "spinning":1} - },Sprite{ + },Sprite { name: "death" source: "pics/meteor_explo.png" frames: 22 duration: 40 to: {"null":1} - }, Sprite{ + }, Sprite { name: "null" source: "pics/nullRock.png" frames: 1 @@ -144,13 +144,13 @@ Item{ } ] } - TrailEmitter{ + TrailEmitter { system: sys group: "cannonWake" follow: "cannon" emitRatePerParticle: 64 lifeSpan: 600 - speed: AngleDirection{ angleVariation: 360; magnitude: 48} + speed: AngleDirection { angleVariation: 360; magnitude: 48} size: 16 endSize: 8 sizeVariation: 2 @@ -158,7 +158,7 @@ Item{ width: 1000//XXX: Terrible hack height: 1000 } - TrailEmitter{ + TrailEmitter { system: sys group: "cannonCore" follow: "cannon" diff --git a/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml b/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml index 49c30cac4d..8167b75042 100644 --- a/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml +++ b/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml @@ -40,13 +40,13 @@ ****************************************************************************/ import QtQuick 2.0 -Item{ +Item { id: container //TODO: Somehow get particles into this? property list<Component> pages property Item cur: null property int at: 0 - function advance(){ + function advance() { if(cur != null) cur.destroy(); cur = pages[at++].createObject(container); diff --git a/examples/declarative/particles/plasmapatrol/content/Ship.qml b/examples/declarative/particles/plasmapatrol/content/Ship.qml index 60fc311d47..dd2366fe9a 100644 --- a/examples/declarative/particles/plasmapatrol/content/Ship.qml +++ b/examples/declarative/particles/plasmapatrol/content/Ship.qml @@ -52,17 +52,17 @@ Item { property ParticleSystem system property int targetIdx: 0 property Item target: targets[targetIdx] == undefined?null:targets[targetIdx] - Connections{ + Connections { target: me.target - onHpChanged: if(me.target.hp<=0) me.targetIdx++; + onHpChanged: if (me.target.hp<=0) me.targetIdx++; } property list<Item> targets property string shipParticle: "default"//Per team colors? property int gunType: 0 property int shipType: 0 - Component{ + Component { id: sloopComp - Sloop{ + Sloop { system: me.system target: me.target shipParticle: me.shipParticle @@ -71,9 +71,9 @@ Item { dodge: me.dodge } } - Component{ + Component { id: frigateComp - Frigate{ + Frigate { system: me.system target: me.target shipParticle: me.shipParticle @@ -82,9 +82,9 @@ Item { dodge: me.dodge } } - Component{ + Component { id: cruiserComp - Cruiser{ + Cruiser { system: me.system target: me.target shipParticle: me.shipParticle @@ -93,21 +93,22 @@ Item { dodge: me.dodge } } - Component{ + Component { id: dumbComp - Item{ + Item { property int maxHP: 0 property int initialDodge: 0 } } - Loader{ + Loader { id: shipLoader - sourceComponent:{ switch(shipType){ + sourceComponent: { + switch (shipType) { case 1: sloopComp; break; case 2: frigateComp; break; case 3: cruiserComp; break; default: dumbComp; - } + } } } } diff --git a/examples/declarative/particles/plasmapatrol/content/Sloop.qml b/examples/declarative/particles/plasmapatrol/content/Sloop.qml index 59678a75ea..c94fecef34 100644 --- a/examples/declarative/particles/plasmapatrol/content/Sloop.qml +++ b/examples/declarative/particles/plasmapatrol/content/Sloop.qml @@ -55,19 +55,19 @@ Item { property int gunType: 0 width: 128 height: 128 - Emitter{ + Emitter { id: emitter //TODO: Cooler would be an 'orbiting' affector //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles system: container.system group: container.shipParticle - shape: EllipseShape{} + shape: EllipseShape {} emitRate: hp > 0 ? hp + 20 : 0 lifeSpan: blinkInterval maximumEmitted: (maxHP + 20) - acceleration: AngleDirection{angleVariation: 360; magnitude: 8} + acceleration: AngleDirection {angleVariation: 360; magnitude: 8} size: 24 endSize: 4 @@ -76,9 +76,9 @@ Item { height: 16 x: 64 y: 64 - Behavior on x{NumberAnimation{duration:blinkInterval}} - Behavior on y{NumberAnimation{duration:blinkInterval}} - Timer{ + Behavior on x {NumberAnimation {duration:blinkInterval}} + Behavior on y {NumberAnimation {duration:blinkInterval}} + Timer { interval: blinkInterval running: true repeat: true @@ -88,19 +88,19 @@ Item { } } } - Hardpoint{ + Hardpoint { anchors.centerIn: parent id: gun2 system: container.system show: container.hp > 0 hardpointType: gunType } - Timer{ + Timer { id: fireControl interval: 800 running: root.readySetGo repeat: true - onTriggered:{ + onTriggered: { gun2.fireAt(container.target); } } diff --git a/examples/declarative/particles/plasmapatrol/plasmapatrol.qml b/examples/declarative/particles/plasmapatrol/plasmapatrol.qml index bc5f49678c..c08253755a 100644 --- a/examples/declarative/particles/plasmapatrol/plasmapatrol.qml +++ b/examples/declarative/particles/plasmapatrol/plasmapatrol.qml @@ -50,15 +50,15 @@ Rectangle { property int misses: 0 property real ratio: hits/(misses?misses:1) //Move to JS file? - property Ship redVar1: Ship{shipType: 1; gunType: 1} - property Ship redVar2: Ship{shipType: 1; gunType: 2} - property Ship redVar3: Ship{shipType: 1; gunType: 3} - property Ship greenVar1: Ship{shipType: 3; gunType: 1} - property Ship greenVar2: Ship{shipType: 2; gunType: 2} - property Ship greenVar3: Ship{shipType: 1; gunType: 3} + property Ship redVar1: Ship {shipType: 1; gunType: 1} + property Ship redVar2: Ship {shipType: 1; gunType: 2} + property Ship redVar3: Ship {shipType: 1; gunType: 3} + property Ship greenVar1: Ship {shipType: 3; gunType: 1} + property Ship greenVar2: Ship {shipType: 2; gunType: 2} + property Ship greenVar3: Ship {shipType: 1; gunType: 3} property string winner: "0" property int players: 0 - function aiSet(ship){ + function aiSet(ship) { ship.gunType = Math.floor(Math.random() * 3) + 1 ship.shipType = Math.floor(Math.random() * 3) + 1 } @@ -66,58 +66,58 @@ Rectangle { width: 360 height: 600 color: "black" - SequentialLoader{ + SequentialLoader { anchors.fill: parent //General Children - Image{ + Image { anchors.centerIn: parent source: "../images/pics/finalfrontier.png" } - ParticleSystem{ + ParticleSystem { id: particles } - PlasmaPatrolParticles{ sys: particles; z: 100 }//Renders all particles on the one plane + PlasmaPatrolParticles { sys: particles; z: 100 }//Renders all particles on the one plane //Component parts id: pageControl Component.onCompleted: advance(); pages:[ - Component{Item{ + Component {Item { id: menu width: root.width height: root.height - Column{ + Column { anchors.verticalCenter: parent.verticalCenter width: parent.width spacing: 8 - Item{ + Item { id: title width: root.width height: 240 - Emitter{ + Emitter { anchors.fill: parent system: particles enabled: true group: "default" emitRate: 1200 lifeSpan: 1200 - shape: MaskShape{source:"../images/pics/TitleText.png"} + shape: MaskShape {source:"../images/pics/TitleText.png"} size: 16 endSize: 0 sizeVariation: 8 - speed: AngleDirection{angleVariation:360; magnitudeVariation: 6} + speed: AngleDirection {angleVariation:360; magnitudeVariation: 6} } } - Button{ + Button { text: "1P" onClicked: {root.players = 1; pageControl.advance();} anchors.horizontalCenter: parent.horizontalCenter } - Button{ + Button { text: "2P" onClicked: {root.players = 2; pageControl.advance();} anchors.horizontalCenter: parent.horizontalCenter } - Button{ + Button { text: "Demo" anchors.horizontalCenter: parent.horizontalCenter onClicked: {root.players = 0; @@ -130,7 +130,7 @@ Rectangle { pageControl.at = 5;//TODO: Not a magic number pageControl.advance();} } - Button{ + Button { text: "Help" anchors.horizontalCenter: parent.horizontalCenter onClicked: { @@ -138,23 +138,23 @@ Rectangle { pageControl.advance(); } } - Button{ + Button { text: "Quit" anchors.horizontalCenter: parent.horizontalCenter onClicked: Qt.quit(); } } }}, - Component{Item{ + Component {Item { id: p1Screen z: 101 width: root.width height: root.height - Rectangle{ + Rectangle { anchors.fill: parent color: "red" } - Text{ + Text { anchors.centerIn: parent color: "white" font.pixelSize: 64 @@ -162,41 +162,41 @@ Rectangle { text: "Player\n 1" horizontalAlignment: Text.AlignHCenter } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: pageControl.advance() } }}, - Component{Item{ + Component {Item { id: p1Choices z: 3 width: root.width height: root.height - Rectangle{ + Rectangle { color: "black" anchors.fill: parent } - Column{ + Column { spacing: 16 width: root.width anchors.horizontalCenter: parent.horizontalCenter - ChoiceBox{ + ChoiceBox { target: redVar1 system: particles } - ChoiceBox{ + ChoiceBox { target: redVar2 system: particles } - ChoiceBox{ + ChoiceBox { target: redVar3 system: particles } - Button{ + Button { anchors.horizontalCenter: parent.horizontalCenter text: "Next" onClicked: { - if(root.players < 2){ + if (root.players < 2) { aiSet(greenVar1); aiSet(greenVar2); aiSet(greenVar3); @@ -207,16 +207,16 @@ Rectangle { } } }}, - Component{Item{ + Component {Item { id: p2Screen z: 101 width: root.width height: root.height - Rectangle{ + Rectangle { anchors.fill: parent color: "green" } - Text{ + Text { anchors.centerIn: parent color: "white" font.pixelSize: 64 @@ -224,44 +224,44 @@ Rectangle { text: "Player\n 2" horizontalAlignment: Text.AlignHCenter } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: pageControl.advance() } }}, - Component{Item{ + Component {Item { id: p2Choices z: 1 width: root.width height: root.height - Rectangle{ + Rectangle { color: "black" anchors.fill: parent } - Column{ + Column { spacing: 16 width: root.width anchors.horizontalCenter: parent.horizontalCenter - ChoiceBox{ + ChoiceBox { target: greenVar1 system: particles } - ChoiceBox{ + ChoiceBox { target: greenVar2 system: particles } - ChoiceBox{ + ChoiceBox { target: greenVar3 system: particles } - Button{ + Button { anchors.horizontalCenter: parent.horizontalCenter text: "Next" onClicked: pageControl.advance() } } }}, - Component{Item{ + Component {Item { id: arena width: root.width height: root.height @@ -270,25 +270,25 @@ Rectangle { Component.onDestruction: root.readySetGo = false property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0 onVictoryChanged: { - if(redShip3.hp <= 0){ - if(greenShip3.hp <= 0){ + if (redShip3.hp <= 0) { + if (greenShip3.hp <= 0) { root.winner = "1&2" - }else{ + }else { root.winner = "2" } - }else{ + } else { root.winner = "1" } winTimer.start() } - Timer{ + Timer { id: winTimer interval: 1200 repeat: false running: false onTriggered: pageControl.advance(); } - Ship{ + Ship { id: redShip1 shipParticle: "redTeam" system: particles @@ -298,7 +298,7 @@ Rectangle { gunType: redVar1.gunType targets: [greenShip1, greenShip2, greenShip3] } - Ship{ + Ship { id: redShip2 shipParticle: "redTeam" system: particles @@ -308,7 +308,7 @@ Rectangle { gunType: redVar2.gunType targets: [greenShip1, greenShip2, greenShip3] } - Ship{ + Ship { id: redShip3 shipParticle: "redTeam" system: particles @@ -319,7 +319,7 @@ Rectangle { targets: [greenShip1, greenShip2, greenShip3] } - Ship{ + Ship { id: greenShip1 shipParticle: "greenTeam" system: particles @@ -329,7 +329,7 @@ Rectangle { gunType: greenVar1.gunType targets: [redShip1, redShip2, redShip3] } - Ship{ + Ship { id: greenShip2 shipParticle: "greenTeam" system: particles @@ -339,7 +339,7 @@ Rectangle { gunType: greenVar2.gunType targets: [redShip1, redShip2, redShip3] } - Ship{ + Ship { id: greenShip3 shipParticle: "greenTeam" system: particles @@ -350,18 +350,18 @@ Rectangle { targets: [redShip1, redShip2, redShip3] } }}, - Component{Item{ + Component {Item { id: winScreen z: 101 width: root.width height: root.height /* - Rectangle{ + Rectangle { anchors.fill: parent color: "black" } */ - Text{//TODO: Particle Text? + Text {//TODO: Particle Text? anchors.fill: parent color: "white" font.pixelSize: 64 @@ -371,13 +371,13 @@ Rectangle { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - MouseArea{ + MouseArea { anchors.fill: parent onClicked: {pageControl.at = 0; pageControl.advance();} } }}, - Component{ - HelpScreens{ + Component { + HelpScreens { onExitDesired: {pageControl.at = 0; pageControl.advance();} } } diff --git a/examples/declarative/particles/simple/dynamiccomparison.qml b/examples/declarative/particles/simple/dynamiccomparison.qml index 5cfb3427e8..72172adc90 100644 --- a/examples/declarative/particles/simple/dynamiccomparison.qml +++ b/examples/declarative/particles/simple/dynamiccomparison.qml @@ -41,15 +41,16 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root color: "black" width: 640 height: 480 - ParticleSystem{ + ParticleSystem { id: sys } - ImageParticle{ + + ImageParticle { system: sys source: "../images/particle.png" color: "white" @@ -57,20 +58,22 @@ Rectangle{ alpha: 0.1 entryEffect: ImageParticle.None } - Emitter{ + + Emitter { id: emitter system: sys width: parent.width/2 - speed: PointDirection{y: 72; yVariation: 24} + speed: PointDirection {y: 72; yVariation: 24} lifeSpan: 10000 emitRate: 1000 enabled: false size: 32 } - Item{ + + Item { id: fakeEmitter - function burst(number){ - while(number > 0){ + function burst(number) { + while (number > 0) { var item = fakeParticle.createObject(root); item.lifeSpan = Math.random() * 5000 + 5000; item.x = Math.random() * 320 + 320; @@ -79,42 +82,43 @@ Rectangle{ } } - Component{ + Component { id: fakeParticle - Image{ + Image { id: container property int lifeSpan: 10000 width: 32 height: 32 source: "../images/particle.png" y: 0 - PropertyAnimation on y{from: -16; to: 480-16; duration: container.lifeSpan; running: true} - SequentialAnimation on opacity{ + PropertyAnimation on y {from: -16; to: 480-16; duration: container.lifeSpan; running: true} + SequentialAnimation on opacity { running: true - NumberAnimation{ from:0; to: 1; duration: 500} - PauseAnimation{ duration: container.lifeSpan - 1000} - NumberAnimation{ from:1; to: 0; duration: 500} - ScriptAction{ script: container.destroy(); } + NumberAnimation { from:0; to: 1; duration: 500} + PauseAnimation { duration: container.lifeSpan - 1000} + NumberAnimation { from:1; to: 0; duration: 500} + ScriptAction { script: container.destroy(); } } } } } - Text{ + + Text { anchors.left: parent.left anchors.bottom: parent.bottom text: "1000 particles" color: "white" - MouseArea{ + MouseArea { anchors.fill: parent onClicked: emitter.burst(1000); } } - Text{ + Text { anchors.right: parent.right anchors.bottom: parent.bottom text: "1000 items" color: "white" - MouseArea{ + MouseArea { anchors.fill: parent onClicked: fakeEmitter.burst(1000); } diff --git a/examples/declarative/particles/simple/dynamicemitters.qml b/examples/declarative/particles/simple/dynamicemitters.qml index 89e811e199..f64c1c0941 100644 --- a/examples/declarative/particles/simple/dynamicemitters.qml +++ b/examples/declarative/particles/simple/dynamicemitters.qml @@ -41,39 +41,40 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root color: "black" width: 640 height: 480 - ParticleSystem{ + ParticleSystem { id: sys } - ImageParticle{ + ImageParticle { system: sys source: "../images/particle.png" color: "white" colorVariation: 1.0 alpha: 0.1 } - Component{ + + Component { id: emitterComp - Emitter{ + Emitter { id: container - Emitter{ + Emitter { id: emitMore system: sys emitRate: 128 lifeSpan: 600 size: 16 endSize: 8 - speed: AngleDirection{angleVariation:360; magnitude: 60} + speed: AngleDirection {angleVariation:360; magnitude: 60} } property int life: 2600 property real targetX: 0 property real targetY: 0 - function go(){ + function go() { xAnim.start(); yAnim.start(); container.enabled = true @@ -83,29 +84,30 @@ Rectangle{ lifeSpan: 600 size: 24 endSize: 8 - NumberAnimation on x{ + NumberAnimation on x { id: xAnim; to: targetX duration: life running: false } - NumberAnimation on y{ + NumberAnimation on y { id: yAnim; to: targetY duration: life running: false } - Timer{ + Timer { interval: life running: true onTriggered: container.destroy(); } } } - MouseArea{ + + MouseArea { anchors.fill: parent - onClicked:{ - for(var i=0; i<8; i++){ + onClicked: { + for (var i=0; i<8; i++) { var obj = emitterComp.createObject(root); obj.x = mouse.x obj.y = mouse.y diff --git a/examples/declarative/particles/simple/multiplepainters.qml b/examples/declarative/particles/simple/multiplepainters.qml index a94efb749e..4017e3e04e 100644 --- a/examples/declarative/particles/simple/multiplepainters.qml +++ b/examples/declarative/particles/simple/multiplepainters.qml @@ -41,40 +41,43 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { id: root width: 360 height: 600 color: "darkblue" property bool cloneMode: false - MouseArea{ + ParticleSystem { + id: sys + } + MouseArea { anchors.fill: parent onClicked: cloneMode = !cloneMode; } - ParticleSystem{ - id: sys - } - Emitter{ + Emitter { system: sys y:root.height + 20 width: root.width emitRate: 200 lifeSpan: 4000 startTime: 4000 - speed: PointDirection{ y: -120; } + speed: PointDirection { y: -120; } } - ImageParticle{ + + ImageParticle { system: sys visible: !cloneMode source: "../images/particle2.png" } - ImageParticle{ + + ImageParticle { system: sys visible: cloneMode z: 0 source: "../images/particle3.png" } - ImageParticle{ + + ImageParticle { system: sys clip: true visible: cloneMode diff --git a/examples/declarative/particles/simple/startstop.qml b/examples/declarative/particles/simple/startstop.qml index bab3f5fdee..6519f50a57 100644 --- a/examples/declarative/particles/simple/startstop.qml +++ b/examples/declarative/particles/simple/startstop.qml @@ -41,11 +41,11 @@ import QtQuick 2.0 import QtQuick.Particles 2.0 -Rectangle{ +Rectangle { width: 360 height: 540 color: "black" - MouseArea{ + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { @@ -55,11 +55,13 @@ Rectangle{ particles.paused = !particles.paused; } } - ParticleSystem{ - id: particles + + ParticleSystem { + id: particles running: false } - ImageParticle{ + + ImageParticle { anchors.fill: parent system: particles source: "../images/star.png" @@ -67,7 +69,8 @@ Rectangle{ alpha: 0 colorVariation: 0.6 } - Emitter{ + + Emitter { anchors.fill: parent system: particles emitRate: 2000 |