Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / examples / declarative / particles / affectors / turbulence.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the examples of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 **   * Redistributions of source code must retain the above copyright
15 **     notice, this list of conditions and the following disclaimer.
16 **   * Redistributions in binary form must reproduce the above copyright
17 **     notice, this list of conditions and the following disclaimer in
18 **     the documentation and/or other materials provided with the
19 **     distribution.
20 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
21 **     the names of its contributors may be used to endorse or promote
22 **     products derived from this software without specific prior written
23 **     permission.
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40
41 import QtQuick 2.0
42 import QtQuick.Particles 2.0
43
44 Rectangle {
45     width: 360
46     height: 600
47     color: "#222222"
48     id: root
49     Image {
50         source: "../images/candle.png"
51         anchors.bottom: parent.bottom
52         anchors.horizontalCenter: parent.horizontalCenter
53         anchors.bottomMargin: -8
54         anchors.horizontalCenterOffset: 2
55     }
56     ParticleSystem {
57         id: ps
58     }
59     MouseArea {
60         anchors.fill: parent
61         onClicked: turb.enabled = !turb.enabled
62     }
63
64     Turbulence {
65         id: turb
66         system: ps
67         enabled: true
68         height: (parent.height / 2)
69         width: parent.width / 2
70         x: parent. width / 4
71         anchors.fill: parent
72         strength: 32
73     }
74
75     ImageParticle {
76         groups: ["smoke"]
77         system: ps
78         source: "../images/particle.png"
79         color: "#11111111"
80         colorVariation: 0
81     }
82     ImageParticle {
83         groups: ["flame"]
84         system: ps
85         source: "../images/particle.png"
86         color: "#11ff400f"
87         colorVariation: 0.1
88     }
89     Emitter {
90         anchors.centerIn: parent
91         system: ps
92         group: "flame"
93         
94         emitRate: 120
95         lifeSpan: 1200
96         size: 20
97         endSize: 10
98         sizeVariation: 10
99         acceleration: PointDirection { y: -40 }
100         speed: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
101     }
102     TrailEmitter {
103         id: smoke1
104         width: root.width
105         height: root.height/2 - 20
106         system: ps
107         group: "smoke"
108         follow: "flame"
109
110         emitRatePerParticle: 1
111         lifeSpan: 2400
112         lifeSpanVariation: 400
113         size: 16
114         endSize: 8
115         sizeVariation: 8
116         acceleration: PointDirection { y: -40 }
117         speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
118     }
119     TrailEmitter {
120         id: smoke2
121         width: root.width
122         height: root.height/2 - 40
123         system: ps
124         group: "smoke"
125         follow: "flame"
126         
127         emitRatePerParticle: 4
128         lifeSpan: 2400
129         size: 36
130         endSize: 24
131         sizeVariation: 12
132         acceleration: PointDirection { y: -40 }
133         speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
134     }
135 }