š§ Description
This project demonstrates a smooth scroll-based panel animation using GSAP ScrollTrigger.
Each fullscreen section pins to the viewport, then scales down and fades out as the user scrolls ā creating a clean, cinematic transition between sections.
Why This Animation Feels Premium
- Fullscreen panel-based layout
- Scroll-driven scale & opacity animation
- Smooth pinning without layout jumps
- Minimal and modern UI
- GPU-friendly transform animations
- Perfect for landing pages, portfolios, and storytelling websites
Core Concept
Each .panel:
- Occupies 100vh
- Pins itself when reaching the viewport bottom
- Scales down (
1 ā 0.6) - Fades out (
opacity: 1 ā 0) - Unpins smoothly so the next section can take over
All motion is controlled purely by scroll ā no timelines required.
š» Step 1: HTML Structure
Complete HTML Code
HTML Breakdown
.slides-wrapper holds all scroll sections
Each .panel is a fullscreen slide
Headings + images create visual hierarchy
GSAP & ScrollTrigger loaded via CDN for simplicity
šØ Step 2: CSS ā Layout & Visual Styling
CSS Code
CSS Breakdown
CSS Variables ā Easy theme control
100vh panels ā Fullscreen experience
Flexbox centering ā Perfect alignment
Clamp() typography ā Responsive headings
Perspective ā Prepares for future 3D effects
āļø Step 3: JavaScript ā GSAP ScrollTrigger Logic
JavaScript Code
JavaScript Breakdown
Key Concepts Used:
ScrollTrigger.registerPlugin() ā Enables scroll-based animations
gsap.utils.toArray() ā Converts NodeList into an array
fromTo() ā Explicit start & end animation states
scrub: true ā Smooth frame-by-frame scroll sync
pin: true ā Locks panel in viewport
pinSpacing: false ā Prevents extra space after pin
Scroll Flow Explanation
Panel reaches bottom of viewport
Panel pins instantly
Scale + opacity animate on scroll
Panel releases smoothly
Next panel takes over
