Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Cor

SplitText different colors

Recommended Posts

I am trying to color some text within SplitText, but it doesn't get red (rood).
 

Is it SplitText or just me again. :-)

See the Pen gteKu by codo (@codo) on CodePen

Link to comment
Share on other sites

Well, it depends on how/what you're trying to animate. I created a simple pen that makes every char in different color:

See the Pen ebyjw? by bassta (@bassta) on CodePen

  • Like 3
Link to comment
Share on other sites

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"})

http://codepen.io/GreenSock/pen/Joysn

 

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)

http://codepen.io/GreenSock/pen/yEkig?editors=001

 

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.
×