Yes, I figured it might be the case, but hoped there're a better solution.
I recalculated new x position on resize, but it's far away from perfect:
const setBounds = () => {
prevSliderWidth = sliderWidth;
sliderWidth = slides[0].offsetWidth * slides.length;
const newX =
(sliderWidth / 100) *
(gsap.getProperty(proxy, "x") / (prevSliderWidth / 100));
gsap.to([slider, proxy], { width: sliderWidth, x: newX });
};
setBounds();
window.addEventListener("resize", throttle(300, false, setBounds));
I had to use 300ms throttle, any less then that breaks recalculation for some reason. And 300ms throttle makes layout on resize look jumpy unfortunately
https://codepen.io/jshikanova/pen/PomdNGV
Thanks to everyone who helped me to figure it out!