ceneuve Posted September 12, 2023 Share Posted September 12, 2023 Well the code is possibly not going to be too legible, but the thiin I dont think is that much. I have been trying even with chatgpt or whatever I could. In the file tengenUzui.js I wanted to add a animation on when you scrolled down or up with the mouse, the page would move you from the first div to the second one ( there are 3 of them) and same up. The code works fine, but when it starts the page and you scroll more than once time down or up the page do very strange things like moving during the animation. Idk what to do also I am very desperated to end it because is very stressfull. I'd like any suggestion and I am conscious that it wasnt a very good explanation, but who knows. (d)personajes.html (f)tengenUzui.js See the Pen xxmdQjV by THE-CNB (@THE-CNB) on CodePen Link to comment Share on other sites More sharing options...
ceneuve Posted September 12, 2023 Author Share Posted September 12, 2023 I never used this thing before, didnt expect to see that bad, well I will give some pics Link to comment Share on other sites More sharing options...
Rodrigo Posted September 12, 2023 Share Posted September 12, 2023 Hi @ceneuve and welcome to the GreenSock forums! Indeed is not very clear to me exactly what is the issue here. By looking at your codepen example, the only GSAP code I found: gsap.to(window, { duration: currentDuration, scrollTo: { y: currentPosition }, ease: "slow(0.7, 0.7, false)", onComplete: () => { isAnimating = false; // Establecer que la animación ha terminado } }); Is doing exactly what is supposed to do so maybe I'm missing something here 🤷♂️ Also I noticed you are using JS to apply different styles in different screen sizes. Why not just use CSS Media Queries? https://developer.mozilla.org/en-US/docs/Web/CSS/@media Based on the example you have you can look at using ScrollTrigger and Observer in combination with the ScrollTo Plugin as well: https://greensock.com/docs/v3/Plugins/Observer https://greensock.com/docs/v3/Plugins/ScrollTrigger Is worth mentioning that the Observer Plugin is baked into ScrollTrigger, so you don't need to add that file or link as well, ScrollTrigger should be enough: https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.observe() If you keep having issues please be very specific regarding what you want to achieve, what is not working and make sure that your minimal demo (please keep it as minimal as possible) reflects that. Also if it helps clarifying the situation, include a link that shows the functionality you're trying to achieve. Hopefully this helps. Happy Tweening! 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