Jump to content
Search Community

Scroll Trigger Text Animation using SplitType package in React JS

HImanshu4135 test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

I want to achieve the text animation when we scroll in that specific component in React JS using Tailwind CSS. Currently I'm getting animations Line by Line and when I reverse the scroll the text gets disappeared, whereas, I want the animations to be displayed Character by Character like the link I'm sharing below: 


But I want to use this in React JS and instead of SplitText, I want to use SplitType NPM Package
I'm attaching my code file below for further reference. Please guide me to achieve the functionality.


Link to comment
Share on other sites

Hi @HImanshu4135 and welcome to the GreenSock forums!


It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? 


Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.


Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen


Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 


Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 


Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

  • Solution

Hi @HImanshu4135 welcome to the forum!


It feels a bit weird, you're asking for help on the Greensock forum, but you want to use a third party library for which we also have a tool. That is like going to a bakery, but then asking that they bake you a bread from dough from another bakery... I think not many bakeries will do that, luckily we're not that kind of bakery, but please think about supporting your local bakery! 🥖


Some of your CSS was fighting me, so I removed somethings and I still could not get it to work fully but at least the letters now pop in one by one. You'd set it so that each letter had it's own ScrollTrigger I've removed that and created one tween with one ScrollTrigger that animates all the chars, again I don't know where the half grey text is coming from, but the tween works. 


You're not doing proper clean up in react, so as stated before please read this article!



  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...