blob: cf64d4868955257f439422af77ae58517ecffb9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Particles
Item {
id: window
width: 320; height: 480
Rectangle {
id: sky
anchors.fill: parent
gradient: Gradient {
GradientStop {
position: 0.0
color: "DeepSkyBlue"
}
GradientStop {
position: 1.0
color: "SkyBlue"
}
}
}
Rectangle {
id: ground
width: parent.height * 2
height: parent.height
y: parent.height/2
x: parent.width/2 - parent.height
transformOrigin: Item.Top
rotation: 0
gradient: Gradient {
GradientStop { position: 0.0; color: "ForestGreen"; }
GradientStop { position: 1.0; color: "DarkGreen"; }
}
}
MouseArea {
anchors.fill: parent
onPositionChanged: {
var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI;
ground.rotation = rot;
}
}
ParticleSystem { id: sys }
//! [0]
Gravity {
system: sys
magnitude: 32
angle: ground.rotation + 90
}
//! [0]
Emitter {
system: sys
anchors.centerIn: parent
emitRate: 1
lifeSpan: 10000
size: 64
}
ImageParticle {
anchors.fill: parent
system: sys
source: "images/realLeaf1.png"
}
}
|