forked from rschiang/tutorial-slippy-qml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
119 lines (106 loc) · 2.93 KB
/
main.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
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
import QtQuick 2.3
import QtQuick.Window 2.2
Window {
id: window
visible: true
width: 360
height: 360
title: "良辰吉日"
color: "#33b5e5"
// flags: Qt.FramelessWindowHint
AnimatedImage {
id: slippy
anchors.fill: parent
source: "slippy.gif"
}
MouseArea {
anchors.fill: parent
onClicked: {
slippy.paused = !slippy.paused
timer.running = !slippy.paused
if (clickEffect.running)
clickEffect.stop()
clickEffect.start()
}
}
Text {
id: hello
font.pointSize: 32
font.bold: true
font.family: "Roboto"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: '26°'
color: "#fff"
}
Text {
anchors.left: hello.right
anchors.baseline: hello.baseline
text: "C"
color: "#ffffff"
font.pointSize: 16
font.bold: true
font.family: "Roboto"
}
Text {
id: messageText
color: "#fff"
opacity: .65
anchors {
horizontalCenter: parent.horizontalCenter
top: hello.bottom
margins: 8
}
text: "颱風"
}
Text {
id: clock
color: "#fff"
font.pointSize: 24
font.family: "Roboto"
anchors {
horizontalCenter: parent.horizontalCenter
top: messageText.bottom
margins: 16
}
}
Timer {
id: timer
running: true
repeat: true
interval: 1000
onTriggered: {
var date = new Date()
var months = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]
window.title = months[date.getMonth()] + "月十日"
clock.text = date.getHours() + ":" +
date.getMinutes() + ":" +
date.getSeconds()
}
}
ParallelAnimation {
id: clickEffect
NumberAnimation {
target: slippy
property: "opacity"
from: 0.5
to: 1
duration: 2000
easing.type: Easing.OutBack
}
ColorAnimation {
target: window
property: "color"
from: "black"
to: "#33b5e5"
duration: 200
}
NumberAnimation {
target: slippy
property: "scale"
duration: 200
from: 1.1; to: 1
easing.type: Easing.OutExpo
}
}
}