Zain12 Posted February 22, 2023 Share Posted February 22, 2023 I have prepared a slider using gsap and react. My slider is working fine but I want the slides(Text and Image makes one slide) to be smoothly faded in when a user reaches them by scrolling. Your response would mean alot to me. Regards. Here is the minimal demo. https://stackblitz.com/edit/react-qwmzt1?file=src%2FApp.js,src%2Fstyle.css Link to comment Share on other sites More sharing options...
Cassie Posted February 22, 2023 Share Posted February 22, 2023 Hi there! Looks like you're looking for containerAnimation See the Pen WNjaxKp?editors=0010 by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Zain12 Posted February 22, 2023 Author Share Posted February 22, 2023 I have already tried this but cant figure out. Can you please have a look on my demo? Link to comment Share on other sites More sharing options...
Rodrigo Posted February 22, 2023 Share Posted February 22, 2023 Hi, Please check the example and information about Container Animation, since you're not setting it up on your demo. It should look kind of like this: const targetText = sections[2].querySelector('.sliderTxt'); gsap.from(targetText, { opacity: 0, y: 100, scrollTrigger: { trigger: sections[1], containerAnimation: horizontalTween, start: 'left center', end: 'lef left', scrub: 1, markers: true, }, }); Also is worth noticing that the positions in your example are a bit off, most likely because of some CSS, but I assume that the CSS is different in your real setup. That's why I'm using sections[1] to show sections[2] text's element, but the index should be the same in your real life scenario. Hopefully this helps. Happy Tweening! Link to comment Share on other sites More sharing options...
Zain12 Posted February 23, 2023 Author Share Posted February 23, 2023 Thank you so much. Im following the approach suggested by you. Means alot 2 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