aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/particles/system/multiplepainters.qml
blob: 5356f5fe8a8625fd3159a99e709d3979572e4efd (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Particles

Rectangle {
    id: root
    width: 360
    height: 600
    color: "darkblue"
    property bool cloneMode: false
    ParticleSystem {
        id: sys
    }
    TapHandler {
        onTapped: root.cloneMode = !root.cloneMode
    }
    Text {
        anchors.horizontalCenter: parent.horizontalCenter
        text: qsTr("Click to Toggle")
        color: "white"
        font.pixelSize: 24
    }
    Emitter {
        system: sys
        y:root.height + 20
        width: root.width
        emitRate: 200
        lifeSpan: 4000
        startTime: 4000
        velocity: PointDirection { y: -120 }
    }

    ImageParticle {
        system: sys
        visible: !root.cloneMode
        source: "images/particle2.png"
    }

    ImageParticle {
        system: sys
        visible: root.cloneMode
        z: 0
        source: "images/particle3.png"
    }

    ImageParticle {
        system: sys
        clip: true
        visible: root.cloneMode
        y: 120
        height: 240
        width: root.width
        z: 1
        source: "qrc:///particleresources/glowdot.png"
    }
}