Day 5
This commit is contained in:
21
50Days/day5/index.html
Normal file
21
50Days/day5/index.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
|
||||||
|
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
|
||||||
|
crossorigin="anonymous" /> -->
|
||||||
|
<link rel="stylesheet" href="style.css" />
|
||||||
|
<title>Day5: Blurry Loading</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<section class="bg"></section>
|
||||||
|
<div class="loading-text">0%</div>
|
||||||
|
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
18
50Days/day5/script.js
Normal file
18
50Days/day5/script.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const loadText = document.querySelector('.loading-text');
|
||||||
|
const bg = document.querySelector('.bg');
|
||||||
|
|
||||||
|
const scale = (num, in_min, in_max, out_min, out_max) => {
|
||||||
|
return ((num - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min;
|
||||||
|
};
|
||||||
|
|
||||||
|
let load = 0;
|
||||||
|
let int = setInterval(blurring, 15);
|
||||||
|
|
||||||
|
function blurring() {
|
||||||
|
load++;
|
||||||
|
load > 99 && clearInterval(int);
|
||||||
|
|
||||||
|
loadText.innerText = `${load}%`;
|
||||||
|
loadText.style.opacity = scale(load, 0, 100, 1, 0);
|
||||||
|
bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)`;
|
||||||
|
}
|
||||||
31
50Days/day5/style.css
Normal file
31
50Days/day5/style.css
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Ubuntu');
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Ubuntu', sans-serif;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg {
|
||||||
|
background: url('https://picsum.photos/1980') no-repeat center center/cover;
|
||||||
|
position: absolute;
|
||||||
|
top: -30px;
|
||||||
|
left: -30px;
|
||||||
|
width: calc(100vw + 60px);
|
||||||
|
height: calc(100vh + 60px);
|
||||||
|
z-index: -1;
|
||||||
|
filter: blur(70px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 50px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user