b225b59d6a137b4289e7a1f3f3e29e89999c14d7
[profile/ivi/qtdeclarative.git] / examples / particles / emitters / content / trailemitter.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     id: root
46     width: 360
47     height: 540
48     color: "black"
49
50     ParticleSystem {
51         id: particles
52     }
53
54     ImageParticle {
55         id: smoke
56         system: particles
57         anchors.fill: parent
58         groups: ["A", "B"]
59         source: "../../images/particle.png"
60         colorVariation: 0
61         color: "#00111111"
62     }
63     ImageParticle {
64         id: flame
65         anchors.fill: parent
66         system: particles
67         groups: ["C", "D"]
68         source: "../../images/particle.png"
69         colorVariation: 0.1
70         color: "#00ff400f"
71     }
72
73     Emitter {
74         id: fire
75         system: particles
76         group: "C"
77
78         y: parent.height
79         width: parent.width
80
81         emitRate: 350
82         lifeSpan: 3500
83
84         acceleration: PointDirection { y: -17; xVariation: 3 }
85         velocity: PointDirection {xVariation: 3}
86
87         size: 24
88         sizeVariation: 8
89         endSize: 4
90     }
91
92     TrailEmitter {
93         id: fireSmoke
94         group: "B"
95         system: particles
96         follow: "C"
97         width: root.width
98         height: root.height - 68
99
100         emitRatePerParticle: 1
101         lifeSpan: 2000
102
103         velocity: PointDirection {y:-17*6; yVariation: -17; xVariation: 3}
104         acceleration: PointDirection {xVariation: 3}
105
106         size: 36
107         sizeVariation: 8
108         endSize: 16
109     }
110
111     TrailEmitter {
112         id: fireballFlame
113         anchors.fill: parent
114         system: particles
115         group: "D"
116         follow: "E"
117
118         emitRatePerParticle: 120
119         lifeSpan: 180
120         emitWidth: TrailEmitter.ParticleSize
121         emitHeight: TrailEmitter.ParticleSize
122         emitShape: EllipseShape{}
123
124         size: 16
125         sizeVariation: 4
126         endSize: 4
127     }
128     
129     TrailEmitter {
130         id: fireballSmoke
131         anchors.fill: parent
132         system: particles
133         group: "A"
134         follow: "E"
135
136         emitRatePerParticle: 128
137         lifeSpan: 2400
138         emitWidth: TrailEmitter.ParticleSize
139         emitHeight: TrailEmitter.ParticleSize
140         emitShape: EllipseShape{}
141
142         velocity: PointDirection {yVariation: 16; xVariation: 16}
143         acceleration: PointDirection {y: -16}
144
145         size: 24
146         sizeVariation: 8
147         endSize: 8
148     }
149
150     Emitter {
151         id: balls
152         system: particles
153         group: "E"
154
155         y: parent.height
156         width: parent.width
157
158         emitRate: 2
159         lifeSpan: 7000
160
161         velocity: PointDirection {y:-17*4*2; xVariation: 6*6}
162         acceleration: PointDirection {y: 17*2; xVariation: 6*6}
163
164         size: 8
165         sizeVariation: 4
166     }
167
168     Turbulence { //A bit of turbulence makes the smoke look better
169         anchors.fill: parent
170         groups: ["A","B"]
171         strength: 32
172         system: particles
173     }
174 }
175