darkroomengineering / lenis

How smooth scroll should be
https://lenis.darkroom.engineering
MIT License
9.16k stars 388 forks source link

Possible issue with GSAP's scrollTrigger snap feature #389

Closed DominickVale closed 3 weeks ago

DominickVale commented 1 month ago

Describe the bug When using GSAP's ScrollTrigger snap feature along with lenis, scrolling up to the previous snapping point is very difficult and behaves very differently than when scrolling down. E.g to go down you only have to scroll a small percentage of the wheel. Whereas to go up you need a full scroll, basically you need to land almost on the snap point.

I also tried removing the snap from the scrolltrigger and use lenis/snap instead. Funnily enough the opposite happens in this case. Going up works normally, while scrolling down becomes difficult.

To Reproduce Here's the codepen. There's some modifications I did to make gsap work better, but the issue persists so I left it how it was. Removing lenis solves the snapping issue. https://codesandbox.io/p/sandbox/lively-field-29rqgq?file=%2Fsrc%2Findex.js&workspaceId=0594864b-79ee-45da-baa8-7022bffe9845

clementroche commented 1 month ago

Hi, i'm not sure about how GSAP's ScrollTrigger snap feature works but i'm affraid it will be hard to make them work together smoothly. About the lenis/snap i think the current implementation is broken 😅. imma take a look

clementroche commented 1 month ago

@DominickVale can you share your codesandbox with lenis/snap implementation?

clementroche commented 1 month ago

After a review, lenis/snap works correctly, only the demo was "broken"

Bhavin2000 commented 1 month ago

I also have problem with scroll trigger snap to and Lenis. It takes little time to take position. And sometimes it behaves strange i asked to scroll trigger also but they said its problem of lenis.

Bhavin2000 commented 1 month ago

https://gsap.com/community/forums/topic/38454-scroll-snap-for-specific-section-and-wait-before-snapping/?do=findComment&comment=209864&_rid=182116 see this is my gsap questions and answers

Bhavin2000 commented 1 month ago

https://codepen.io/Bhavin-Raut/pen/XWvMdBX. This is my codepen

clementroche commented 1 month ago

@Bhavin2000 your codepen is way too complex for me to debug and it's using GSAP ScrollTrigger in addition. Can you share a codepen only using lenis and lenis/snap ?

clementroche commented 3 weeks ago

I'm closing this issue until your share a minimal reproduction link.