Jump to content
GreenSock

cotton

Use ScrollTrigger scrub to affect onEnter callback function

Go to solution Solved by SteveS,

Recommended Posts

Hello

 

I'm trying to change the background colour of an element (site_wrapper) based on the data-attr of another element (section) that is scrolling.

I've got it all working but would like to have the scrub affect the colour change rather than just animating the change onEnter.

 

Any pointers would be much appreciated.

 

 

See the Pen KKoJVaL by Cottonltd (@Cottonltd) on CodePen

Link to comment
Share on other sites

  • Solution

@cotton You will want to do it similar to this:

 

See the Pen KKoJMpZ by StevenStavrakis (@StevenStavrakis) on CodePen

 

However, you probably need to adjust the start and end values to get deeper colors / colors at the right time.

  • Like 2
Link to comment
Share on other sites

Great Thank you @SteveS.

Nice a simple to implement too.

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