aboutsummaryrefslogtreecommitdiffstats
path: root/launcher/qml/AnimationBar.qml
blob: 0495c4dd715cd9751c6d59281451922e614e3a13 (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
import QtQuick 2.0

Image {
    id: root
    width: 1080
    height: 70
    source: './images/Screentransition_bar.png'
    state: 'release'
    property int index: 0

    ListModel {
        id: model
        ListElement {
            name: "0"
            picturePath: './images/BG_undericon2.svg'
        }
        ListElement {
            name: "1"
            picturePath: './images/BG_undericon1.svg'
        }
        ListElement {
            name: "2"
            picturePath: './images/BG_undericon3.svg'
        }
        ListElement {
            name: "3"
            picturePath: './images/BG_undericon4.svg'
        }
    }

    Timer {
        id: animationTimer
        interval: 250
        running: false
        repeat: true
        onTriggered: {
                if (index < model.count) {
                    aniImage.source = model.get(index).picturePath
                    index++;
                    if (index == model.count)
                        index = 0
                }
        }
    }

    Image {
        id: aniImage
        anchors.centerIn: parent
    }

    function startAnimationTimer() {
        animationTimer.restart()
        console.log("animationTimer.start()")
    }

    function stopAnimationTimer() {
        animationTimer.stop()
        console.log("animationTimer.stop()")
    }

    states: [
        State {
            name: 'release'
            PropertyChanges {
                target: root
                y: 1704
            }
        },
        State {
            name: 'press'
            PropertyChanges {
                target: root
                y: 1634
            }
        }
    ]
    transitions: Transition {
        NumberAnimation {
            target: root
            property: 'y'
            easing.type: 'OutQuad'
            duration: 450
        }
    }
}