Skip to content

Commit 919ff24

Browse files
authored
Merge pull request #674 from anuragnotfound/main
added digital-clock
2 parents d7efd32 + de71cb1 commit 919ff24

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

digital-clock/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<link rel="stylesheet" href="./style.css">
5+
<script src="./script.js" defer></script>
6+
</head>
7+
<body>
8+
<div class="wrapper">
9+
<div class="display">
10+
<div id="time">
11+
</div>
12+
</div>
13+
<span></span>
14+
<span></span>
15+
</div>
16+
</body>
17+
</html>

digital-clock/script.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
setInterval(()=>{
2+
const time = document.querySelector(".display #time");
3+
let date = new Date();
4+
let hours = date.getHours();
5+
let minutes = date.getMinutes();
6+
let seconds = date.getSeconds();
7+
let day_night = "AM";
8+
if(hours > 12){
9+
day_night = "PM";
10+
hours = hours - 12;
11+
}
12+
if(seconds < 10){
13+
seconds = "0" + seconds;
14+
}
15+
if(minutes < 10){
16+
minutes = "0" + minutes;
17+
}
18+
if(hours < 10){
19+
hours = "0" + hours;
20+
}
21+
time.textContent = hours + ":" + minutes + ":" + seconds + " "+ day_night;
22+
});
23+

digital-clock/style.css

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
*{
2+
margin: 0;
3+
padding: 0;
4+
font-family: 'Poppins', sans-serif;
5+
6+
7+
}
8+
9+
html,body{
10+
display: grid;
11+
height: 100%;
12+
place-items: center;
13+
background: #000;
14+
}
15+
.wrapper{
16+
height: 100px;
17+
width: 360px;
18+
position: relative;
19+
background: linear-gradient(135deg, #14ffe9, #ffeb3b, #ff00e0);
20+
border-radius: 10px;
21+
cursor: default;
22+
animation: animate 1.5s linear infinite;
23+
}
24+
.wrapper .display,
25+
.wrapper span{
26+
position: absolute;
27+
top: 50%;
28+
left: 50%;
29+
transform: translate(-50%, -50%);
30+
}
31+
.wrapper .display{
32+
z-index: 999;
33+
height: 85px;
34+
width: 345px;
35+
background: #1b1b1b;
36+
border-radius: 6px;
37+
text-align: center;
38+
}
39+
.display #time{
40+
line-height: 85px;
41+
color: #fff;
42+
font-size: 50px;
43+
font-weight: 600;
44+
letter-spacing: 1px;
45+
background: linear-gradient(135deg, #14ffe9, #ffeb3b, #ff00e0);
46+
-webkit-background-clip: text;
47+
-webkit-text-fill-color: transparent;
48+
animation: animate 1.5s linear infinite;
49+
}
50+
@keyframes animate {
51+
100%{
52+
filter: hue-rotate(360deg);
53+
}
54+
}
55+
.wrapper span{
56+
height: 100%;
57+
width: 100%;
58+
border-radius: 10px;
59+
background: inherit;
60+
}
61+
.wrapper span:first-child{
62+
filter: blur(7px);
63+
}
64+
.wrapper span:last-child{
65+
filter: blur(20px);
66+
}
67+
68+
69+
.date{
70+
background: #ffffff;
71+
font-size: 20px;
72+
font-weight: 600;
73+
text-align: center;
74+
letter-spacing: 3px;
75+
76+
}

0 commit comments

Comments
 (0)