-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeScript.js
More file actions
56 lines (49 loc) · 1.68 KB
/
Copy pathTimeScript.js
File metadata and controls
56 lines (49 loc) · 1.68 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
setInterval(Action,1)
setInterval(ChangeColor,1)
setInterval(ChangeBG,10)
setInterval(FontChange,70)
const fonts = ["Tahoma","Heattenschweiler","BlinkMacSystemFont","Brush Script MT","Arial",
"Times New Roman","Courier New","Georgia","Lucida Sans","Fantasy","Trebuchet MS","-apple-system"];
let fontindex=0;
let color=0;
let colorBG=0;
function FormatTime(time){
return (((time>9) ? "" : "0")+time)
}
function Action(){
let time = new Date();
let parsed = "Time right now: "+FormatTime(time.getHours())+":"+FormatTime(time.getMinutes())+":"+FormatTime(time.getSeconds());
document.getElementById("Ms").innerHTML = "Milliseconds elapsed: "+time.getMilliseconds();
document.getElementById("Main").innerHTML = parsed;
document.getElementById("Date").innerHTML = "Date: "+time.getDate()+"/"+(time.getMonth()+1)+"/"+time.getFullYear();
}
function ChangeColor(){
for (let x of document.getElementsByTagName("h2")){
x.style.color=`hsl(${color}, 100%, 60%)`;
}
document.getElementById("Top").style.color = `hsl(${color}, 100%, 60%)`;
//100 increment (epilepsy)
//1 Increment (normal)
color += 0.3;
}
function FontChange(){
for (let x of document.getElementsByTagName("h2")){
x.style.fontFamily=fonts[fontindex];
}
document.getElementById("Top").style.fontFamily = fonts[fontindex];
/*
fontindex += 1
if (fontindex >= fonts.length){
fontindex=0;
}
*/
fontindex=Math.round(Math.random()*fonts.length)
console.log(fontindex)
}
function ChangeBG(){
for (let i of document.getElementsByTagName("html")){
i.style.backgroundColor=`hsl(${colorBG}, 100%, 5%)`;
} //1000 increment, 60% brightness (epilepsy)
//1 Increment 2% brightness (normal)
colorBG+=1000;
}