Repository navigation
Replies: 1 comment
|
I ran into basically this exact symptom (ScrollTrigger working fine, then breaking once Lenis is added) in a Vite + React + GSAP setup. Two things fixed it for me:
gsap.ticker.add((time) => {
gsap.registerPlugin(ScrollTrigger); lenis.on("scroll", ScrollTrigger.update); Without that lenis.on("scroll", ...) line, ScrollTrigger has no idea Lenis exists, so any trigger positions/progress calculations go stale or desync as soon as Lenis starts interpolating scroll. I can't speak to the Three.js side of your setup since I haven't wired that up myself, but the same "drive everything off one shared ticker" principle should extend cleanly, you'd add your renderer's per-frame update into that same gsap.ticker.add() callback rather than a separate loop, so Lenis/GSAP/Three.js are all stepping on the same clock instead of three independent RAFs drifting relative to each other |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi guys, hope you're doing well.
Currently working on a gsap, lenis and three.js setup.
On mobile gsap create jittering, found a way to fix that by adding overflow:hidden to the html tag, and scrolling trough the body.
Here my current code:
Here if i remove lenis, everything works perfect, gsap scrollTrigger works, if I remove the comments to let lenis launch, nothing works anymore. I tried also by adding
wrapper: document.documentElement, content: document.bodyto lenis setup but still nothing.My idea is to update lenis, gsap , and three.js on the same RAF, so trying to get sync and avoid "jitterings" on mobile devices.
Here one quick preview: https://codesandbox.io/p/sandbox/nskhzh?file=%2Findex.html%3A1%2C1-116%2C1
Thanks guys!
All reactions