gravity.qml Example File
particles/affectors/content/gravity.qml
import QtQuick 2.0
import QtQuick.Particles 2.0
Item {
id: window
width: 320; height: 480
Rectangle {
id: sky
anchors.fill: parent
gradient: Gradient {
GradientStop {
position: 0.0
color: "DeepSkyBlue"
}
GradientStop {
position: 1.0
color: "SkyBlue"
}
}
}
Rectangle {
id: ground
width: parent.height * 2
height: parent.height
y: parent.height/2
x: parent.width/2 - parent.height
transformOrigin: Item.Top
rotation: 0
gradient: Gradient {
GradientStop { position: 0.0; color: "ForestGreen"; }
GradientStop { position: 1.0; color: "DarkGreen"; }
}
}
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
magnitude: 32
angle: ground.rotation + 90
}
Emitter {
system: sys
anchors.centerIn: parent
emitRate: 1
lifeSpan: 10000
size: 64
}
ImageParticle {
anchors.fill: parent
system: sys
source: "../../images/realLeaf1.png"
}
}