Jaay Posted July 26, 2023 Share Posted July 26, 2023 (edited) 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 FullSizeRender.MOV See the Pen rNQqyRP by Jaay9999 (@Jaay9999) on CodePen Edited July 26, 2023 by Jaay added a codepen url Link to comment Share on other sites More sharing options...
Rodrigo Posted July 26, 2023 Share Posted July 26, 2023 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! 1 Link to comment Share on other sites More sharing options...
Jaay Posted July 27, 2023 Author Share Posted July 27, 2023 @Rodrigo I just edited out the second trigger from the pen and the bug is this present, removed the .third totally Link to comment Share on other sites More sharing options...
Rodrigo Posted July 27, 2023 Share Posted July 27, 2023 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now