-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
118 lines (115 loc) · 2.82 KB
/
index.html
File metadata and controls
118 lines (115 loc) · 2.82 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Analog Saat</title>
<style type="text/css">
body {
display: flex;
background-color: #0c091d;
}
svg {
/* margin: auto; */
}
.small-lines {
stroke: rgba(169, 114, 255, 0.5);
}
.big-lines {
stroke: #a972ff;
}
.akrep {
transform-origin: 400px 400px;
}
.yelkovan {
transform-origin: 400px 400px;
}
.second {
transform-origin: 400px 400px;
}
/* #numbers {
position: relative;
width: 800px;
height: 800px;
} */
.text {
position: fixed;
font-size: 30px;
color: #fff;
}
</style>
</head>
<body>
<svg width="800" height="800">
<circle
class="small-lines"
cx="400"
cy="400"
r="365"
stroke-width="20"
stroke-dasharray="2,36.2"
fill="none"
></circle>
<circle
class="big-lines"
cx="400"
cy="400"
r="350"
stroke-width="50"
stroke-dasharray="8,175.1666"
fill="none"
></circle>
<line
class="second"
x1="400"
y1="400"
x2="400"
y2="50"
stroke="red"
></line>
<line
class="yelkovan"
x1="400"
y1="400"
x2="400"
y2="150"
stroke="#E81C6F"
stroke-width="5"
></line>
<line
class="akrep"
x1="400"
y1="400"
x2="400"
y2="250"
stroke="#E81C6F"
stroke-width="10"
></line>
</svg>
<div id="numbers"></div>
<script>
let numbersDiv = document.getElementById("numbers");
for (let i = 0; i < 12; i++) {
let numberDiv = document.createElement("div");
numberDiv.classList.add("text");
numberDiv.innerText = i + 1;
let ang = (((i + 1) * 30 - 90) / 180) * Math.PI;
numberDiv.style.left = `${Math.cos(ang) * 300 + 400}px`;
numberDiv.style.top = `${Math.sin(ang) * 300 + 400}px`;
numbersDiv.appendChild(numberDiv);
}
function timeFnc() {
let now = new Date();
let akrep = document.querySelector(".akrep");
akrep.style = `transform: rotate(${now.getHours() * 30}deg)`;
let yelkovan = document.querySelector(".yelkovan");
yelkovan.style = `transform: rotate(${now.getMinutes() * 6}deg)`;
let second = document.querySelector(".second");
second.style = `transform: rotate(${now.getSeconds() * 6}deg)`;
}
setInterval(timeFnc, 1000);
timeFnc();
</script>
</body>
</html>