Jump to content
Search Community

changing color one word at a time

jsciumi 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

Hi again :)

 

I'm looking to get each of my "keywords" to change to a highlighted color (I just used red in the pen for simplicity) as the subsequent list items fill in. I think I may have made this task a little harder on myself by having previously done SplitText on the phrase and animated color initially by character? Something with specificity of the divs?

 

I'm stumped. I did include a little "y" bump in my pen just to make sure I was able to target the correct keyword--it's just the color changing that I can't get to work.

 

Thank you so much!

Jen

See the Pen XPgEqB?editors=1111 by jsciumi (@jsciumi) on CodePen

Link to comment
Share on other sites

Hi @jsciumi :)

 

The problem is your intro() timeline. In that one you're targeting the individual characters with a staggered color animation. So when you go to animate the color of the words (the parent div of those characters)  it won't work correctly because you've set the color at a more specific level. One fix would be at the end of your intro() timeline you can use clearProps to get rid of that color on the characters.

 

 

See the Pen aawGBe by PointC (@PointC) on CodePen

Hopefully that helps. Happy tweening.

:)

 

  • Like 5
  • Thanks 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...