Jump to content
Search Community

SplitText different colors

Cor test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Thanks Chrysto!


Yes, ofcourse I can color the first word with a tween, but I was trying to set color in a span and see the outcome.
And I guess this means all my primairy set (css-)settings will be overridden bij SplitText.

Link to comment
Share on other sites

Hi Cor,


If you want apply a new class to the text that has been split immediately use charsClass like so:

mySplitText = new SplitText("#quote", {type:"words,chars", charsClass:"rood"})



If you want to animate the application of that class use className in each tween

tl.staggerTo(chars, 0.8, {className:"+=rood"}, 0.01, 0)



Does that help?


ps. Nice work, Chrysto! Very cool. 

  • Like 1
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...