aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/timelineTestApp/test10.qml
blob: 32c202c770a1dee180b8ce375b2e48a39a2963b9 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.0
// Note: KeyframeGroup keyframeSource requires 1.1 version
import QtQuick.Timeline 1.1

Item {
    id: rootItem
    property vector3d v3: Qt.vector3d(0,0,0)

    Rectangle {
        id: rectangle1
        anchors.verticalCenter: parent.verticalCenter
        anchors.left: parent.left
        anchors.leftMargin: 10
        width: 120
        height: 120
        color: "red"
        radius: width / 2
    }
    Rectangle {
        id: rectangle2
        anchors.verticalCenter: parent.verticalCenter
        anchors.right: parent.right
        anchors.rightMargin: 10
        width: 120
        height: 120
        color: "blue"
        radius: width / 2
    }
    Rectangle {
        id: rectangle3
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        width: 120
        height: 120
        color: "black"
        radius: width / 2
    }
    Text {
        font.pixelSize: 20
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.top: parent.top
        anchors.topMargin: 10
        text: "value: " + (rootItem.v3.x).toFixed(2)
              + ", " + (rootItem.v3.y).toFixed(2)
              + ", " + (rootItem.v3.z).toFixed(2)
        color: "black"
    }

    Timeline {
        id: timeline1
        enabled: true
        startFrame: 0
        endFrame: 1000

        animations: [
            TimelineAnimation {
                running: true
                duration: 2000
                from: 0
                to: 2000
                loops: Animation.Infinite
            }
        ]
        KeyframeGroup {
            target: rectangle1
            property: "opacity"
            keyframeSource: "animate_real.cbor"
        }
    }

    Timeline {
        id: timeline2
        enabled: true
        startFrame: 0
        endFrame: 2000

        animations: [
            TimelineAnimation {
                running: true
                duration: 2000
                from: 0
                to: 2000
                loops: Animation.Infinite
            }
        ]
        KeyframeGroup {
            target: rectangle2
            property: "visible"
            keyframeSource: "animate_bool.cbor"
        }
    }

    Timeline {
        id: timeline3
        enabled: true
        startFrame: 0
        endFrame: 2000

        animations: [
            TimelineAnimation {
                running: true
                duration: 2000
                from: 0
                to: 2000
                loops: Animation.Infinite
            }
        ]
        KeyframeGroup {
            target: rectangle3
            property: "color"
            keyframeSource: "animate_color.cbor"
        }
    }

    Timeline {
        id: timeline4
        enabled: true
        startFrame: 0
        endFrame: 2000

        animations: [
            TimelineAnimation {
                running: true
                duration: 10000
                from: 0
                to: 2000
                loops: Animation.Infinite
            }
        ]
        KeyframeGroup {
            target: rootItem
            property: "v3"
            keyframeSource: "animate_vector3d.cbor"
        }
    }
}