<h2>Scroll down</h2>
<h1>I'm revealed on scroll!</h1>
@import url('https://fonts.googleapis.com/css?family=Signika+Negative:300,400&display=swap');
body {
font-family: "Signika Negative", sans-serif;
font-weight: 300;
text-align: center;
height: 150vh;
}
h1 {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
const tl = gsap.timeline({paused: true});
tl.from("h1", {scale: 0.7, autoAlpha: 0, duration: 1});
function animateAtScrollPos() {
if(scrollY > 100) {
tl.play();
document.removeEventListener("scroll", animateAtScrollPos);
}
}
document.addEventListener("scroll", animateAtScrollPos);
This Pen doesn't use any external CSS resources.