Jump to content
Search Community

aroca

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by aroca

  1. Hi, thx for the answer. This is what I have to sync scrollTrigger with locomotive: src/components/scroll.jsx locoScroll.on("scroll", ScrollTrigger.update); ScrollTrigger.scrollerProxy(scrollWrapper.current, { scrollTop(value) { console.log(locoScroll.scroll.instance.scroll.y); return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y; }, getBoundingClientRect() { return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight }; }, pinType: scrollWrapper.current.style.transform ? "transform" : "fixed" }); ScrollTrigger.addEventListener("refresh", () => locoScroll.update()); ScrollTrigger.refresh(); The docs shows a similar example but it seems that the scrollTop() is not working. This "console.log(locoScroll.scroll.instance.scroll.y);" is working on the example but not there, thats what it makes me think that is something that i made in the wrong way with the scrollProxy. The animation is here: const animationTl = gsap.timeline(); ScrollTrigger.create({ trigger: ".gsap-container", animation: animationTl, markers: true, start: "top center+=300px", end: "top center-=300px", scrub: true }); animationTl.to(".square", { rotateZ: 90, x: "100%" }); And it works perfect without locomotive. What I expect its that scrollTrigger takes the scroll position of locomotive instead of the main scroll as its 0 always with the overfllow: hidden of the body. Thx for the help, I'll keep searching ?
  2. Hi, im tying to use scrollProxy with locomotive like in the docs with Nextjs. Locomotive works fine but scrollTrigger its always at the initial position. It seams that the scrollTop inside the scrollerPoxy its not returning any value. I made a codesandbox to show the case: Scroll component: https://codesandbox.io/s/nextjs-gsap-locomotive-qq11t?file=/src/components/scroll.jsx Live demo: https://qq11t.sse.codesandbox.io/ I'm looking for a good way to implement a smooth-scroll in nextjs so if any have an alternative to locomotive and works with gsap it would help any way. Thx, for the support
×
×
  • Create New...