summaryrefslogtreecommitdiffstats
path: root/examples/demos/samegame/content/LogoAnimation.qml
blob: ae96eca610d7efcd5b8436638ec90bfdce303ec3 (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Particles

Item {
    id: container //Positioned where the 48x48 S/G should be
    property alias running: mainAnim.running
    property ParticleSystem particleSystem
    property int dur: 500
    signal boomTime
    Image {
        id: s1
        source: "gfx/logo-s.png"
        y: 0
    }
    Image {
        id: g1
        source: "gfx/logo-g.png"
        y: -128
    }
    Column {
        Repeater {
            model: 2
            Item {
                width: 48
                height: 48
                BlockEmitter {
                    id: emitter
                    anchors.fill: parent
                    group: "red"
                    system: container.particleSystem
                    Connections {
                        target: container
                        function onBoomTime() {
                            emitter.pulse(100);
                        }
                    }
                }
            }
        }
    }
    SequentialAnimation {
        id: mainAnim
        running: true
        loops: -1
        PropertyAction { target: g1; property: "y"; value: -128}
        PropertyAction { target: g1; property: "opacity"; value: 1}
        PropertyAction { target: s1; property: "y"; value: 0}
        PropertyAction { target: s1; property: "opacity"; value: 1}
        NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: container.dur}
        ParallelAnimation {
            NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: container.dur}
            NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: container.dur }
        }
        PauseAnimation { duration: container.dur }
        ScriptAction { script: container.boomTime(); }
        ParallelAnimation {
            NumberAnimation { target: g1; property: "opacity"; to: 0; duration: container.dur }
            NumberAnimation { target: s1; property: "opacity"; to: 0; duration: container.dur }
        }
        PropertyAction { target: s1; property: "y"; value: -128}
        PropertyAction { target: s1; property: "opacity"; value: 1}
        NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: container.dur * 2}
    }
}