Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 036b277

Browse files
authored
Merge branch 'main' into patch-3
2 parents c02ae81 + 57baab5 commit 036b277

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

Source-Code/BluringImage/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Bluring Image</title>
6+
<title>Blurring Image</title>
77
<link rel="stylesheet" href="style.css">
88
</head>
99
<body>
1010
<div class="loading-text">0%</div>
1111
<section class="bg"></section>
1212

13-
<script src="script.js"></script>
13+
<script src="script.js" defer></script>
1414
</body>
15-
</html>
15+
</html>

Source-Code/BluringImage/script.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@ document.addEventListener("DOMContentLoaded", () => {
22
const loadingText = document.querySelector(".loading-text");
33
const bg = document.querySelector(".bg");
44
let load = 0;
5+
6+
// Function to update the loading state and apply styles
7+
const blurring = () => {
8+
load++;
9+
if (load > 99) {
10+
clearInterval(intervalId);
11+
}
12+
loadingText.innerText = `${load}%`;
13+
loadingText.style.opacity = scale(load, 0, 100, 1, 0);
14+
bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`;
15+
};
516

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-
};
17+
// Start the interval to run the blurring function every 20ms
18+
const intervalId = setInterval(blurring, 20);
1519

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-
};
20+
// Utility function to scale a number from one range to another
21+
const scale = (num, inMin, inMax, outMin, outMax) => {
22+
return ((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
23+
};
2124
});

Source-Code/SplitLanding-Page/style.css

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,13 @@ h1 {
5858
.split {
5959
position: absolute;
6060
width: 50%;
61-
height: 50%;
61+
height: 100%;
6262
overflow: hidden;
6363
}
6464

6565
.split.left {
6666
left: 0;
67-
background: url(./assets/ps5.webp);
68-
background-repeat: no-repeat;
69-
background-size: cover;
70-
height: 100%;
67+
background: url(./assets/ps5.webp) no-repeat center center/cover;
7168
}
7269

7370
.split.left::before {
@@ -87,10 +84,7 @@ h1 {
8784

8885
.split.right {
8986
right: 0;
90-
background: url(./assets/boxseries.jpeg);
91-
background-repeat: no-repeat;
92-
background-size: cover;
93-
height: 100%;
87+
background: url(./assets/boxseries.jpeg) no-repeat center center/cover;
9488
}
9589

9690
.split.right::before {

0 commit comments

Comments
 (0)