<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/ScrollTrigger.min.js"></script>
<script>
const slides = document.querySelectorAll('.slide');
let isMobile = window.innerWidth <= 767; // Telas menores que 768 -> mobile
slides.forEach((slide, i) => {
let angle = isMobile ? i * 10 : (i * 14) - 10;
gsap.to(slide, {
rotation: angle,
transformOrigin: "0% 2300px",
});
});
let speed = isMobile ? 50 : 20; // Velocidade mobile : pc
ScrollTrigger.create({
trigger: '.scroller',
start: "top top",
end: "bottom bottom",
onUpdate: (self) => {
gsap.to(slides, {
rotation: (i) => {
let baseAngle = isMobile ? i * 10 : (i * 14) - 10;
return baseAngle - self.progress * speed;
}
});
}
});
</script>