summaryrefslogtreecommitdiffstats
path: root/QtDemo/qml/QtDemo/SplashScreen.qml
blob: 5fe8edf34e802712b57f7f247febdbf30dcde14b (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
import QtQuick 2.0
import QtQuick.Particles 2.0
//based on the SmokeText component from SameGame

Item {
    id: root
    anchors.fill: parent
    z:1

    property alias text: txt.text

    Rectangle{
        id: background
        anchors.fill:parent
        color: "black"
    }

    ParticleSystem{
        id: particleSystem;
        anchors.fill: parent

        Text {
            id: txt
            color: 'white'
            font.pixelSize: parent.width *.13
            font.family: "Purisa"
            font.bold: true
            anchors.centerIn: parent
            smooth: true
        }

        Emitter {
            id: emitter
            anchors.fill: txt
            enabled: false
            emitRate: 1000
            lifeSpan: 1500
            size: parent.height * .2
            endSize: parent.height * .1
            velocity: AngleDirection { angleVariation: 360; magnitudeVariation: 160 }
        }

        ImageParticle {
            id: smokeParticle
            source: "images/particle-smoke.png"
            alpha: 0.1
            alphaVariation: 0.1
            color: 'white'
        }
    }

    SequentialAnimation {
        id: anim
        running: false
        ScriptAction { script: emitter.pulse(100); }
        NumberAnimation { target: txt; property: "opacity"; from: 1.0; to: 0.0; duration: 400}
        NumberAnimation { target: background; property: "opacity"; from: 1.0; to: 0.0; duration: 1000}
        PauseAnimation { duration: 200 }
        onRunningChanged: if (!running) root.destroy();
    }

    function explode(){
        anim.restart()
    }
}