Jump to content
Search Community

Scrolltrigger animation jitter on 3d model during camera and target animation(on this for days now, somebody help please)

Jaay test
Moderator Tag

Recommended Posts

Animating the camera position and camera target on scroll from section to section but it jittery(main webpage link - https://drill-rose.vercel.app/)

 

a look at the first scroll of the code pen, that little jitter is what im trying to fix

 

See the Pen rNQqyRP by Jaay9999 (@Jaay9999) on CodePen

Edited by Jaay
added a codepen url
Link to comment
Share on other sites

  • Jaay changed the title to Scrolltrigger animation jitter on 3d model during camera and target animation(on this for days now, somebody help please)

Hi @Jaay and welcome to the GreenSock forums!

 

You're making one of the most common ScrollTrigger errors which is putting ScrollTrigger instances on individual tweens inside a GSAP Timeline:

const setupScrollAnimation = () => {
  const tl = gsap.timeline()

  //first Section
  tl.to(position, {
    x: isMobile ? -6.0 : 1.56,
    y: isMobile ? 5.5 : -2.26,
    z: isMobile ? -3.3 : -3.25,
    scrollTrigger: {
      trigger: ".second",
      // markers: true,
      start: "top bottom",
      end: "top top",
      scrub: 0.5,
      immediateRender: false,
    },
    onUpdate,
  })
    .to(target, {
    x: isMobile ? -1.1 : -1.37,
    y: isMobile ? 1.0 : 1.99,
    z: isMobile ? -0.1 : -0.37,
    scrollTrigger: {
      trigger: ".second",
      // markers: true,
      start: "top bottom",
      end: "top top",
      scrub: 0.5,
      immediateRender: false,
    },
  })
}

https://greensock.com/st-mistakes/#st-in-tl

 

Since you have two trigger elements, ".second" and ".third" the first approach would be to create two timelines, one for each section.

 

Another option is to wrap those two sections inside another DOM element and use that as a trigger and create a single timeline that uses that entire wrapper as trigger for the timeline.

 

Personally I would try the second option and be done with it. A single timeline is far better than two in terms of control and avoid logical issues and jumps if you scroll too quickly between sections.

 

Hopefully this helps.

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

Hi,

 

But you still have ScrollTrigger instances inside individual tweens that are nested on a timeline.

 

Please read the link I provided in my previous post so you can understand the error you're making and the cause of the issue.

 

Happy Tweening!

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...