-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcoolclock.html
126 lines (106 loc) · 2.01 KB
/
coolclock.html
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
<!DOCTYPE html>
<html>
<head>
<title>hello</title>
<style>
body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
color: white;
background: black;
}
.wrapper {
position: relative;
height: 100px;
width: 360px;
background: linear-gradient(135deg, #14ffe9, #ffed3b, #ff00e0);
border-radius: 10px;
font-family: 'poppins', sans-serif;
}
.display,
span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.display {
z-index: 999;
height: 85px;
width: 345px;
background: #1b1b1b;
border-radius: 6px;
text-align: center;
}
#time {
line-height: 85px;
color: #fff;
font-size: 50px;
font-weight: 600;
letter-spacing: 1px;
background: linear-gradient(135deg, #14ffe9, #ffeb3b, #ff00e0);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.wrapper,
#time {
animation: animate 1.5s linear infinite;
}
@keyframes animate {
100% {
filter: hue-rotate(360deg);
}
}
span {
height: 100%;
width: 100%;
border-radius: 10px;
background: inherit;
}
span:first-child {
filter: blur(7px);
}
span:last-child {
filter: blur(20px);
}
</style>
<script>
window.onload = function() {
const timeElement = document.getElementById('time');
function update() {
const date = new Date();
let hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
let ampm = 'AM';
if (hours >= 12) {
ampm = 'PM';
hours = hours % 12;
}
hours = hours ? hours : 12; // the hour '0' should be '12'
timeElement.textContent =
String(hours).padStart(2, '0') +
':' +
String(minutes).padStart(2, '0') +
':' +
String(seconds).padStart(2, '0') +
' ' +
ampm;
}
setInterval(update, 1000);
}
</script>
</head>
<body>
<div class="wrapper">
<div class="display">
<div id="time">00:00:00 AM</div>
</div>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>