Introduction to ScrollTrigger
Scroll-based animations can create engaging, interactive web experiences by responding to user scroll actions. GSAP's ScrollTrigger plugin is a powerful tool that allows you to trigger and control animations as elements enter, leave, or move through the viewport. You will use ScrollTrigger when you want your animations to respond directly to scroll position, such as animating sections as they appear on screen, pinning elements, or syncing animation progress with the scroll bar. This approach is widely used for landing pages, storytelling sites, and interactive infographics where scroll progress drives the narrative and visual effects.
index.html
When configuring ScrollTrigger, several key options give you control over how and when your animation plays:
- trigger: the element that
ScrollTriggerwatches for entering or leaving the viewport; - start: defines when the animation should start relative to the trigger and viewport (for example,
"top 80%"means the top of the trigger hits 80% down the viewport); - end: sets when the animation should end (for example,
"top 30%"means the top of the trigger reaches 30% down the viewport); - scrub: links the progress of the animation to the scrollbar, so the animation plays smoothly as you scroll;
- toggleActions: specifies what actions to take when entering or leaving the trigger area, using a sequence like
"play reverse play reverse"(onEnter, onLeave, onEnterBack, onLeaveBack).
By adjusting these options, you can create a wide variety of scroll-based effects—from simple fade-ins to complex, scroll-synced storytelling.
Bedankt voor je feedback!
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 7.69
Introduction to ScrollTrigger
Veeg om het menu te tonen
Scroll-based animations can create engaging, interactive web experiences by responding to user scroll actions. GSAP's ScrollTrigger plugin is a powerful tool that allows you to trigger and control animations as elements enter, leave, or move through the viewport. You will use ScrollTrigger when you want your animations to respond directly to scroll position, such as animating sections as they appear on screen, pinning elements, or syncing animation progress with the scroll bar. This approach is widely used for landing pages, storytelling sites, and interactive infographics where scroll progress drives the narrative and visual effects.
index.html
When configuring ScrollTrigger, several key options give you control over how and when your animation plays:
- trigger: the element that
ScrollTriggerwatches for entering or leaving the viewport; - start: defines when the animation should start relative to the trigger and viewport (for example,
"top 80%"means the top of the trigger hits 80% down the viewport); - end: sets when the animation should end (for example,
"top 30%"means the top of the trigger reaches 30% down the viewport); - scrub: links the progress of the animation to the scrollbar, so the animation plays smoothly as you scroll;
- toggleActions: specifies what actions to take when entering or leaving the trigger area, using a sequence like
"play reverse play reverse"(onEnter, onLeave, onEnterBack, onLeaveBack).
By adjusting these options, you can create a wide variety of scroll-based effects—from simple fade-ins to complex, scroll-synced storytelling.
Bedankt voor je feedback!