summaryrefslogtreecommitdiffstats
path: root/examples/declarative/particles/AllSmiles/SpriteStateParticles.qml
blob: 58cab2454c8cf86c6b0a0b0d66028541110af127 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import QtQuick 2.0
import Qt.labs.particles 2.0

Rectangle{
    color: "goldenrod"
    width: 800
    height: 800
    id: root
    SpriteImage{
        sprites: [Sprite{
            name: "happy"
            source: "squarefacesprite2.png"
            frames: 6
            duration: 120
            to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0}
        }, Sprite{
            name: "silly"
            source: "squarefacesprite.png"
            frames: 6
            duration: 120
            to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2}
        }, Sprite{
            name: "sad"
            source: "squarefacesprite3.png"
            frames: 6
            duration: 120
            to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2}
        }, Sprite{
            name: "cyclops"
            source: "squarefacesprite4.png"
            frames: 6
            duration: 120
            to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0}
        }, Sprite{
            name: "evil"
            source: "squarefacesprite5.png"
            frames: 6
            duration: 120
            to: {"happy": 1.0}
        }, Sprite{
            name: "love"
            source: "squarefacesprite6.png"
            frames: 6
            duration: 120
            to: {"sad": 0.6, "evil":0.4, "boggled":0.2}
        }, Sprite{
            name: "boggled"
            source: "squarefacesprite7.png"
            frames: 6
            duration: 120
            to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2}
        }, Sprite{
            name: "dying"
            source: "squarefacespriteX.png"
            frames: 4
            duration: 120
            to: {"dead":1.0}
        }, Sprite{
            name: "dead"
            source: "squarefacespriteXX.png"
            frames: 1
            duration: 10000
        }]

        width: 100
        height: 100
        x: 20
        y: 20
        z:4
    }
    ParticleSystem{ id: sys }
    SpriteParticle{
        anchors.fill: parent
        id: particles
        system: sys
        sprites: [Sprite{
            name: "happy"
            source: "squarefacesprite2.png"
            frames: 6
            duration: 120
            to: {"silly": 0.4, "sad": 0.2, "cyclops":0.1, "boggled":0.3, "dying":0.0}
        }, Sprite{
            name: "silly"
            source: "squarefacesprite.png"
            frames: 6
            duration: 120
            to: {"love": 0.4, "happy": 0.1, "evil": 0.2, "cyclops":0.1, "boggled":0.2}
        }, Sprite{
            name: "sad"
            source: "squarefacesprite3.png"
            frames: 6
            duration: 120
            to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.2, "boggled":0.2}
        }, Sprite{
            name: "cyclops"
            source: "squarefacesprite4.png"
            frames: 6
            duration: 120
            to: {"love": 0.1, "evil": 0.1, "silly":0.1, "boggled":0.1, "cyclops" : 1.0}
        }, Sprite{
            name: "evil"
            source: "squarefacesprite5.png"
            frames: 6
            duration: 120
            to: {"happy": 1.0}
        }, Sprite{
            name: "love"
            source: "squarefacesprite6.png"
            frames: 6
            duration: 120
            to: {"sad": 0.6, "evil":0.4, "boggled":0.2}
        }, Sprite{
            name: "boggled"
            source: "squarefacesprite7.png"
            frames: 6
            duration: 120
            to: {"love" : 0.2, "evil": 0.2, "silly": 0.2, "cyclops":0.1, "sad":0.2}
        }, Sprite{
            name: "dying"
            source: "squarefacespriteX.png"
            frames: 4
            duration: 120
            to: {"dead":1.0}
        }, Sprite{
            name: "dead"
            source: "squarefacespriteXX.png"
            frames: 1
            duration: 10000
        }]
    }
    TrailEmitter{
        system: sys
        particlesPerSecond: 16
        particleDuration: 10000
        emitting: true
        speed: AngleVector{angle: 90; magnitude: 60; angleVariation: 5}
        acceleration: PointVector{ y: 10 }
        particleSize: 30
        particleSizeVariation: 10
        width: parent.width
        height: 100
    }
    SpriteGoal{
        system: sys
        width: root.width;
        height: root.height/2;
        y: root.height/2;
        goalState:"dead"
    }
}