Skip to content

Commit 26041f3

Browse files
authored
Add files via upload
1 parent f906319 commit 26041f3

3 files changed

Lines changed: 67 additions & 0 deletions

File tree

prototype/blurringpage/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
13

4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>blur page</title>
9+
<link rel="stylesheet" href="style.css">
10+
</head>
11+
12+
<body>
13+
<section class="bg">
14+
15+
</section>
16+
<div class="loading-text">0%</div>
17+
<script src="script.js"></script>
18+
</body>
19+
20+
</html>

prototype/blurringpage/script.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const loadText = document.querySelector('.loading-text')
2+
const bg = document.querySelector('.bg')
3+
4+
5+
let load = 0
6+
let int = setInterval(blurring, 30)
7+
8+
function blurring() {
9+
load++
10+
11+
if (load > 99) {
12+
clearInterval(int)
13+
}
14+
loadText.innerHTML = `${load}%`
15+
loadText.style.opacity = scale(load, 0, 100, 1, 0)
16+
bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`
17+
}
18+
19+
20+
const scale = (num, in_min, in_max, out_min, out_max) => {
21+
return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
22+
}

prototype/blurringpage/style.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
body {
3+
display: flex;
4+
align-items: center;
5+
justify-content: center;
6+
height: 100vh;
7+
margin: 0;
8+
9+
}
10+
11+
.bg {
12+
background: url('https://images.unsplash.com/photo-1511884642898-4c92249e20b6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80') no-repeat center center/cover;
13+
position: absolute;
14+
top: -30px;
15+
left: -30px;
16+
width: calc(100vw + 60px);
17+
height: calc(100vh + 60px);
18+
z-index: -1;
19+
filter: blur(0px);
20+
}
21+
22+
.loading-text {
23+
font-size: 65px;
24+
color: white;
25+
}
26+

0 commit comments

Comments
 (0)