aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/particles/custom/fallingleaves.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/particles/custom/fallingleaves.qml')
-rw-r--r--examples/declarative/particles/custom/fallingleaves.qml58
1 files changed, 50 insertions, 8 deletions
diff --git a/examples/declarative/particles/custom/fallingleaves.qml b/examples/declarative/particles/custom/fallingleaves.qml
index 3572490451..91c64961cb 100644
--- a/examples/declarative/particles/custom/fallingleaves.qml
+++ b/examples/declarative/particles/custom/fallingleaves.qml
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** 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 QtQuick.Particles 2.0
@@ -53,6 +93,7 @@ Item {
particle.r -= particle.rotation * coefficient;
if (particle.r == 0.0)
particle.r -= particle.rotation * 0.000001;
+ particle.update = 1;
}
}
@@ -65,16 +106,17 @@ Item {
anchors.bottom: parent.bottom
onAffectParticle:{
var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
- var yslow = pseudoRand * 0.001 + 1.01;
- var xslow = pseudoRand * 0.0005 + 1.0;
- if (particle.curVY < 1)
- particle.curVY == 0;
+ var yslow = pseudoRand * 0.01 + 1.01;
+ var xslow = pseudoRand * 0.005 + 1.0;
+ if (particle.vy < 1)
+ particle.vy = 0;
else
- particle.curVY = (particle.curVY / yslow);
- if (particle.curVX < 1)
- particle.curVX == 0;
+ particle.vy = (particle.vy / yslow);
+ if (particle.vx < 1)
+ particle.vx = 0;
else
- particle.curVX = (particle.curVX / xslow);
+ particle.vx = (particle.vx / xslow);
+ particle.update = 1;
}
}
ImageParticle{