Jump to content
Search Community

JentiDabhi

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by JentiDabhi

  1. I am trying to add scroll trigger on page in react js componentDidmount() function but its getting error when we click to other page

    ERROR:
    Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

    Here is my code:

      async componentDidMount() {

     

        let isMounted = true
     
        gsap.to('#root'1, {
          css: { opacity: '1' }
        })
     
        
        let pageContainer = document.querySelector(".carsoul--onScroll");
        let container = document.getElementById("on--scroll-team");
        this.tl.to(pageContainer, {
          x: function x() {
            return -(container.scrollWidth - document.documentElement.clientWidth) + "px";
          },
          ease: Linear.easeInOut,
          scrollTrigger: {
            trigger: container,
            invalidateOnRefresh: true,
            pin: true,
            scrub: 1,
            start: "top top",
            //markers: true,
            end: function end() {
              return "+=" + pageContainer.offsetWidth;
            }
          }
        });
        
     
      }
    componentWillUnmount (){
        this.tl.kill()
      }
  2. 15 hours ago, Cassie said:

    Thanks for putting that together. 

    It looks like you have the right idea! Mask the sections, position them on top of each other and then animate their x/y values
     

     


    You were targeting some elements that didn't exist and using an older version of GSAP syntax, but aside from that there's nothing more technically  that we can help you with here. As someone who's done glitchy animations before, it's fiddly work! 

    Aesthetically it doesn't look right yet, but you're on the right track. What's left to do is to tweak the values, adjust the size of the masks and adjust the easing/timing of the animation until it looks right, you're nearly there!

     

     

    Okay thanks @Cassie For your good information. 

×
×
  • Create New...