Created
August 21, 2023 12:13
-
-
Save moelle89/8dd36f1898153bdeff6ef5bf7d9be8dc to your computer and use it in GitHub Desktop.
Learn GSAP text effect 01
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
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap" rel="stylesheet"> | |
<div class="container"> | |
<p>The race for the presidency is usually decided in a small number of key battleground states that switch party allegiance between elections.</p> | |
</div> |
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
let split | |
let animation = gsap.timeline({id:"animation", repeat:10, repeatDelay:1}) | |
function init(){ | |
split = new SplitText("p", {type:"lines"}) | |
gsap.set(".container", {autoAlpha:1}) | |
animation.from(split.lines, {opacity:0, rotationX:-20, rotationY:0, stagger:0.2, transformOrigin:"50% 50% -100"}) | |
} | |
window.addEventListener("load", init) |
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
<script src="https://unpkg.co/gsap@3/dist/gsap.min.js"></script> | |
<script src="https://assets.codepen.io/16327/SplitText3.min.js"></script> | |
<script src="https://unpkg.com/gsap@3/dist/TextPlugin.min.js"></script> | |
<script src="https://unpkg.com/gsap@3/dist/EasePack.min.js"></script> |
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
html, body { | |
width:100vw; | |
height:100vh; | |
font-family:'Montserrat', sans-serif; | |
color: #fff; | |
background: #1a1a1a; | |
margin: 0; | |
} | |
body { | |
display: flex; | |
justify-content: center; | |
overflow: hidden; | |
align-items: center; | |
} | |
.container { | |
height: 100%; | |
display: flex; | |
align-items: center; | |
width: 500px; | |
visibility: hidden; | |
perspective: 900px; | |
} | |
p { | |
font-size: 36px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment