aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/lineparticles/qml/LineEmitter.qml
blob: b46a10edb66bfd6893bda5369cd718a5b0e03532 (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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick3D
import QtQuick3D.Particles3D
import QtQuick3D.Helpers


Node {
    id: root
    property alias emitterPosition : emitter.position
    property alias emitterScale : emitter.scale
    property alias emitRate : emitter.emitRate
    property alias particleCount : particle.maxAmount
    property real particleOpacity : 1.0
    property bool textureEnabled : false
    property bool variableLengthEnabled : false
    property alias lineSegmentCount : particle.segmentCount
    property alias particleScale : particle.particleScale
    property alias particleTexcoordMode : particle.texcoordMode
    property alias particleTexcoordScale : particle.texcoordMultiplier
    property alias particleEolFadeDuration : particle.eolFadeOutDuration
    property real lineLength : 50.0
    property alias lifespan : emitter.lifeSpan
    property real velocityX : 120.0
    property real velocityY : 0.0
    property real velocityZ : 0.0
    property real velocityVariation : 5.0
    property var system
    property string description : "desc"
    property real fontSize : 14.0
    property alias fadeOutDuration : particle.fadeOutDuration
    property alias fadeInDuration : particle.fadeInDuration

    ParticleEmitter3D {
        id: emitter
        system: root.system
        Texture {
            id: tex
            source: "images/qt_logo.png"
        }
        particle: LineParticle3D {
            id: particle
            sprite: textureEnabled ? tex : null
            maxAmount: 20
            color: Qt.rgba(1.0, 1.0, 1.0, particleOpacity)
            fadeInDuration: 0
            fadeOutDuration: 500
            texcoordMode: LineParticle3D.Relative
            billboard: false
            length: variableLengthEnabled ? -1.0 : root.lineLength
            lengthDeltaMin: variableLengthEnabled ? root.lineLength / root.lineSegmentCount : 10.0
            eolFadeOutDuration: 0
            particleScale: 20.0
            segmentCount: 5
        }
        velocity: VectorDirection3D {
            direction: Qt.vector3d(root.velocityX, root.velocityY, root.velocityZ)
            directionVariation: Qt.vector3d(root.velocityVariation, root.velocityVariation, root.velocityVariation)
        }
        emitRate: 2
        lifeSpan: 3000
        Text {
            x: -100
            text: description
            font.pixelSize: root.fontSize
            color: "white"
        }
    }
}