Stagger Reverse
Same as the stagger demo with toggleActions: 'play none none reverse' on the single ScrollTrigger. When you scroll back up past the grid’s trigger point, all cards reverse their entrance in the opposite stagger order. Duration and ease are identical in both directions.
단일 ScrollTrigger에 toggleActions: 'play none none reverse'를 추가한 스태거 데모와 동일합니다. 그리드의 트리거 지점 위로 스크롤하면 모든 카드가 역방향 스태거 순서로 입장을 되돌립니다. 지속 시간과 이징은 양방향에서 동일합니다.
Source Code script.js
gsap.registerPlugin(ScrollTrigger);
gsap.to('.card', {
opacity: 1,
y: 0,
stagger: 0.1,
duration: 0.6,
ease: 'power2.out',
scrollTrigger: {
trigger: '.grid',
start: 'top 85%',
toggleActions: 'play none none reverse',
},
});