-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (31 loc) · 1.3 KB
/
script.js
File metadata and controls
40 lines (31 loc) · 1.3 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
window.onload = function () {
let Sound = new Audio();
Sound.src = 'sounds/sound_effect.mp3';
let date = new Date();
let secsHand = document.getElementById('secsHand');
let Secs = 6 * 15 + 6 * date.getSeconds();
setInterval(function () {
secsHand.style.transform = `rotate(${Secs}deg)`;
Secs += 6;
Sound.play();
}, 1000);
secsHand.style.transform = `rotate(${Secs}deg)`;
let minsHand = document.getElementById('minsHand');
let Mins = 6 * 15 + 6 * date.getMinutes();
setInterval(function () {
minsHand.style.transform = `rotate(${Mins}deg)`;
Mins += 0.1;
}, 1000);
minsHand.style.transform = `rotate(${Mins}deg)`;
let horsHand = document.getElementById('horsHand');
let Hors = ((6*15 + 6 * date.getHours()) * 5) + (date.getMinutes()/2);
// setInterval(function(){horsHand.style.transform = `rotate(${Hors}deg)`;
// Hors += 1;
// } , (60 * 60 * 1000) / 5 / 6);
// let Hors = (30 * date.getHours()) + (0.5 * date.getMinutes());
setInterval(function () {
horsHand.style.transform = `rotate(${Hors}deg)`;
Hors += 0.5; // 0.5 degrees per minute
}, (60 * 1000) / 2); // Update every minute
horsHand.style.transform = `rotate(${Hors}deg)`;
}