<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.0/gsap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.0/ScrollTrigger.min.js"></script> <script> const slides = document.querySelectorAll('.slide'); let isMobile = window.innerWidth <= 768; // Assuming mobile width is 768px or less slides.forEach((slide, i) => { let angle = isMobile ? i * 10 : (i * 10) - 10; gsap.to(slide, { rotation: angle, transformOrigin: "0% 2300px", }); }); let speed = isMobile ? 30 : 30; // Faster speed on mobile ScrollTrigger.create({ trigger: '.scroller', start: "top top", end: "bottom bottom", //markers: true, onUpdate: (self) => { gsap.to(slides, { rotation: (i) => { let baseAngle = isMobile ? i * 10 : (i * 10) - 10; return baseAngle - self.progress * speed; } }); } }); </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter