-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCenterStack.qml
57 lines (51 loc) · 1.37 KB
/
CenterStack.qml
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
import QtQuick 2.6
Item {
id: centerStack
property int viewIndex: 4
height: root.height - 173
width: root.width / 2
clip: true
property alias fadeOutCenter: fadeOutCenter
property alias fadeInCenter: fadeInCenter
property alias loader: loader
Loader {
id: loader
onStatusChanged: {
if (status == Loader.Ready)
fadeInCenter.start()
}
anchors.fill: parent
}
PropertyAnimation {
id: fadeInCenter
target: loader
property: "opacity"
from: 0.0
to: 1.0
duration: 400
easing.type: Easing.Linear
}
PropertyAnimation {
id: fadeOutCenter
property: "opacity"
from: 1.0
to: 0.0
duration: 250
easing.type: Easing.Linear
onStopped: {
if (target === car) {
car.visible = false
car.item.hidden = true
}
if (centerStack.viewIndex === carviewindex) {
car.visible = true
fadeInCenter.target = car
car.item.hidden = false
fadeInCenter.start()
}else {
fadeInCenter.target = loader
}
loader.source = component[centerStack.viewIndex]
}
}
}