Jump to content

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

(ScrollTrigger + Scrub) Change text color in and out from the div

Go to solution Solved by OSUblake,

Recommended Posts

Hi guys, this is my first time using GSAP. As mentioned in the title, I'm able to generate the effect without using scrub. However, I want the text color changes with scrub while entering the div and leaving the div. I tried using 2 triggers to do it but it failed. Anyone know how to make it works?


Kindly let me know what's the better way of writing GSAP so that I'm able to refactor it.

Thank you so much.

See the Pen abyOaZg by callmeliow (@callmeliow) on CodePen

Link to comment
Share on other sites

  • liow changed the title to (ScrollTrigger + Scrub) Change text color in and out from the div
  • Solution

Welcome to the forums @liow


You need to use immediateRender on your 2nd tween. Otherwise it would be animating from black to black.


See the Pen ZEJGmgj by GreenSock (@GreenSock) on CodePen



You can learn more about immediateRender here.



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