Jump to content
Search Community

Pinned animation issue with and without markers

codechirag test
Moderator Tag

Recommended Posts

const tl = gsap.timeline({
        scrollTrigger: {
          trigger: ".theApp",
          pin: true,
          pinSpacer: false,
          markers: true,
          start: "top top",
          // end: "bottom top",
          scrub: true,
        },
      });
      const app = gsap.utils.toArray(".app");
      tl.to(app, {
        y: "0%",
        opacity: 1,
        scale: 1,
        ease: "back.inOut(4)",
        stagger: 1,
        duration: 0.5
      })
        .to({}, {}, "+=1")
        .to(".app1", {
          delay: 1,
          duration: 2,
          ease: "back.in(4)",
          yPercent: 0,
          xPercent: 155,
          scale: 0.5,
          opacity: 1
        })
        .to(
          ".app2",
          {
            duration: 2,
            ease: "back.in(4)",
            yPercent: 0,
            xPercent: 50,
            scale: 0.5,
            // opacity: 0
          },
          "<"
        )
        .to(
          ".app3",
          {
            duration: 2,
            ease: "back.in(4)",
            yPercent: 0,
            xPercent: -50,
            scale: 0.5,
            // opacity: 0
          },
          "<"
        )
        .to(
          ".app4",
          {
            duration: 2,
            ease: "back.in(4)",
            yPercent: 0,
            xPercent: -150,
            scale: 0.5,
            // opacity: 0
          },
          "<"
      ).to('.app img + div', {opacity: 0},"<")

Hello wonderful community, Thanks for always being helpful. I have made one animation using scrollTrigger while pinning the section it is not working properly. If I enable markers and then check it works very smoothly but without markers the pin is not working properly the section gets pinned before the start point. Here I am sending the video link , I will be very much thankful for your help.

 

Here I am also attaching GSAP code.

 

 

Link to comment
Share on other sites

That kinda sounds like a layout issue with your CSS maybe. Like if the markers are propping open the container, for example, but without the markers your raw layout is collapsed such that it cannot scroll far enough. Or maybe you're lazy loading images or assets in a way that alters the layout AFTER the window's "load" event fires. In that case, make sure you call ScrollTrigger.refresh() AFTER your layout is settled and isn't going to shift around anymore. 

 

Without a minimal demo, it's very difficult to troubleshoot; the issue could be caused by CSS, markup, a third party library, a 3rd party script, etc. Would you please provide a very simple CodePen or Stackblitz that illustrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependencies as possible. Start minimal and then incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...