-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
69 lines (58 loc) · 1.46 KB
/
main.js
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
p = document.querySelector("p")
h = document.querySelector(".h")
min = document.querySelector(".min")
sec = document.querySelector(".sec")
btn = document.querySelector(".btn")
function ustawCzas(){
let time = new Date()
var timeH;
if(time.getHours() < 10)
{
timeH = "0" + time.getHours();
}
else
{
timeH = time.getHours()
}
if(time.getMinutes() < 10)
{
timeM = "0" + time.getMinutes();
}
else
{
timeM = time.getMinutes()
}
if(time.getSeconds() < 10)
{
timeS = "0" + time.getSeconds();
}
else
{
timeS = time.getSeconds()
}
p.innerHTML = timeH + ":" + timeM + ":" + timeS
}
setInterval(() => {
ustawCzas()
// h.style.transform = "rotate(-180deg)"
let data = new Date()
let cyfH = data.getHours
let cyfM = data.getMinutes
let cyfS = data.getSeconds
sec.style.transform = `rotate(180deg)`;
hours = data.getHours() * 30
minutes = (data.getMinutes() * 6) + 1
seconds = (data.getSeconds() * 6)
// if(data.getSeconds() > 0 && seconds <= )
// {
// sec.style.transform = `rotate(90deg)`;
// }
console.log(seconds);
h.style.transform = `rotate(${hours}deg)`
sec.style.transform = `rotate(${seconds}deg)`
min.style.transform = `rotate(${minutes}deg)`
}, 1000);
// btn.addEventListener("click", () =>{
// i = i + 3
// h.style.transform = `rotate(${i}deg)`
// })