-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (19 loc) · 749 Bytes
/
Copy pathscript.js
File metadata and controls
30 lines (19 loc) · 749 Bytes
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
const deg = 6;
const secondHand = document.querySelector('.sec');
const minsHand = document.querySelector('.min');
const hourHand = document.querySelector('.hour');
setInterval(() => {
const now = new Date();
const hours = now.getHours() * 30 ;
const mins = now.getMinutes() * deg ;
const seconds = now.getSeconds() * deg ;
const hoursDegree = (hours) + (mins / 12);
hourHand.style.transform = `rotateZ(${hoursDegree}deg)`;
minsHand.style.transform = `rotate(${mins}deg)`;
secondHand.style.transform = `rotate(${seconds}deg)`;
}, 1000);
// Toggle Function goes here
function toggleFunction() {
const element = document.body;
element.classList.toggle("light-mode");
}