Hello,
Sorry, I continued searching for the solution and modified my CodePen code in the meantime!
Here is the code that was causing the problem:
gsap.registerEffect({
name: "fade",
defaults: {
scale: 0,
opacity: 0,
duration: 5,
},
effect: (targets, config) => {
return gsap.fromTo(targets, {
scale: config.scale,
opacity: config.opacity,
duration: config.duration,
transformOrigin: 'center center',
x: 'random(-500,500)',
y: 'random(-500,500)',
}, {
scale: 1,
opacity: 1,
duration: config.duration,
x: 0,
y: 0,
});
}
});
const mots = document.querySelectorAll('.b4-nuage-de-mots li');
gsap.from(mots, {
duration: 'random(1, 5)',
scrollTrigger: '.b4-nuage-de-mots',
transformOrigin: 'center center',
scale: 0,
opacity: 0,
x: 'random(-100,100)',
y: 'random(-100,100)',
delay: .8,
});
mots.forEach((mot) => {
mot.style.willChange = 'transform, opacity';
gsap.from(mot, {
duration: 'random(1, 5)',
scrollTrigger: '.b4-nuage-de-mots',
scale: 0,
opacity: 0,
x: 'random(-100,100)',
y: 'random(-100,100)',
delay: .8,
});
gsap.fromTo(mot, {
scale: 0,
opacity: 0,
duration: 5,
x: 'random(-500,500)',
y: 'random(-500,500)',
}, {
scale: 1,
opacity: 1,
duration: 5,
x: 0,
y: 0,
})
});
mot.addEventListener('mouseenter', () => {
gsap.effects.fade(mot, {
duration: 'random(3, 6)',
});
});
});
Unfortunately, I still have a reflow problem. I'm still searching to identify which part...
Thanks for you answer.