A Pen by Ryan LaBar on CodePen.
Created
May 14, 2025 22:38
-
-
Save alirezarezamand/3f3ee92093ea8f7ff84d11a76a8fe8cc to your computer and use it in GitHub Desktop.
GSAP SplitText Demo
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
GSAP × SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXTGSAP×SPLITTEXT |
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
const mySplitText = new SplitText('body', {type:"chars", position: "relative" }); | |
// gsap.to(mySplitText.chars, {fontWeight: 900, duration: 5}) | |
setTimeout(() => { | |
gsap.timeline({ yoyo: true, repeat: -1, repeatDelay: 0.5, delay: 1}) | |
.to(mySplitText.chars, { | |
duration: .2, | |
fontWeight: 900, | |
color: '#146EF5', | |
scale:.7, | |
y: 6, | |
ease: 'power2.in', | |
rotation: '360deg', | |
stagger:{ | |
grid: [14,14], | |
amount: .8, | |
from: 'center', | |
} | |
}) | |
.to(mySplitText.chars, { | |
duration: .4, | |
fontWeight: 200, | |
color: '#fff', | |
scale: 1, | |
y: 0, | |
rotation: '720deg', | |
ease: 'power3.inOut', | |
stagger:{ | |
grid: [14,14], | |
amount: .8, | |
from: 'center' | |
} | |
}, '-=.3') | |
}, 500) |
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.com/gsap@3/dist/gsap.min.js"></script> | |
<script src="https://unpkg.com/gsap@3/dist/SplitText.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
@font-face { | |
font-family: "LeagueSpartanVariable"; | |
src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/2101521/LeagueSpartanVariable.ttf"); | |
font-weight: 200 900; | |
} | |
@font-face { | |
font-family: 'Anybody'; | |
src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/61488/ETCAnybodyPB.woff2') format('woff2-variations'); | |
font-display: block; | |
font-weight: 200 900; | |
font-stretch: 10% 400%; | |
} | |
body { | |
height: 100vh; | |
width: 370px; | |
left: 0; | |
right: 0; | |
margin: auto; | |
background: #111; | |
color: #fff; | |
line-height: 15px; | |
font-size: 30px; | |
font-family: 'LeagueSpartanVariable', Courier, monospace; | |
display: flex; | |
flex-wrap: wrap; | |
align-content: center; | |
justify-content: center; | |
} | |
div { | |
width: 25px; | |
height: 25px; | |
text-align: center; | |
// font-variation-settings: "wght" var(--wt); | |
font-weight: 200; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment