/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** 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 QtQuick.Particles 2.0
-ParticleSystem{
+ParticleSystem {
id: sys
width: 360
height: 600
running: true
- Rectangle{
+ Rectangle {
z: -1
anchors.fill: parent
color: "black"
}
+
property real petalLength: 180
property real petalRotation: 0
- NumberAnimation on petalRotation{
+ NumberAnimation on petalRotation {
from: 0;
to: 360;
loops: -1;
running: true
duration: 24000
}
- function convert(a){return a*(Math.PI/180);}
- Emitter{
+
+ function convert(a) {return a*(Math.PI/180);}
+ Emitter {
lifeSpan: 4000
emitRate: 120
size: 12
anchors.centerIn: parent
- onEmitParticle:{
- particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
- var theta = Math.floor(Math.random() * 6.0) / 6.0;
- theta *= 2.0*Math.PI;
- theta += sys.convert(sys.petalRotation);
- particle.initialVX = petalLength * Math.cos(theta);
- particle.initialVY = petalLength * Math.sin(theta);
- particle.initialAX = particle.initialVX * -0.5;
- particle.initialAY = particle.initialVY * -0.5;
+ onEmitParticles: {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
+ var theta = Math.floor(Math.random() * 6.0) / 6.0;
+ theta *= 2.0*Math.PI;
+ theta += sys.convert(sys.petalRotation);
+ particle.initialVX = petalLength * Math.cos(theta);
+ particle.initialVY = petalLength * Math.sin(theta);
+ particle.initialAX = particle.initialVX * -0.5;
+ particle.initialAY = particle.initialVY * -0.5;
+ }
}
}
- ImageParticle{
+
+ ImageParticle {
source: "../images/particle4.png"
alpha: 0.0
redVariation: 0.6