|
1 | | -/* eslint-disable*/ |
2 | | -const loadingText = document.querySelector(".loading-text"); |
3 | | -const bg = document.querySelector(".bg"); |
4 | | -let load = 0; |
| 1 | +document.addEventListener("DOMContentLoaded", () => { |
| 2 | + const loadingText = document.querySelector(".loading-text"); |
| 3 | + const bg = document.querySelector(".bg"); |
| 4 | + let load = 0; |
5 | 5 |
|
6 | | -const blurring = () => { |
7 | | - load += 1; |
8 | | - if (load > 99) { |
9 | | - clearInterval(int); |
10 | | - } |
11 | | - loadingText.innerText = `${load}%`; |
12 | | - loadingText.style.opacity = scale(load, 0, 100, 1, 0); |
13 | | - bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`; |
14 | | -}; |
| 6 | + const blurring = () => { |
| 7 | + load += 1; |
| 8 | + if (load > 99) { |
| 9 | + clearInterval(int); |
| 10 | + } |
| 11 | + loadingText.innerText = `${load}%`; |
| 12 | + loadingText.style.opacity = scale(load, 0, 100, 1, 0); |
| 13 | + bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`; |
| 14 | + }; |
15 | 15 |
|
16 | | -const int = setInterval(blurring, 20); |
17 | | -const scale = (num, in_min, in_max, out_min, out_max) => { |
18 | | - return ((num - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min; |
19 | | -}; |
| 16 | + const int = setInterval(blurring, 20); |
| 17 | + |
| 18 | + const scale = (num, inMin, inMax, outMin, outMax) => { |
| 19 | + return ((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin; |
| 20 | + }; |
| 21 | +}); |
0 commit comments