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/declarative/particles/affectors | |
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/declarative/particles/affectors')
9 files changed, 141 insertions, 119 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; } |