-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (38 loc) · 1.04 KB
/
Copy pathscript.js
File metadata and controls
51 lines (38 loc) · 1.04 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
function mudarCor(id) {
document.getElementById(`celula${id}`).style.color = cores()
}
function cores() {
let cores = ["#b58900", "#cb4b16", "#dc322f", "#d33682", "#6c71c4", "#268bd2", "#2aa198", "#859900"]
let posição = aleatorio(cores.length)
let escolhida = cores[posição]
return escolhida;
}
function cronometro() {
setInterval(mudarTitulo, 800);
}
cronometro();
function mudarTitulo(){
let titulos = document.querySelectorAll(".rainbow")
for(let i = 0; i < titulos.length;i++){
let letras = titulos[i].querySelectorAll("span")
let posição = aleatorio(letras.length)
let cor = cores()
let letraDaVez = letras[posição]
if(letraDaVez.style.color !== cor){
letraDaVez.style.color = cor
}
else{
letraDaVez.style.color = cores()
}
}
}
function aleatorio(num){
return Math.floor(Math.random() * num)
}
function trocar(){
let splash = document.querySelector(".splash")
splash.style.opacity = "0%"
setTimeout(()=>{
splash.classList.add('hidden')
},610)
}