-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
170 lines (141 loc) · 3.85 KB
/
index.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Analog-Watch-Project</title>
</head>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
outline: none;
scroll-behavior: smooth;
color: inherit;
}
section {
position: relative;
height: 100vh;
width: 100%;
overflow: hidden;
background-image: url('sL0htf.jpg');
background-size: cover;
}
.clock {
position: absolute;
top: 10%;
left: 27%;
height: 500px;
width: 500px;
border-radius: 50%;
border: 1px solid black;
}
.clock img {
height: 100%;
width: 100%;
}
.needles {
position: absolute;
height: 0.5px;
width: 35%;
top: 49%;
transform-origin: 100%;
left: 14%;
z-index: 1;
}
.ms{
background-color: slategray;
height: 1.5px;
}
.sec{
background-color: red;
height: 3px;
}
.min{
background-color: grey;
height: 5px;
}
.hour{
background-color: black;
height: 1vh;
}
span{
position: absolute;
height: 4vh;
width: 2vw;
background-color: red;
left: 47.5%;
top: 47.5%;
border-radius: 50%;
z-index: 2;
}
ul{
position: absolute;
top: 54%;
left: 26%;
list-style: none;
display: flex;
align-items: center;
justify-content: space-evenly;
height: 10vh;
width: 20vw;
border-radius: 3px;
background-color: #323232;
}
ul li{
height: 100%;
width: 100%;
color: white;
text-align: center;
line-height: 60px;
text-transform: uppercase;
border-radius: 10px;
font-size: 2.3rem;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
</style>
<body>
<section>
<div class="clock">
<img src="clock-without-arms-clip-art-vector-clip-art-online-royalty-free-png-of-clock-without-hands-600_600.png"
alt="">
<span></span>
<div class="needles ms"></div>
<div class="needles sec"></div>
<div class="needles min"></div>
<div class="needles hour"></div>
<ul>
<li></li>
</ul>
</div>
</section>
</body>
<script>
setInterval(time, 1)
function time() {
var date = new Date()
var m_sec_n = document.querySelector(".ms");
var m_sec = date.getMilliseconds();
var new_mill_sec = ((m_sec / 60) * 360 + 90);
m_sec_n.style.transform = `rotate(${new_mill_sec}deg)`;
var sec_n = document.querySelector(".sec");
var sec = date.getSeconds();
var new_sec = ((sec / 60) * 360 + 90);
sec_n.style.transform = `rotate(${new_sec}deg)`;
var min_n = document.querySelector(".min");
var min = date.getMinutes();
var new_min = ((min / 60) * 360 + 90);
min_n.style.transform = `rotate(${new_min}deg)`;
var hour_n = document.querySelector(".hour");
var hour = date.getHours();
var new_hour = ((hour / 12) * 360 + 90 + (0.5 * min));
hour_n.style.transform = `rotate(${new_hour}deg)`;
var clock_date=document.querySelector("li");
var din=date.toDateString();
clock_date.innerHTML=`${din} `
}
</script>
</html>