Created
November 17, 2022 21:24
-
-
Save tnylea/dced62f0aad95372f793b08ef56824f9 to your computer and use it in GitHub Desktop.
simple text reveal animation with GSAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> | |
<title>TailwindCSS Text Reveal Animation</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.3/gsap.min.js"></script> | |
<script src="https://unpkg.com/split-type"></script> | |
<script src="https://cdn.tailwindcss.com"></script> | |
</head> | |
<body> | |
<div class="w-screen h-screen flex items-center justify-center"> | |
<h1 id="text" class="text-8xl font-bold" style="clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);">Awesome Sauce 🤘</h1> | |
</div> | |
<script> | |
let text = new SplitType('#text'); | |
let characters = document.querySelectorAll('.char'); | |
for(i=0; i<characters.length; i++){ | |
characters[i].classList.add('translate-y-full'); | |
} | |
let tween = gsap.to('.char', { | |
y: 0, | |
stagger: 0.05, | |
delay: 0.2, | |
duration: .5 | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment