Hello @GreenSock thank you for your reply and for making things cooler since Flash
I've found a way to fix my code, images are now placed correctly:
const dispose = (scroll) => {
gsap.set($items, {
x: (i) => {
const sumWidth = Array.from($items).slice(0, i).reduce((acc, item) => acc + item.clientWidth, 0);
return sumWidth + scroll;
},
modifiers: {
x: (x, target) => {
const currentIndex = Array.from($items).indexOf(target);
const s = gsap.utils.wrap(-$items[currentIndex].clientWidth, wrapWidth - $items[currentIndex].clientWidth, parseInt(x));
return `${s}px`;
},
},
});
};
dispose(0)
I've checked a few console.logs and indeed this code seems do be running a bunch of stuff for nothing.
I didn't know about the consulting services, I might reach out then.