diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-06-07 19:39:38 +1000 |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2011-06-07 19:43:41 +1000 |
commit | 984f21f18d1a3981e7363df467ff2e24e69aa847 (patch) | |
tree | db4665cbc1591a77f988b0b4f8925fe5636f5672 /examples | |
parent | 21d0c6ef9a7df3e5fa69ff344e9dee2d2159c43c (diff) |
Immense Particles Refactor Part B
Examples work again. Also augmented Wander and PointAttractor with
physics modes.
Diffstat (limited to 'examples')
31 files changed, 486 insertions, 416 deletions
diff --git a/examples/declarative/particles/allsmiles/plain.qml b/examples/declarative/particles/allsmiles/plain.qml new file mode 100644 index 0000000000..1b456b0c5b --- /dev/null +++ b/examples/declarative/particles/allsmiles/plain.qml @@ -0,0 +1,26 @@ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle{ + color: "goldenrod" + width: 2000 + height: 2000 + ParticleSystem{id: sys} + ImageParticle{ + id: up + system: sys + image: "content/singlesmile.png" + } + Emitter{ + anchors.centerIn: parent + system: sys + particlesPerSecond: 1000 + particleSize: 20 + particleDuration: 10000 + speed: AngledDirection{angleVariation: 360; magnitudeVariation: 100;} + } + MouseArea{ + anchors.fill: parent + onClicked: up.autoRotation = !up.autoRotation + } +} diff --git a/examples/declarative/particles/allsmiles/smile.qml b/examples/declarative/particles/allsmiles/smile.qml index e37e8fa98e..9ce0e3a5e6 100644 --- a/examples/declarative/particles/allsmiles/smile.qml +++ b/examples/declarative/particles/allsmiles/smile.qml @@ -39,27 +39,93 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ + id: root color: "white" width: 310 height: 300 ParticleSystem{ id: sys } - Picture{ + CustomParticle{ system: sys - anchors.fill: parent - image: "content/singlesmile.png" - onceOff: true - } - ColoredParticle{ - system: sys - image: "content/particle.png" - color: "black" - alpha: 0.4 - sizeTable: "content/sizeInOut.png" + property real maxWidth: root.width + property real maxHeight: root.height + ShaderEffectSource{ + id: pictureSource + sourceItem: picture + hideSource: true + } + Image{ + id: picture + source: "content/singlesmile.png" + } + ShaderEffectSource{ + id: particleSource + sourceItem: particle + hideSource: true + } + Image{ + id: particle + source: "content/particle.png" + } + vertexShader:" + attribute highp vec2 vPos; + attribute highp vec2 vTex; + attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize + attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration + attribute highp float r; + + uniform highp float maxWidth; + uniform highp float maxHeight; + + uniform highp mat4 qt_ModelViewProjectionMatrix; + uniform highp float timestamp; + uniform lowp float qt_Opacity; + + varying highp vec2 fTex; + varying highp vec2 fTex2; + varying lowp float fFade; + + void main() { + fTex = vTex; + fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight); + highp float size = vData.z; + highp float endSize = vData.w; + + highp float t = (timestamp - vData.x) / vData.y; + + highp float currentSize = mix(size, endSize, t * t); + + if (t < 0. || t > 1.) + currentSize = 0.; + + highp vec2 pos = vPos + - currentSize / 2. + currentSize * vTex // adjust size + + vVec.xy * t * vData.y // apply speed vector.. + + 0.5 * vVec.zw * pow(t * vData.y, 2.); + + gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1); + + highp float fadeIn = min(t * 10., 1.); + highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + + fFade = fadeIn * fadeOut * qt_Opacity; + } + " + property variant particleTexture: particleSource + property variant pictureTexture: pictureSource + fragmentShader: " + uniform sampler2D particleTexture; + uniform sampler2D pictureTexture; + varying highp vec2 fTex; + varying highp vec2 fTex2; + varying highp float fFade; + void main() { + gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, fTex).w * fFade; + }" } - TrailEmitter{ + Emitter{ id: emitter system: sys emitting: false @@ -67,7 +133,7 @@ Rectangle{ maxParticles: 1200 anchors.fill: parent particleSize: 32 - speed: PointVector{ xVariation: 12; yVariation: 12 } + speed: PointDirection{ xVariation: 12; yVariation: 12 } } MouseArea{ anchors.fill: parent diff --git a/examples/declarative/particles/allsmiles/smilefactory.qml b/examples/declarative/particles/allsmiles/smilefactory.qml index 47becb50fe..262644ec56 100644 --- a/examples/declarative/particles/allsmiles/smilefactory.qml +++ b/examples/declarative/particles/allsmiles/smilefactory.qml @@ -39,14 +39,14 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "goldenrod" width: 400 height: 400 ParticleSystem{id:sys} - DeformableParticle{ + ImageParticle{ system: sys particles: ["goingLeft", "goingRight"] image: "content/singlesmile.png" @@ -54,12 +54,12 @@ Rectangle{ rotationSpeed: 90 autoRotation: true } - DeformableParticle{ + ImageParticle{ system: sys particles: ["goingDown"] image: "content/squarefacespriteXX.png" rotation: 180 - yVector: PointVector{ y: 0.5; yVariation: 0.25; xVariation: 0.25; } + yVector: PointDirection{ y: 0.5; yVariation: 0.25; xVariation: 0.25; } } Timer{ running: true @@ -79,38 +79,38 @@ Rectangle{ interval: 8400 onTriggered: emitC.emitting = true; } - TrailEmitter{ + Emitter{ id: emitA x: 0 y: 120 system: sys emitting: false particle: "goingRight" - speed: PointVector{ x: 100 } + speed: PointDirection{ x: 100 } particleDuration: 4000 particlesPerSecond: 2 particleSize: 32 } - TrailEmitter{ + Emitter{ id: emitB x: 400 y: 240 system: sys emitting: false particle: "goingLeft" - speed: PointVector{ x: -100 } + speed: PointDirection{ x: -100 } particleDuration: 4000 particlesPerSecond: 2 particleSize: 32 } - TrailEmitter{ + Emitter{ id: emitC x: 0 y: 360 system: sys emitting: false particle: "goingDown" - speed: PointVector{ x: 100 } + speed: PointDirection{ x: 100 } particleDuration: 4000 particlesPerSecond: 2 particleSize: 32 diff --git a/examples/declarative/particles/allsmiles/spriteparticles.qml b/examples/declarative/particles/allsmiles/spriteparticles.qml index 4bcb7081b8..1f385f2c20 100644 --- a/examples/declarative/particles/allsmiles/spriteparticles.qml +++ b/examples/declarative/particles/allsmiles/spriteparticles.qml @@ -39,13 +39,13 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "goldenrod" width: 400 height: 400 - ColoredParticle{ + ImageParticle{ id: test particles: ["Test"] image: "content/particle.png" @@ -55,23 +55,23 @@ Rectangle{ color: "#336666CC" colorVariation: 0.0 } - SpriteParticle{ + ImageParticle{ id: single particles: ["Face"] system: sys z: 2 anchors.fill: parent - Sprite{ + sprites: Sprite{ source: "content/squarefacesprite.png" frames: 6 duration: 120 } } - Mask{ + MaskShape{ id: mask source: "content/smileMask.png" } - TrailEmitter{ + Emitter{ system: sys particle: "Test" anchors.fill: parent @@ -82,7 +82,7 @@ Rectangle{ particleSize: 10 shape: mask } - TrailEmitter{ + Emitter{ system: sys particle: "Face" anchors.fill: parent @@ -90,7 +90,7 @@ Rectangle{ particlesPerSecond: 60 particleDuration: 1440 emitting: true - speed: PointVector{xVariation: 10; yVariation: 10;} + speed: PointDirection{xVariation: 10; yVariation: 10;} particleSize: 30 particleSizeVariation: 10 shape: mask diff --git a/examples/declarative/particles/allsmiles/spritestateparticles.qml b/examples/declarative/particles/allsmiles/spritestateparticles.qml index 6a61487a89..0818686e15 100644 --- a/examples/declarative/particles/allsmiles/spritestateparticles.qml +++ b/examples/declarative/particles/allsmiles/spritestateparticles.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "goldenrod" @@ -109,7 +109,7 @@ Rectangle{ z:4 } ParticleSystem{ id: sys } - SpriteParticle{ + ImageParticle{ anchors.fill: parent id: particles system: sys @@ -168,13 +168,13 @@ Rectangle{ duration: 10000 }] } - TrailEmitter{ + Emitter{ system: sys particlesPerSecond: 16 particleDuration: 10000 emitting: true - speed: AngleVector{angle: 90; magnitude: 60; angleVariation: 5} - acceleration: PointVector{ y: 10 } + speed: AngledDirection{angle: 90; magnitude: 60; angleVariation: 5} + acceleration: PointDirection{ y: 10 } particleSize: 30 particleSizeVariation: 10 width: parent.width diff --git a/examples/declarative/particles/allsmiles/spritevariedparticles.qml b/examples/declarative/particles/allsmiles/spritevariedparticles.qml index c1b773093f..e6aeaccea1 100644 --- a/examples/declarative/particles/allsmiles/spritevariedparticles.qml +++ b/examples/declarative/particles/allsmiles/spritevariedparticles.qml @@ -39,14 +39,14 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "goldenrod" width: 800 height: 800 ParticleSystem{ id: sys } - SpriteParticle{ + ImageParticle{ system: sys anchors.fill: parent sprites: [Sprite{ @@ -92,15 +92,15 @@ Rectangle{ duration: 120 }] } - TrailEmitter{ + Emitter{ id: particleEmitter system: sys width: parent.width particlesPerSecond: 16 particleDuration: 8000 emitting: true - speed: AngleVector{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5} - acceleration: PointVector{ y: 10 } + speed: AngledDirection{angle: 90; magnitude: 300; magnitudeVariation: 100; angleVariation: 5} + acceleration: PointDirection{ y: 10 } particleSize: 30 particleSizeVariation: 10 } diff --git a/examples/declarative/particles/allsmiles/ultraparticles.qml b/examples/declarative/particles/allsmiles/ultraparticles.qml index 85bbdbacd8..f2b6f8d163 100644 --- a/examples/declarative/particles/allsmiles/ultraparticles.qml +++ b/examples/declarative/particles/allsmiles/ultraparticles.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "white" @@ -48,7 +48,7 @@ Rectangle{ ParticleSystem{ id: sys } - UltraParticle{ + ImageParticle{ sprites: [ Sprite{ name: "licking" @@ -80,14 +80,14 @@ Rectangle{ factor: 0.1 system: sys } - TrailEmitter{ + Emitter{ system: sys anchors.centerIn: parent id: particles particlesPerSecond: 200 particleDuration: 6000 emitting: true - speed: AngleVector{angleVariation: 360; magnitude: 80; magnitudeVariation: 40} + speed: AngledDirection{angleVariation: 360; magnitude: 80; magnitudeVariation: 40} particleSize: 40 particleEndSize: 80 } diff --git a/examples/declarative/particles/asteroid/asteroid.qml b/examples/declarative/particles/asteroid/asteroid.qml index b5b4f672c2..223ea81205 100644 --- a/examples/declarative/particles/asteroid/asteroid.qml +++ b/examples/declarative/particles/asteroid/asteroid.qml @@ -38,8 +38,8 @@ ** ****************************************************************************/ -import Qt.labs.particles 2.0 -import Qt.labs.particles 2.0 as Qlp +import QtQuick.Particles 2.0 +import QtQuick.Particles 2.0 as Qlp import QtQuick 2.0 Item { @@ -65,14 +65,14 @@ Item { } } - ColoredParticle { + ImageParticle { system: sys particles: ["starfield"] image: "content/star.png" colorVariation: 0.3 color: "white" } - TrailEmitter { + Emitter { id: starField system: sys particle: "starfield" @@ -82,25 +82,25 @@ Item { anchors.centerIn: parent - //acceleration: AngleVector{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed? - acceleration: PointVector{ xVariation: 200; yVariation: 200; } + //acceleration: AngledDirection{angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed? + acceleration: PointDirection{ xVariation: 200; yVariation: 200; } particleSize: 0 particleEndSize: 80 particleSizeVariation: 10 } - TrailEmitter{ + Emitter{ system: sys particle: "meteor" particlesPerSecond: 12 particleDuration: 5000 emitting: true - acceleration: PointVector{ xVariation: 80; yVariation: 80; } + acceleration: PointDirection{ xVariation: 80; yVariation: 80; } particleSize: 15 particleEndSize: 300 anchors.centerIn: parent } - SpriteParticle{ + ImageParticle{ system: sys particles: ["meteor"] sprites:[Sprite{ @@ -168,7 +168,7 @@ Item { } } - ColoredParticle{ + ImageParticle{ z:0 system: sys particles: ["exhaust"] @@ -191,7 +191,7 @@ Item { colorVariation: 0.2 } - TrailEmitter{ + Emitter{ id: trailsNormal2 system: sys particle: "exhaust" @@ -202,10 +202,10 @@ Item { y: holder.y x: holder.x - speed: PointVector{ xVariation: 40; yVariation: 40; } + speed: PointDirection{ xVariation: 40; yVariation: 40; } speedFromMovement: 16 - acceleration: PointVector{ xVariation: 10; yVariation: 10; } + acceleration: PointDirection{ xVariation: 10; yVariation: 10; } particleSize: 4 particleSizeVariation: 4 diff --git a/examples/declarative/particles/asteroid/blackhole.qml b/examples/declarative/particles/asteroid/blackhole.qml index 68d5835880..f2c9d0a98d 100644 --- a/examples/declarative/particles/asteroid/blackhole.qml +++ b/examples/declarative/particles/asteroid/blackhole.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ id: root @@ -65,7 +65,7 @@ Rectangle{ } } - TrailEmitter{ + Emitter{ particle: "stars" system: particles particlesPerSecond: 40 @@ -73,10 +73,10 @@ Rectangle{ emitting: true particleSize: 30 particleSizeVariation: 10 - speed: PointVector{ x: 220; xVariation: 40 } + speed: PointDirection{ x: 220; xVariation: 40 } height: parent.height } - TrailEmitter{ + Emitter{ particle: "roids" system: particles particlesPerSecond: 10 @@ -84,14 +84,14 @@ Rectangle{ emitting: true particleSize: 30 particleSizeVariation: 10 - speed: PointVector{ x: 220; xVariation: 40 } + speed: PointDirection{ x: 220; xVariation: 40 } height: parent.height } ParticleSystem{ id: particles anchors.fill: parent } - ColoredParticle{ + ImageParticle{ id: stars particles: ["stars"] system: particles @@ -99,7 +99,7 @@ Rectangle{ color: "white" colorVariation: 0.1 } - SpriteParticle{ + ImageParticle{ id: roids particles: ["roids"] system: particles @@ -112,7 +112,7 @@ Rectangle{ speedModifiesDuration: -0.1 } } - ColoredParticle{ + ImageParticle{ id: shot particles: ["shot"] system: particles @@ -121,7 +121,7 @@ Rectangle{ color: "#0FF06600" colorVariation: 0.3 } - ColoredParticle{ + ImageParticle{ id: engine particles: ["engine"] system: particles @@ -166,7 +166,7 @@ Rectangle{ drag.axis: Drag.XandYAxis drag.target: ship } - TrailEmitter{ + Emitter{ particle: "engine" system: particles particlesPerSecond: 200 @@ -175,18 +175,18 @@ Rectangle{ particleSize: 10 particleEndSize: 4 particleSizeVariation: 4 - speed: PointVector{ x: -128; xVariation: 32 } + speed: PointDirection{ x: -128; xVariation: 32 } height: parent.height width: 20 } - TrailEmitter{ + Emitter{ particle: "shot" system: particles particlesPerSecond: 32 particleDuration: 2000 emitting: spacePressed particleSize: 40 - speed: PointVector{ x: 256; } + speed: PointDirection{ x: 256; } x: parent.width y: parent.height/2 } diff --git a/examples/declarative/particles/custom/blurparticles.qml b/examples/declarative/particles/custom/blurparticles.qml new file mode 100644 index 0000000000..7d0f9cc6ac --- /dev/null +++ b/examples/declarative/particles/custom/blurparticles.qml @@ -0,0 +1,125 @@ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Rectangle{ + color: "white" + width: 240 + height: 360 + ParticleSystem{ + id: sys + } + Emitter{ + system:sys + height: parent.height + particlesPerSecond: 1 + particleDuration: 12000 + speed: PointDirection{x:20;} + particleSize: 64 + } + ShaderEffectSource{ + id: theSource + sourceItem: theItem + hideSource: true + } + Image{ + id: theItem + source: "content/smile.png" + } + + CustomParticle{ + system: sys + //TODO: Someway that you don't have to rewrite the basics for a simple addition + vertexShader:" + attribute highp vec2 vPos; + attribute highp vec2 vTex; + attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize + attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration + attribute highp float r; + + uniform highp mat4 qt_ModelViewProjectionMatrix; + uniform highp float timestamp; + uniform lowp float qt_Opacity; + + varying highp vec2 fTex; + varying lowp float fFade; + varying lowp float fBlur; + + void main() { + fTex = vTex; + highp float size = vData.z; + highp float endSize = vData.w; + + highp float t = (timestamp - vData.x) / vData.y; + + highp float currentSize = mix(size, endSize, t * t); + + if (t < 0. || t > 1.) + currentSize = 0.; + + highp vec2 pos = vPos + - currentSize / 2. + currentSize * vTex // adjust size + + vVec.xy * t * vData.y // apply speed vector.. + + 0.5 * vVec.zw * pow(t * vData.y, 2.); + + gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1); + + highp float fadeIn = min(t * 10., 1.); + highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + + fFade = fadeIn * fadeOut * qt_Opacity; + fBlur = max(0.2 * t, t * r); + } + " + property variant source: theSource + property variant blurred: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(0.0, 1.0 / height) + property variant source: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(1.0 / width, 0.0) + property variant source: theSource + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + fragmentShader: " + uniform sampler2D source; + uniform sampler2D blurred; + varying highp vec2 fTex; + varying highp float fBlur; + varying highp float fFade; + void main() { + gl_FragColor = mix(texture2D(source, fTex), texture2D(blurred, fTex), min(1.0,fBlur*3.0)) * fFade; + }" + + } +} + diff --git a/examples/declarative/particles/custom/content/smile.png b/examples/declarative/particles/custom/content/smile.png Binary files differnew file mode 100644 index 0000000000..3d66d72578 --- /dev/null +++ b/examples/declarative/particles/custom/content/smile.png diff --git a/examples/declarative/particles/modelparticles/bubbles.qml b/examples/declarative/particles/modelparticles/bubbles.qml index 80d03a9ea7..d0eb3ea044 100644 --- a/examples/declarative/particles/modelparticles/bubbles.qml +++ b/examples/declarative/particles/modelparticles/bubbles.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "../../modelviews/listview/content" as OtherDemo import "content/script.js" as Script import "content" @@ -56,21 +56,22 @@ Item{ ParticleSystem{ id: sys; } - TrailEmitter{ + Emitter{ system: sys particle: "A" width: parent.width/2 x: parent.width/4 y:parent.height - speed: PointVector{ y: -64; yVariation: 16 } + speed: PointDirection{ y: -64; yVariation: 16 } particlesPerSecond: 1 particleDuration: 8000 } - Drift{ + Wander{ system: sys - xDrift: 200 + xVariance: 400 + pace: 200 } - DataParticle{ + ModelParticle{ id: mp z: 0 system: sys diff --git a/examples/declarative/particles/modelparticles/gridsplosion.qml b/examples/declarative/particles/modelparticles/gridsplosion.qml index d45ef392e0..fe2dd261a5 100644 --- a/examples/declarative/particles/modelparticles/gridsplosion.qml +++ b/examples/declarative/particles/modelparticles/gridsplosion.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "content" Item{ @@ -48,13 +48,14 @@ Item{ height: 240 property bool inGrid: false ParticleSystem{ id: sys } - TrailEmitter{ + Emitter{ system: sys id: burster; emitting: false particlesPerSecond: 1000 - particleDuration: 500 - speed: PointVector{xVariation: 400; yVariation: 400} + particleDuration: 50000 + maxParticles: 100; + speed: PointDirection{xVariation: 400; yVariation: 400} anchors.centerIn: parent Timer{ interval: 1000 @@ -69,7 +70,7 @@ Item{ onTriggered: {inGrid = true;}// sys.running = false;} } } - ColoredParticle{ + ImageParticle{ system: sys image: "../trails/content/particle.png" color: "black" @@ -80,17 +81,14 @@ Item{ width: 120 height: 120 } - DataParticle{ + ModelParticle{ system: sys model: theModel.parts.particles + fade: false } Friction{ system: sys - factor: 1 - } - Stasis{ - system: sys - targetLife: 400 + factor: 5 } VisualDataModel{ id: theModel diff --git a/examples/declarative/particles/modelparticles/package.qml b/examples/declarative/particles/modelparticles/package.qml index d5c104b480..64873802a5 100644 --- a/examples/declarative/particles/modelparticles/package.qml +++ b/examples/declarative/particles/modelparticles/package.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "content" Rectangle { @@ -69,7 +69,7 @@ Rectangle { width: 200; height:200 model: visualModel.parts.list } - DataParticle{ + ModelParticle{ x: 200; width: 200; height:200 model: visualModel.parts.grid system: sys @@ -80,11 +80,11 @@ Rectangle { id: sys anchors.fill: parent } - TrailEmitter{ + Emitter{ system: sys width: 100 x: 50 - speed: PointVector{ y: 40 } + speed: PointDirection{ y: 40 } particleDuration: 5000 particlesPerSecond: 1.6 } diff --git a/examples/declarative/particles/modelparticles/stream.qml b/examples/declarative/particles/modelparticles/stream.qml index 0ad807bc7b..73107ad4f7 100644 --- a/examples/declarative/particles/modelparticles/stream.qml +++ b/examples/declarative/particles/modelparticles/stream.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "content/script.js" as Script import "content" @@ -68,13 +68,13 @@ Item{ overwrite: false startTime: 12000//Doesn't actually work with the loading time though... } - TrailEmitter{ + Emitter{ id: emitter system: sys height: parent.height - 132/2 x: -132/2 y: 132/2 - speed: PointVector{ x: 32; xVariation: 8 } + speed: PointDirection{ x: 32; xVariation: 8 } particlesPerSecond: 0.5 particleDuration: 120000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first) particle: "photos" @@ -85,7 +85,7 @@ Item{ height: parent.height width: 1000 } - ColoredParticle{ + ImageParticle{ system: sys particles: ["fireworks"] image: "../trails/content/star.png" @@ -125,7 +125,7 @@ Item{ } property Item alertItem; function alert(){ - resetter.active = false + //resetter.active = false force.active = true; alertItem = alertDelegate.createObject(root); alertItem.x = root.width/2 - alertItem.width/2 @@ -142,31 +142,27 @@ Item{ interval: 800 onTriggered: { force.active = false - resetter.active = true; + //resetter.active = true; mp.take(alertItem, true); centerEmitter.burst(1); } } - Attractor{ + PointAttractor{ id: force system: sys x: root.width/2 y: root.height/2 - strength: -30000 + strength: -10000 active: false anchors.centerIn: parent width: parent.width/2 height: parent.height/2 particles:["photos"] + physics: PointAttractor.Position } - Reset{ - id: resetter - system: sys - particles:["photos"] - } - TrailEmitter{ + Emitter{ id: centerEmitter - speed: PointVector{ x: 32; xVariation: 8;} + speed: PointDirection{ x: 32; xVariation: 8;} particlesPerSecond: 0.5 particleDuration: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first) maxParticles: 20 @@ -177,7 +173,7 @@ Item{ //TODO: Zoom in effect } - TrailEmitter{ + Emitter{ id: spawnFireworks particle: "fireworks" system: sys @@ -191,8 +187,8 @@ Item{ emitting: false particleSize: 32 particleEndSize: 8 - speed: AngleVector{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 } - acceleration: PointVector{ y: 160 } + speed: AngledDirection{ magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 } + acceleration: PointDirection{ y: 160 } } Item{ x: -1000; y: -1000 //offscreen Repeater{//Load them here, add to system on completed diff --git a/examples/declarative/particles/snow/snow2.qml b/examples/declarative/particles/snow/content/Button.qml index c016ba2934..a937b3bede 100644 --- a/examples/declarative/particles/snow/snow2.qml +++ b/examples/declarative/particles/snow/content/Button.qml @@ -39,36 +39,35 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 -Rectangle{ - width: 360 - height: 540 - ParticleSystem{ id: particles } - SpriteParticle{ - system: particles - Sprite{ - name: "snow" - source: "content/flake-01.png" - frames: 51 - duration: 40 +Rectangle { + id: container + + property string text: "Button" + signal clicked + + width: buttonLabel.width + 20; height: buttonLabel.height + 20 + smooth: true + property color myCol: "#999999" + border { width: 1; color: Qt.darker(myCol) } + radius: 8 + + gradient: Gradient { + GradientStop { + position: 0.0 + color: { + if (mouseArea.pressed) + return Qt.darker(myCol) + else + return Qt.lighter(myCol) + } } + GradientStop { position: 1.0; color: myCol } } - Drift{ - system: particles - anchors.fill: parent - xDrift: 400; - } - TrailEmitter{ - system: particles - particlesPerSecond: 20 - particleDuration: 7000 - emitting: true - speed: PointVector{ y:80; yVariation: 40; } - acceleration: PointVector{ y: 4 } - particleSize: 20 - particleSizeVariation: 10 - width: parent.width - height: 100 + + MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: buttonLabel; text: container.text; anchors.centerIn: container; color: "black"; font.pixelSize: 24 } } diff --git a/examples/declarative/particles/snow/snow.qml b/examples/declarative/particles/snow/snow.qml index 25d2e1468b..2be2438f1d 100644 --- a/examples/declarative/particles/snow/snow.qml +++ b/examples/declarative/particles/snow/snow.qml @@ -39,15 +39,16 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 +import "content" Rectangle{ width: 360 height: 540 ParticleSystem { id: particles } - SpriteParticle { + ImageParticle { system: particles - Sprite{ + sprites: Sprite{ name: "snow" source: "content/flake-01.png" frames: 51 @@ -55,21 +56,38 @@ Rectangle{ } } Wander { + id: wanderer system: particles anchors.fill: parent - xVariance: 40; - pace: 40; + xVariance: 360/(wanderer.physics+1); + pace: 100*(wanderer.physics+1); } - TrailEmitter { + Emitter { system: particles particlesPerSecond: 20 particleDuration: 7000 emitting: true - speed: PointVector{ y:80; yVariation: 40; } - acceleration: PointVector{ y: 4 } + speed: PointDirection{ y:80; yVariation: 40; } + acceleration: PointDirection{ y: 4 } particleSize: 20 particleSizeVariation: 10 width: parent.width height: 100 } + Row{ + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + Button{ + text:"dx/dt" + onClicked: wanderer.physics = Wander.Position; + } + Button{ + text:"dv/dt" + onClicked: wanderer.physics = Wander.Velocity; + } + Button{ + text:"da/dt" + onClicked: wanderer.physics = Wander.Acceleration; + } + } } diff --git a/examples/declarative/particles/snow/snow3.qml b/examples/declarative/particles/snow/snow3.qml deleted file mode 100644 index 080bc4d1af..0000000000 --- a/examples/declarative/particles/snow/snow3.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.particles 2.0 - -Rectangle{ - width: 360 - height: 540 - id: root - ParticleSystem{ id: particles } - SpriteParticle{ - system: particles - sprites: Sprite{ - name: "snow" - source: "content/flake-01.png" - frames: 51 - duration: 40 - } - } - Drift{ - system: particles - anchors.fill: parent - xDrift: 200 - } - SpeedLimit{ - system: particles - anchors.fill: parent - speedLimit: 100 - } - TrailEmitter{ - system: particles - particlesPerSecond: 20 - particleDuration: 7000 - emitting: true - speed: PointVector{ y:80; yVariation: 40; } - acceleration: PointVector{ y: 4 } - particleSize: 20 - particleSizeVariation: 10 - width: parent.width - height: 40 - } -} diff --git a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml index 091ca0a8b5..f303bb4d9a 100644 --- a/examples/declarative/particles/spaceexplorer/spaceexplorer.qml +++ b/examples/declarative/particles/spaceexplorer/spaceexplorer.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "content/helpers.js" as Helpers Rectangle{ @@ -75,7 +75,7 @@ Rectangle{ property bool fakeMoving: false property real fakeMovementDir: 0 - TrailEmitter{ + Emitter{ particle: "stars2" system: background particlesPerSecond: 60 @@ -86,7 +86,7 @@ Rectangle{ anchors.fill: parent } ParticleSystem{ id: background } - ColoredParticle{ + ImageParticle{ particles: ["stars2"] system: background anchors.fill: parent @@ -197,7 +197,7 @@ Rectangle{ ParticleSystem{ id: foreground } - ColoredParticle{ + ImageParticle{ particles: ["stars"] anchors.fill: parent system: foreground @@ -205,7 +205,7 @@ Rectangle{ color: "white" colorVariation: 0.1 } - ColoredParticle{ + ImageParticle{ particles: ["shot"] anchors.fill: parent system: foreground @@ -214,7 +214,7 @@ Rectangle{ color: "orange" colorVariation: 0.3 } - ColoredParticle{ + ImageParticle{ id: engine particles: ["engine"] anchors.fill: parent @@ -238,30 +238,31 @@ Rectangle{ colorVariation: 0.2 } - SpriteParticle{ + ImageParticle{ particles: ["powerups"] anchors.fill: parent system: foreground - Sprite{ + sprites:[Sprite{ name: "norm" source: "content/powerupScore.png" frames: 35 duration: 40 to: {"norm":1, "got":0} - } + }, Sprite{ name: "got" source: "content/powerupScore_got.png" frames: 22 duration: 40 to: {"null":1} - } + }, Sprite{ name: "null" source: "content/powerupScore_gone.png" frames: 1 duration: 1000 } + ] } SpriteGoal{ x: rocket.x - 30 @@ -273,8 +274,9 @@ Rectangle{ onAffected: if(!gameOver) score += 1000 system: foreground } - GravitationalSingularity{ + PointAttractor{ id: gs1; x: vorteX; y: vorteY; strength: 800000; + proportionalToDistance: PointAttractor.Quadratic; system: foreground } Kill{ @@ -285,8 +287,9 @@ Rectangle{ system: foreground } - GravitationalSingularity{ + PointAttractor{ id: gs2; x: vorteX2; y: vorteY2; strength: 800000; + proportionalToDistance: PointAttractor.Quadratic; system: foreground } Kill{ @@ -297,8 +300,9 @@ Rectangle{ system: foreground } - GravitationalSingularity{ + PointAttractor{ id: gs3; x: vorteX3; y: vorteY3; strength: 800000; + proportionalToDistance: PointAttractor.Quadratic; system: foreground } Kill{ @@ -308,8 +312,9 @@ Rectangle{ height: holeSize * 2 system: foreground } - GravitationalSingularity{ + PointAttractor{ id: gs4; x: vorteX4; y: vorteY4; strength: 800000; + proportionalToDistance: PointAttractor.Quadratic; system: foreground } Kill{ @@ -319,7 +324,7 @@ Rectangle{ height: holeSize * 2 system: foreground } - TrailEmitter{ + Emitter{ particle: "powerups" system: foreground particlesPerSecond: 1 @@ -329,7 +334,7 @@ Rectangle{ particleSizeVariation: 10 anchors.fill: parent } - TrailEmitter{ + Emitter{ particle: "stars" system: foreground particlesPerSecond: 40 @@ -374,7 +379,7 @@ Rectangle{ drag.axis: Drag.XandYAxis drag.target: rocket }, - TrailEmitter{ + Emitter{ system: foreground particle: "engine" particlesPerSecond: 100 @@ -383,7 +388,7 @@ Rectangle{ particleSize: 10 particleEndSize: 4 particleSizeVariation: 4 - speed: PointVector{ + speed: PointDirection{ x: -128 * Math.cos(rocket.rotation * (Math.PI / 180)) y: -128 * Math.sin(rocket.rotation * (Math.PI / 180)) } @@ -392,14 +397,14 @@ Rectangle{ width: 4 }, - TrailEmitter{ + Emitter{ system: foreground particle: "shot" particlesPerSecond: 16 particleDuration: 1600 emitting: !gameOver && shoot particleSize: 40 - speed: PointVector{ + speed: PointDirection{ x: 256 * Math.cos(rocket.rotation * (Math.PI / 180)) y: 256 * Math.sin(rocket.rotation * (Math.PI / 180)) } diff --git a/examples/declarative/particles/trails/dynamicemitters.qml b/examples/declarative/particles/trails/dynamicemitters.qml index 8ea0272d94..8e555033a0 100644 --- a/examples/declarative/particles/trails/dynamicemitters.qml +++ b/examples/declarative/particles/trails/dynamicemitters.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ id: root @@ -49,7 +49,7 @@ Rectangle{ ParticleSystem{ id: sys } - ColoredParticle{ + ImageParticle{ system: sys image: "content/particle.png" color: "white" @@ -58,9 +58,9 @@ Rectangle{ } Component{ id: emitterComp - TrailEmitter{ + Emitter{ id: container - TrailEmitter{ + Emitter{ id: emitMore system: sys emitting: true @@ -68,7 +68,7 @@ Rectangle{ particleDuration: 600 particleSize: 16 particleEndSize: 8 - speed: AngleVector{angleVariation:360; magnitude: 60} + speed: AngledDirection{angleVariation:360; magnitude: 60} } property int life: 2600 diff --git a/examples/declarative/particles/trails/fireballs.qml b/examples/declarative/particles/trails/fireballs.qml index 116a2334dc..cd81168d81 100644 --- a/examples/declarative/particles/trails/fireballs.qml +++ b/examples/declarative/particles/trails/fireballs.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle { id: root @@ -52,7 +52,7 @@ Rectangle { } /* - ColoredParticle{ + ImageParticle{ id: fireball anchors.fill: parent particles: ["E"] @@ -62,7 +62,7 @@ Rectangle { color: "#00ff400f" } */ - ColoredParticle{ + ImageParticle{ id: smoke system: particles anchors.fill: parent @@ -71,7 +71,7 @@ Rectangle { colorVariation: 0 color: "#00111111" } - ColoredParticle{ + ImageParticle{ id: flame anchors.fill: parent system: particles @@ -80,7 +80,7 @@ Rectangle { colorVariation: 0.1 color: "#00ff400f" } - TrailEmitter{ + Emitter{ id: fire system: particles particle: "C" @@ -91,8 +91,8 @@ Rectangle { particlesPerSecond: 350 particleDuration: 3500 - acceleration: PointVector{ y: -17; xVariation: 3 } - speed: PointVector{xVariation: 3} + acceleration: PointDirection{ y: -17; xVariation: 3 } + speed: PointDirection{xVariation: 3} particleSize: 24 particleSizeVariation: 8 @@ -109,8 +109,8 @@ Rectangle { particlesPerParticlePerSecond: 1 particleDuration: 2000 - speed: PointVector{y:-17*6; yVariation: -17; xVariation: 3} - acceleration: PointVector{xVariation: 3} + speed: PointDirection{y:-17*6; yVariation: -17; xVariation: 3} + acceleration: PointDirection{xVariation: 3} particleSize: 36 particleSizeVariation: 8 @@ -145,14 +145,14 @@ Rectangle { emissionWidth: 16 emissionHeight: 16 - speed: PointVector{yVariation: 16; xVariation: 16} - acceleration: PointVector{y: -16} + speed: PointDirection{yVariation: 16; xVariation: 16} + acceleration: PointDirection{y: -16} particleSize: 24 particleSizeVariation: 8 particleEndSize: 8 } - TrailEmitter{ + Emitter{ id: balls system: particles particle: "E" @@ -163,8 +163,8 @@ Rectangle { particlesPerSecond: 2 particleDuration: 7000 - speed: PointVector{y:-17*4*2; xVariation: 6*6} - acceleration: PointVector{y: 17*2; xVariation: 6*6} + speed: PointDirection{y:-17*4*2; xVariation: 6*6} + acceleration: PointDirection{y: 17*2; xVariation: 6*6} particleSize: 12 particleSizeVariation: 4 diff --git a/examples/declarative/particles/trails/layered.qml b/examples/declarative/particles/trails/layered.qml index 38eb8e67dc..b2895dd617 100644 --- a/examples/declarative/particles/trails/layered.qml +++ b/examples/declarative/particles/trails/layered.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ id: root @@ -55,30 +55,26 @@ Rectangle{ id: sys startTime: 4000 } - TrailEmitter{ + Emitter{ system: sys y:root.height + 20 width: root.width particlesPerSecond: 200 particleDuration: 4000 - speed: PointVector{ y: -120; } + speed: PointDirection{ y: -120; } } - SpriteParticle{ + ImageParticle{ system: sys visible: !cloneMode - Sprite{ - source: "content/particle2.png" - } + image: "content/particle2.png" } - SpriteParticle{ + ImageParticle{ system: sys visible: cloneMode z: 0 - Sprite{ - source: "content/particle3.png" - } + image: "content/particle3.png" } - SpriteParticle{ + ImageParticle{ system: sys clip: true visible: cloneMode @@ -86,8 +82,6 @@ Rectangle{ height: 240 width: root.width z: 1 - Sprite{ - source: "content/particle.png" - } + image: "content/particle.png" } } diff --git a/examples/declarative/particles/trails/list.qml b/examples/declarative/particles/trails/list.qml index 2ab579f126..7874590e28 100644 --- a/examples/declarative/particles/trails/list.qml +++ b/examples/declarative/particles/trails/list.qml @@ -43,14 +43,14 @@ // highlight bar is moved between items. + Particles. import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import "content" Rectangle { width: 200; height: 300 color: "black" ParticleSystem{ id: particles } - ColoredParticle{ + ImageParticle{ anchors.fill: parent system: particles z: 10 @@ -92,7 +92,7 @@ Rectangle { y: listView.currentItem.y; //Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } Behavior on y { NumberAnimation {id: anim} } - TrailEmitter{ + Emitter{ anchors.fill: parent system: particles; emitting: anim.running diff --git a/examples/declarative/particles/trails/overburst.qml b/examples/declarative/particles/trails/overburst.qml index 6ca15972a4..ed9313d471 100644 --- a/examples/declarative/particles/trails/overburst.qml +++ b/examples/declarative/particles/trails/overburst.qml @@ -39,21 +39,21 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "black" width: 360 height: 540 ParticleSystem{ id: sys } - ColoredParticle{ + ImageParticle{ system: sys id: cp image: "content/particle.png" colorVariation: 0.4 color: "#000000FF" } - TrailEmitter{ + Emitter{ //burst on click id: bursty system: sys @@ -63,7 +63,7 @@ Rectangle{ particlesPerSecond: 16000 particleDuration: 1000 maxParticles: 4000 - acceleration: AngleVector{angleVariation: 360; magnitude: 360; } + acceleration: AngledDirection{angleVariation: 360; magnitude: 360; } particleSize: 8 particleEndSize: 16 particleSizeVariation: 4 diff --git a/examples/declarative/particles/trails/portal.qml b/examples/declarative/particles/trails/portal.qml index dba2e59513..ae9b447fb9 100644 --- a/examples/declarative/particles/trails/portal.qml +++ b/examples/declarative/particles/trails/portal.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ id: root @@ -54,7 +54,7 @@ Rectangle{ id: particles startTime: 2000 } - ColoredParticle{ + ImageParticle{ particles: ["center","edge"] anchors.fill: parent system: particles @@ -62,7 +62,7 @@ Rectangle{ colorVariation: 0.1 color: "#009999FF" } - TrailEmitter{ + Emitter{ anchors.fill: parent particle: "center" system: particles @@ -72,15 +72,15 @@ Rectangle{ particleSize: 20 particleSizeVariation: 2 particleEndSize: 0 - shape: Ellipse{fill: false} - speed: DirectedVector{ + shape: EllipseShape{fill: false} + speed: TargetedDirection{ targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true magnitude: 0.5 } } - TrailEmitter{ + Emitter{ anchors.fill: parent particle: "edge" system: particles @@ -90,15 +90,15 @@ Rectangle{ particleSize: 20 particleSizeVariation: 2 particleEndSize: 0 - shape: Ellipse{fill: false} - speed: DirectedVector{ + shape: EllipseShape{fill: false} + speed: TargetedDirection{ targetX: root.width/2 targetY: root.height/2 proportionalMagnitude: true magnitude: 0.1 magnitudeVariation: 0.1 } - acceleration: DirectedVector{ + acceleration: TargetedDirection{ targetX: root.width/2 targetY: root.height/2 targetVariation: 200 diff --git a/examples/declarative/particles/trails/rainbow.qml b/examples/declarative/particles/trails/rainbow.qml index 6c64929668..543a9b6182 100644 --- a/examples/declarative/particles/trails/rainbow.qml +++ b/examples/declarative/particles/trails/rainbow.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 import QtQuick 2.0 Rectangle { @@ -48,7 +48,7 @@ Rectangle { color: "black" ParticleSystem{ id: particles } - ColoredParticle{ + ImageParticle{ system: particles colorVariation: 0.5 alpha: 0 @@ -57,7 +57,7 @@ Rectangle { colorTable: "content/colortable.png" sizeTable: "content/colortable.png" } - TrailEmitter{ + Emitter{ system: particles particlesPerSecond: 500 particleDuration: 2000 @@ -72,8 +72,8 @@ Rectangle { speedFromMovement: 20 - speed: PointVector{ xVariation: 5; yVariation: 5;} - acceleration: PointVector{ xVariation: 5; yVariation: 5;} + speed: PointDirection{ xVariation: 5; yVariation: 5;} + acceleration: PointDirection{ xVariation: 5; yVariation: 5;} particleSize: 16 //particleEndSize: 8 diff --git a/examples/declarative/particles/trails/shimmer.qml b/examples/declarative/particles/trails/shimmer.qml index 06f599d97a..b3157f68cd 100644 --- a/examples/declarative/particles/trails/shimmer.qml +++ b/examples/declarative/particles/trails/shimmer.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ width: 360 @@ -53,7 +53,7 @@ Rectangle{ id: particles running: false } - ColoredParticle{ + ImageParticle{ anchors.fill: parent system: particles image: "content/star.png" @@ -61,7 +61,7 @@ Rectangle{ alpha: 0 colorVariation: 0.6 } - TrailEmitter{ + Emitter{ anchors.fill: parent system: particles particlesPerSecond: 2000 diff --git a/examples/declarative/particles/trails/swarm.qml b/examples/declarative/particles/trails/swarm.qml deleted file mode 100644 index 083f9e816d..0000000000 --- a/examples/declarative/particles/trails/swarm.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.particles 2.0 as QLP - -Rectangle{ - width: 200 - height: 200 - color: "black" - QLP.ParticleSystem{ id: ps } - QLP.ColoredParticle{ - system: ps - particles: ["star1","star2"] - anchors.fill: parent - clip: true - image: "content/star.png" - } - QLP.Swarm{ - system: ps - leaders: ["star2"]; - anchors.fill: parent - strength: 128 - } - QLP.TrailEmitter{ - anchors.fill: parent - system: ps - particle: "star1" - particlesPerSecond: 100 - particleDuration: 2000 - } - QLP.TrailEmitter{ - anchors.fill: parent - system: ps - particle: "star2" - particlesPerSecond: 0.4 - particleDuration: 10000 - particleSize: 64 - particleEndSize: 32 - } -} diff --git a/examples/declarative/particles/trails/trails.qml b/examples/declarative/particles/trails/trails.qml index 58d369c8d5..6ee8a6ec37 100644 --- a/examples/declarative/particles/trails/trails.qml +++ b/examples/declarative/particles/trails/trails.qml @@ -39,33 +39,33 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ color: "black" width: 360 height: 540 ParticleSystem{ id: sys } - ColoredParticle{ + ImageParticle{ system: sys id: cp image: "content/particle.png" color: "#00FFFFFF" colorVariation: 0.4 } - TrailEmitter{ + Emitter{ //burst on click id: bursty system: sys emitting: false particlesPerSecond: 2000 particleDuration: 500 - acceleration: AngleVector{ angle: 90; angleVariation: 360; magnitude: 640; } + acceleration: AngledDirection{ angle: 90; angleVariation: 360; magnitude: 640; } particleSize: 8 particleEndSize: 16 particleSizeVariation: 4 } - TrailEmitter{ + Emitter{ system: sys speedFromMovement: 4.0 emitting: ma.pressed @@ -73,7 +73,7 @@ Rectangle{ y: ma.mouseY particlesPerSecond: 400 particleDuration: 2000 - acceleration: AngleVector{ angle: 90; angleVariation: 22; magnitude: 32; } + acceleration: AngledDirection{ angle: 90; angleVariation: 22; magnitude: 32; } particleSize: 8 particleEndSize: 16 particleSizeVariation: 8 diff --git a/examples/declarative/particles/trails/turbulence.qml b/examples/declarative/particles/trails/turbulence.qml index 7da50464c2..bde25bc472 100644 --- a/examples/declarative/particles/trails/turbulence.qml +++ b/examples/declarative/particles/trails/turbulence.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle{ width: 360 @@ -66,21 +66,21 @@ Rectangle{ frequency: 64 gridSize: 16 } - ColoredParticle{ + ImageParticle{ particles: ["smoke"] system: ps image: "content/particle.png" color: "#11111111" colorVariation: 0 } - ColoredParticle{ + ImageParticle{ particles: ["flame"] system: ps image: "content/particle.png" color: "#11ff400f" colorVariation: 0.1 } - TrailEmitter{ + Emitter{ anchors.centerIn: parent system: ps particle: "flame" @@ -90,8 +90,8 @@ Rectangle{ particleSize: 20 particleEndSize: 10 particleSizeVariation: 10 - acceleration: PointVector{ y: -40 } - speed: AngleVector{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection{ y: -40 } + speed: AngledDirection{ angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 } } FollowEmitter{ id: smoke1 @@ -107,8 +107,8 @@ Rectangle{ particleSize: 16 particleEndSize: 8 particleSizeVariation: 8 - acceleration: PointVector{ y: -40 } - speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection{ y: -40 } + speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } FollowEmitter{ id: smoke2 @@ -123,7 +123,7 @@ Rectangle{ particleSize: 36 particleEndSize: 24 particleSizeVariation: 8 - acceleration: PointVector{ y: -40 } - speed: AngleVector{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } + acceleration: PointDirection{ y: -40 } + speed: AngledDirection{ angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 } } } diff --git a/examples/declarative/particles/trails/velocityfrommotion.qml b/examples/declarative/particles/trails/velocityfrommotion.qml index 3692410853..d2e4ed2917 100644 --- a/examples/declarative/particles/trails/velocityfrommotion.qml +++ b/examples/declarative/particles/trails/velocityfrommotion.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.particles 2.0 +import QtQuick.Particles 2.0 Rectangle { @@ -75,7 +75,7 @@ Rectangle { } ParticleSystem{ id: sys1 } - ColoredParticle{ + ImageParticle{ system: sys1 image: "content/particle.png" color: "cyan" @@ -105,7 +105,7 @@ Rectangle { } colorVariation: 0.3 } - TrailEmitter{ + Emitter{ id: trailsNormal system: sys1 @@ -116,15 +116,15 @@ Rectangle { y: mouseArea.pressed ? mouseArea.mouseY : circle.cy x: mouseArea.pressed ? mouseArea.mouseX : circle.cx - speed: PointVector{xVariation: 4; yVariation: 4;} - acceleration: PointVector{xVariation: 10; yVariation: 10;} + speed: PointDirection{xVariation: 4; yVariation: 4;} + acceleration: PointDirection{xVariation: 10; yVariation: 10;} speedFromMovement: 8 particleSize: 8 particleSizeVariation: 4 } ParticleSystem { id: sys2 } - ColoredParticle{ + ImageParticle{ color: "cyan" system: sys2 alpha: 0 @@ -144,7 +144,7 @@ Rectangle { colorVariation: 0.5 image: "content/star.png" } - TrailEmitter{ + Emitter{ id: trailsStars system: sys2 @@ -155,15 +155,15 @@ Rectangle { y: mouseArea.pressed ? mouseArea.mouseY : circle.cy x: mouseArea.pressed ? mouseArea.mouseX : circle.cx - speed: PointVector{xVariation: 4; yVariation: 4;} - acceleration: PointVector{xVariation: 10; yVariation: 10;} + speed: PointDirection{xVariation: 4; yVariation: 4;} + acceleration: PointDirection{xVariation: 10; yVariation: 10;} speedFromMovement: 8 particleSize: 22 particleSizeVariation: 4 } ParticleSystem { id: sys3; } - ColoredParticle{ + ImageParticle{ image: "content/particle.png" system: sys3 color: "orange" @@ -185,7 +185,7 @@ Rectangle { colorVariation: 0.2 } - TrailEmitter{ + Emitter{ id: trailsNormal2 system: sys3 @@ -197,14 +197,14 @@ Rectangle { speedFromMovement: 16 - speed: PointVector{xVariation: 4; yVariation: 4;} - acceleration: PointVector{xVariation: 10; yVariation: 10;} + speed: PointDirection{xVariation: 4; yVariation: 4;} + acceleration: PointDirection{xVariation: 10; yVariation: 10;} particleSize: 12 particleSizeVariation: 4 } ParticleSystem { id: sys4; } - ColoredParticle{ + ImageParticle{ system: sys4 image: "content/star.png" color: "green" @@ -225,7 +225,7 @@ Rectangle { colorVariation: 0.5 } - TrailEmitter{ + Emitter{ id: trailsStars2 system: sys4 @@ -237,8 +237,8 @@ Rectangle { x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx speedFromMovement: 16 - speed: PointVector{xVariation: 2; yVariation: 2;} - acceleration: PointVector{xVariation: 10; yVariation: 10;} + speed: PointDirection{xVariation: 2; yVariation: 2;} + acceleration: PointDirection{xVariation: 10; yVariation: 10;} particleSize: 22 particleSizeVariation: 4 |