Xenex122 Posted July 9, 2022 Share Posted July 9, 2022 Long time no see, GSAP Community but I'm hereby to ask another question cause I'm kinda confused how I will supposed 'direction' my text if its click on the right or left. As you see in this code function firstTextFunctionsSlideIn(array, direction) { const firstGsap = gsap.utils.toArray(array); firstGsap.forEach((elem, i) => { gsap.fromTo( elem.children[0], { x: direction > 0 ? 100 : -100 }, { x: 0, duration: firstGsap.length / (firstGsap.length - i * (0.05 * firstGsap.length)), ease: "power2.inOut" } ); }); } function firstTextFunctionsSlideOut(array, direction) { const firstGsap = gsap.utils.toArray(array); firstGsap.forEach((elem, i) => { gsap.to(elem.children[0], { x: direction > 0 ? -100 : 100, duration: firstGsap.length / (firstGsap.length - i * (0.05 * firstGsap.length)), ease: "power2.inOut" }); }); } wherein in the functionSlideIn() is not getting an issue only if I click the right click button but if I click the left its like its countering the functionSlideOut().. Note that If keep clicking the functionSlideIn() nothings happen but when I click the left 'PREV' it will counter flow I'm just slightest a bit confused of how I will make the direction when the text is out or in ...yeah that's right my only problem here is X. but a little bit confused. If anyone can help me it is a big thanks :>> .. See the Pen bGvpmza by myth-vince (@myth-vince) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted July 9, 2022 Share Posted July 9, 2022 @Xenex122 these forums aren't really for general logic or custom consulting - we really try to keep the questions focused on GSAP-specific ones. However, as a courtesy I took a look at your CodePen and it looks to me like you just inverted your variables. // BAD callTextFunctionsIn(oldSlide, -1); callTextFunctionsOut(currentSlide, -1); // GOOD callTextFunctionsIn(currentSlide, -1); callTextFunctionsOut(oldSlide, -1); See the Pen poLyQVM?editors=0010 by GreenSock (@GreenSock) on CodePen I hope that helps. 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