Jump to content
Search Community

Immediately change color with gsap.to without color-tones in between

JoussenKarliczek test
Moderator Tag

Go to solution Solved by Carl,

Recommended Posts

Hi,

 

I have a text-animation that highlights sentences when scrolling down - works fine so far.

 

Now I´m looking for a easy way where the color switches immediately - without color-transforming.

 

I tried different ways with onUpdate for example, but I have no clue how to achieve that with the scrub-Option on.

 

Do you have any tipps or ideas?

 

Thanks in advance.

 

 

See the Pen WNByJvE by joussenkarliczek (@joussenkarliczek) on CodePen

Link to comment
Share on other sites

Thanks for the demo.

 

If you don't want your animations to have any animation you can set duration:0 or use a set()

 

Once your animations don't have any duration it is important to space them apart in the timeline by using a position parameter.

 

I'm using index * 0.5 in your loop.

 

Without the position parameter they will all run at the same time.

 

See the Pen JjqZvOj?editors=0110 by snorkltv (@snorkltv) on CodePen

 

Hopefully this helps

  • Like 2
Link to comment
Share on other sites

Hi Carl,

 

thanks for your fast answer. I made adjustments to the codepen where I only Highlight one sentence and extended it with your input.

 

The Problem now is that the sentence at the top - if you scroll back - won´t change anymore. Any clue how to solve that?

 

 

codepen.io/joussenkarliczek/pen/WNByJvE

I´m not able to post the codepen link.

 

Just saw, that my original codepen got updated. Sorry for the confusion.

 

 

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