liow Posted October 13, 2021 Share Posted October 13, 2021 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 More sharing options...
liow Posted October 13, 2021 Author Share Posted October 13, 2021 Here is the failed example of using scrub. See the Pen Exvjeda by callmeliow (@callmeliow) on CodePen Link to comment Share on other sites More sharing options...
Solution OSUblake Posted October 13, 2021 Solution Share Posted October 13, 2021 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. 2 1 Link to comment Share on other sites More sharing options...
liow Posted October 14, 2021 Author Share Posted October 14, 2021 @OSUblake Thank you for the solution 😎 1 Link to comment Share on other sites More sharing options...
Jamesh Posted March 18, 2022 Share Posted March 18, 2022 I’d like to try and do this functionality using vanilla.js only but have failed! I have created a codepen of where I’ve got to. The effect works perfectly on enter but I cant seem to get it to work when leaving and re-entering. If anyone can help solve this, would be very appreciative. Thanks in advance. See the Pen mdpPWEy by jame5 (@jame5) on CodePen Link to comment Share on other sites More sharing options...
Jamesh Posted March 18, 2022 Share Posted March 18, 2022 Think I’ve solved this. Sorry for wasting anyone’s time… 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now