Thank you so much Jack and Zach ! I really appreciate this community, you gave me good leads by taking the time to explain.
So I met my new friend Locomotive Scroll and now I have a pretty smooth scroll
I adapt the parallax and put a pin with Gsap on each layer (no more position fixed in the css but absolute)
//PARALLAX
const parallax = document.querySelectorAll(".parallax");
parallax.forEach((elem) => {
const depth = elem.dataset.depth;
gsap.to(elem, {
scrollTrigger: {
trigger: elem,
scrub: true,
pin: true,
pinSpacing: false,
start: "top top",
scroller: ".smooth-scroll"
},
yPercent: -100 * depth,
ease: "none"
});
});
The result of the parallax if it can help someone : https://xoiuv.csb.app/
This is my code I hope it's ok now with the GSAP3 syntax (I add images and animations to test perf + scrub/play/pin sections) : https://codesandbox.io/s/strange-noether-xoiuv?file=/script.js
> A 1px line sometimes appears between the sections (bottom of the parallax and the wave between the 2 pin sections), I fix it in the CSS with a position "top: -1px"
> No more issues with my SVG / CSS animations, I don't realize if it's an aberration to make animation in CSS with GSAP, but it works pretty well and it's just simple ( I don't have the impression that it plays a big role in performance). But if it makes a real difference, I will create them in Gsap, what do you think about ?
Again thank you for giving the keyword "smooth scrolling" ^ ^ it helps a lot in my research
> Demo Locomotive Scroll + Gsap : https://codepen.io/GreenSock/pen/ExPdqKy
> Newbie Tuto :