Skip to content

Commit 2e796bc

Browse files
committed
feat: day 5
1 parent 79aafa6 commit 2e796bc

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

005-blurry loading/script.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ const blurring = () => {
77
load++;
88
if (load > 99) clearInterval(int);
99
loadText.innerText = `${load}%`;
10-
loadText.style.opacity = scale(load, 0, 100, 1, 0);
11-
bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`;
10+
// Fade Out Text Sooner or Later
11+
loadText.style.opacity = scale(load, 0, 50, 1, 0);
12+
// Modify Initial Blur Amount
13+
bg.style.filter = `blur(${scale(load, 0, 100, 10, 0)}px)`;
1214
};
1315

1416
// For reference: https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers
1517
const scale = (num, in_min, in_max, out_min, out_max) => {
1618
return ((num - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min;
1719
};
1820

19-
let int = setInterval(blurring, 30);
21+
// Change the Loading Speed
22+
let int = setInterval(blurring, 10);

005-blurry loading/style.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ body {
1515
}
1616

1717
.bg {
18-
background: url("https://images.unsplash.com/photo-1610217053402-b187336e9443?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80")
18+
/* Use a Different Background Image */
19+
background: url("https://images.unsplash.com/photo-1734779336398-167995aeaf1c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80")
1920
no-repeat center center / cover;
2021
position: absolute;
2122
top: -30px;
@@ -28,5 +29,6 @@ body {
2829

2930
.loading-text {
3031
font-size: 50px;
31-
color: #a3b1c3;
32+
/* Change Loading Text Color */
33+
color: #403d47;
3234
}

0 commit comments

Comments
 (0)