I have the same problem using
font-display: auto;
is the default from typotheque.com
which results into different linebreaks everytime.
I followed OSUblake's direction to load the fonts first, if browsers not support this API then the text is not split and animated, but still visible which is enough
document.fonts.ready.then((fontFaceSet) => {
const childSplit = new SplitText(".p-line", { type: "lines" });
gsap.set(childSplit.lines, { opacity: 0 });
ScrollTrigger.batch(childSplit.lines, {
onEnter: (batch) => {
gsap.set(batch, { opacity: 0, yPercent: 100 });
gsap.to(batch, {
yPercent: 5,
duration: 1,
opacity: 1,
ease: "power4",
stagger: 0.2,
});
},
onLeaveBack: (batch) => gsap.to(batch, { opacity: 0, yPercent: 100 }),
start: "bottom 95%",
});
});