From c07ea77a6201ef5595ff5714fba891be4408fa9a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 20 Sep 2011 17:16:36 +1000 Subject: Add whitespace Change-Id: Iad55228ffa86bbf63b12a33d0f00ce734807c071 Reviewed-on: http://codereview.qt-project.org/5199 Reviewed-by: Bea Lam --- examples/declarative/particles/affectors/age.qml | 19 ++-- .../declarative/particles/affectors/attractor.qml | 46 ++++---- .../particles/affectors/customaffector.qml | 38 ++++--- .../declarative/particles/affectors/friction.qml | 21 ++-- .../declarative/particles/affectors/gravity.qml | 7 +- .../declarative/particles/affectors/groupgoal.qml | 47 ++++---- .../declarative/particles/affectors/spritegoal.qml | 30 ++--- .../declarative/particles/affectors/turbulence.qml | 34 +++--- .../declarative/particles/affectors/wander.qml | 18 +-- .../particles/customparticle/blurparticles.qml | 14 +-- .../particles/customparticle/fragmentshader.qml | 18 +-- .../particles/customparticle/imagecolors.qml | 23 ++-- .../particles/emitters/customemitter.qml | 17 +-- .../declarative/particles/emitters/emitmask.qml | 13 ++- .../particles/emitters/maximumemitted.qml | 15 ++- .../particles/emitters/shapeanddirection.qml | 28 +++-- .../particles/emitters/timedgroupchanges.qml | 39 ++++--- .../particles/emitters/trailemitter.qml | 37 +++--- .../particles/emitters/velocityfrommotion.qml | 50 +++----- .../particles/exampleslauncher/content/Shell.qml | 16 +-- .../exampleslauncher/exampleslauncher.qml | 18 +-- .../particles/imageparticle/allatonce.qml | 26 +++-- .../particles/imageparticle/colored.qml | 19 ++-- .../particles/imageparticle/colortable.qml | 12 +- .../particles/imageparticle/deformation.qml | 31 ++--- .../particles/imageparticle/rotation.qml | 14 ++- .../particles/imageparticle/sharing.qml | 3 +- .../particles/imageparticle/sprites.qml | 57 +++++----- .../particles/itemparticle/content/Delegate2.qml | 8 +- .../itemparticle/content/ExpandingDelegate.qml | 4 +- .../particles/itemparticle/delegates.qml | 20 ++-- .../particles/itemparticle/particleview.qml | 84 +++++++------- .../plasmapatrol/content/BlasterHardpoint.qml | 28 ++--- .../particles/plasmapatrol/content/Button.qml | 12 +- .../plasmapatrol/content/CannonHardpoint.qml | 14 +-- .../particles/plasmapatrol/content/ChoiceBox.qml | 16 +-- .../particles/plasmapatrol/content/Cruiser.qml | 28 ++--- .../particles/plasmapatrol/content/Frigate.qml | 18 +-- .../particles/plasmapatrol/content/Hardpoint.qml | 38 ++++--- .../particles/plasmapatrol/content/HelpScreens.qml | 84 +++++++------- .../plasmapatrol/content/LaserHardpoint.qml | 22 ++-- .../plasmapatrol/content/PlasmaPatrolParticles.qml | 34 +++--- .../plasmapatrol/content/SequentialLoader.qml | 4 +- .../particles/plasmapatrol/content/Ship.qml | 27 ++--- .../particles/plasmapatrol/content/Sloop.qml | 18 +-- .../particles/plasmapatrol/plasmapatrol.qml | 126 ++++++++++----------- .../particles/simple/dynamiccomparison.qml | 44 +++---- .../particles/simple/dynamicemitters.qml | 30 ++--- .../particles/simple/multiplepainters.qml | 23 ++-- .../declarative/particles/simple/startstop.qml | 15 ++- 50 files changed, 738 insertions(+), 669 deletions(-) (limited to 'examples') 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= 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 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 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 -- cgit v1.2.3