Jump to content
Search Community

adamatronix

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by adamatronix

  1. I have smoother effects applied to the SplitText plugin to create a lag effect for each character in React. But I feel the performance won't be so great on mobile so I want to be able to remove it when it hits a certain breakpoint. Is there a way to remove everything within matchMedia? 

     

    React.useEffect(()=> {
    let mm = gsap.matchMedia();
    if(smoother) {
    mm.add("(min-width: 900px)", () => {
     
    const split = new SplitText("#discover-copy", { type: "words,chars" });
    const chars = split.chars;
     
    chars.forEach((char, i) => {
    smoother.effects(char, { speed: 1, lag: (i + 1) * 0.002 });
    });
     
    return () => { // optional
     
    };
     
    })
    }
    },[smoother]);
  2. Essentially I have an intro pin effect for a page that should only start at the beginning in certain scenarios like accessing the homepage directly. On route changes to the homepage I want the user to see the page after the pin effect but still have the option to scroll up. Below is a rough example, and it kind of works insofar when navigating to the page it'll go to scroll pos 2000. But you see a flash of the scrub animation which I don't want.

     

    Not sure if this can be achieved.

     

    if(fromRouteChange){
     window.scrollTo(0, 2000);
    }
    
    
    tl.current = gsap.timeline({
              scrollTrigger: {
                  trigger: ContainerRef,
                  id: "hello",
                  start: "top top",
                  end: "+=2000",
                  pin: true,
                  scrub: 0.9,
              }
            })

     

  3. Hi, 

     

    Just trying out the new matchMedia functionality in 3.11.0 and while it works ok on a desktop browser, it fails to fire the mobile breakpoint on a mobile device. I am using safari and chrome 104.0.5112.99 on iOS.

     

    The codepen should display either "mobile" or " desktop". Of course it'll work if viewing this post on a desktop browser.

     

    On the documentation page it recommends the following for mobile. However this fails to do anything. The codepen has the correct viewport metatag.

    <meta name="viewport" content="width=device-width, initial-scale=1">

     

    See the Pen gOzrbZG by adamatronix (@adamatronix) on CodePen

  4. Hi, 

     

    So without resizing and scrolling it is working as expected. When you reach the test section it pins, then for a 1000px it'll scrub and the Test will animate to the top, then the whole section just pins for the duration of the page.


    However, if you resize after the scrub, the whole thing breaks. The Test labels don't scrub, or it may but they are all in the wrong positions. Definitely the nested triggers causes the issue, but don't know alternative methods to get this effect.

     

     

     

    • Like 1
×
×
  • Create New...