1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the examples of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:BSD$
9
** You may use this file under the terms of the BSD license as follows:
11
** "Redistribution and use in source and binary forms, with or without
12
** modification, are permitted provided that the following conditions are
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
20
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21
** of its contributors may be used to endorse or promote products derived
22
** from this software without specific prior written permission.
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."
39
****************************************************************************/
42
import QtQuick.Particles 2.0
43
import "content/script.js" as Script
57
Behavior on opacity {NumberAnimation {}}
60
anchors.centerIn: parent
72
height: parent.height - 132/2
75
velocity: PointDirection { x: 32; xVariation: 8 }
77
lifeSpan: Emitter.InfiniteLife
82
x: parent.width + 132/2
89
source: "../trails/../images/star.png"
90
color: "lightsteelblue"
107
NumberAnimation on scale {
114
source: "../asteroid/../images/rocket.png"
115
anchors.centerIn: parent
118
anchors.bottom: parent.bottom
119
anchors.horizontalCenter: parent.horizontalCenter
120
text: "A new ship has arrived!"
124
property Item alertItem;
126
//resetter.active = false
128
alertItem = alertDelegate.createObject(root);
129
alertItem.x = root.width/2 - alertItem.width/2
130
alertItem.y = root.height/2 - alertItem.height/2
131
spawnFireworks.pulse(200);
135
Keys.onSpacePressed: alert();
143
//resetter.active = true;
144
mp.take(alertItem, true);
145
centerEmitter.burst(1);
152
pointY: root.height/2
155
anchors.centerIn: parent
156
width: parent.width/2
157
height: parent.height/2
159
affectedParameter: Attractor.Position
163
velocity: PointDirection { x: 32; xVariation: 8;}
165
lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
169
anchors.centerIn: parent
172
//TODO: Zoom in effect
182
y: parent.height/2 - 64
188
velocity: AngleDirection { magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
189
acceleration: PointDirection { y: 160 }
191
Item { x: -1000; y: -1000 //offscreen
192
Repeater {//Load them here, add to system on completed
194
delegate: theDelegate
197
RssModel {id: theModel; tags:"particle,particles"}
204
property real myRand: Math.random();//'depth'
205
z: Math.floor(myRand * 100)
206
scale: (myRand + 1.0)/2;
207
//TODO: Darken based on 'depth'
210
//ItemParticle.onAttached: console.log("I'm in" + x + "," + y + ":" + opacity);
211
ItemParticle.onDetached: mp.take(container);//respawns
214
if (state == "selected") {
215
console.log("Taking " + index);
216
mp.freeze(container);
218
console.log("Returning " +index);
219
mp.unfreeze(container);
224
anchors.centerIn: parent
226
source: "http://" + Script.getImagePath(content); cache: true
227
fillMode: Image.PreserveAspectFit;
228
width: parent.width-4; height: parent.height-4
229
onStatusChanged: if (img.status == Image.Ready) {
235
anchors.bottom: parent.bottom
237
horizontalAlignment: Text.AlignHCenter
238
elide: Text.ElideRight
244
onClicked: container.state == "selected" ? container.state = "" : container.state = "selected"
263
transitions: Transition {
266
SequentialAnimation {
267
ScriptAction {script: container.manage();}
269
ParentAnimation {NumberAnimation { properties: "x,y" }}//Doesn't work, particles takes control of x,y instantly
270
NumberAnimation { properties: "width, height, z, rotation" }