109 lines
3.1 KiB
HTML
109 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/Observer.min.js"></script>
|
|
<style>
|
|
:root {
|
|
@font-face {
|
|
font-family: 'Paperlogy-8ExtraBold';
|
|
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-8ExtraBold.woff2') format('woff2');
|
|
font-weight: 800;
|
|
font-style: normal;
|
|
}
|
|
}
|
|
|
|
p {
|
|
font-family: 'Paperlogy-8ExtraBold';
|
|
}
|
|
|
|
body {
|
|
padding-bottom: 5000px;
|
|
|
|
|
|
}
|
|
|
|
.box-mother {
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: relative;
|
|
|
|
.box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
position: fixed;
|
|
width: 100%;
|
|
|
|
p {
|
|
margin: 0;
|
|
font-size: 3em;
|
|
text-align: center;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="box-mother">
|
|
<div class="box">
|
|
<p>Making</p>
|
|
<p>The <b>bold</b></p>
|
|
<p>beautiful</p>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
|
|
document.addEventListener("DOMContentLoaded", (event) => {
|
|
Observer.create({
|
|
target: document,
|
|
type: "wheel, scroll",
|
|
onDown: (e) => {
|
|
if (e.scrollY.v > 100) {
|
|
gsap.to("p:nth-child(1), p:nth-child(3)", {
|
|
x: 200,
|
|
});
|
|
gsap.to("p:nth-child(2)", {
|
|
x: -200,
|
|
})
|
|
}
|
|
if (e.scrollY.v > 150) {
|
|
gsap.to("p:nth-child(1), p:nth-child(3)", {
|
|
opacity: 0,
|
|
});
|
|
gsap.to("p:nth-child(2)", {
|
|
opacity: 0,
|
|
})
|
|
}
|
|
},
|
|
onUp: (e) => {
|
|
if (e.scrollY.v < 100) {
|
|
gsap.to("p:nth-child(1), p:nth-child(3)", {
|
|
x: 0,
|
|
});
|
|
gsap.to("p:nth-child(2)", {
|
|
x: 0,
|
|
})
|
|
}
|
|
if (e.scrollY.v < 150) {
|
|
gsap.to("p:nth-child(1), p:nth-child(3)", {
|
|
opacity: 1,
|
|
});
|
|
gsap.to("p:nth-child(2)", {
|
|
opacity: 1,
|
|
})
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |