GSAP ScrollTrigger + MotionPath Animation Tutorial HTML CSS JS
GSAP ScrollTrigger + MotionPath Animation Tutorial HTML CSS JS
GSAP ScrollTrigger + MotionPath Animation Tutorial HTML CSS JS
Overview
This project is a premium skincare landing page that uses a combination of fixed and animate-on-scroll elements, along with smooth motion paths. By employing HTML + CSS + GSAP we created:
Β
- A floating jar with a skincare label
- Hero text with plant images sliding out
- Ingredient “cards” which slide along a curved SVG path
- Features section with overlay reveal
- Last clean showcase section
Through this project we achieved a luxurious, cinematic scrolling experience that meets our client’s expectations.
π§± Step 1: HTML Structure Explanation
The HTML structure has five main layers.
A. The Fixed Jar Wrapper
<div class=”hero__jar-wrap”>
Β Β Β Β Β <img class=”jar__lid”>
Β Β Β Β Β <img class=”jar__body”>
</div>
Why is it fixed?
As GSAP animates the jar, it remains in the center of the screen with a fixed position the entire time it moves. This causes the lid and jar body to move independently and generate a floating effect.
B. Header
A transparent header that contains the logo and navigation links, which is located above the hero section.
<header class=”site-header”>…</header>
The header will blend into the top of the hero section due to its transparency.
C. Hero Section
The Hero Section will consist of:
- A large title graphic for Freesias
- There will be two images depicting plants (one on the left and one on the right).
- Additionally, the Ingredients section contains a series of curved panels that will have a fixed position.
With this layout, I see a multi-layered cinematic experience being created.
D. Ingredient Card(s) plus SVG Curve
Ingredients Cards and SVG curves will reside in the Hero Section
Why this is essential:
The path is used by MotionPathPlugin
Each ingredient card travels along the curve
Smooth organic movement adds premium visual storytelling
E. Features Section
A Completely Oversized Section Above the Hero Section, which has:Β
margin-top: -100vh;
This allows the cream jar to appear to float over both the Hero Section and the Features Section.
Left side β text & feature items
Right side β large product cream image
Also includes a soft overlay + background image for depth.
F. Showcase Section
A “Clean” section for your viewer to take a moment to “rest” their eyes.
This Section will be displayed Full Screen with a Centered Layout.
π§± Step 2: Why .hero__jar-wrap is Outside All Sections
The main purpose of the .hero__jar-wrap outside of any of the 3 main sections is 1 of the most important decisions for the overall architecture of this website.
Reason 1 β It must stay fixed
The jar can have movements through all 3 sections.
- If the jar is located inside the HERO section, it would scroll away when the user scrolls down in the browser.
- The jar animations don’t follow the GSAP Pinned Animation.
- Any other movements that the jar would need to follow would be above or below any other layer.
Reason 2 β To animate globally
As the jar’s movements can happen through all 3 sections and they are all happening in different locations.
By putting .hero__jar-wrap outside of the sections, it will always be able to animate it globally.
Reason 3 β Itβs visually layered above everything
The z-index of 1000 will provide the developer with full control over how all the layers stack.
This is a very common practice in creating GSAP websites.
π§± Step 3: SVG Curve Path Explanation
The path:
M 5 5 A 100 100 0 0 0 205 5
M 5 5 A 100 100 0 0 0 205 5
Path Breakdown:
Β
- M 5 5 Move to the starting point
- A 100 100 Draw an arc with a radius of 100
- Inside 0 0 0: Arc flags (direction, rotation, and sweep)
- 205 5 Ending point for the arc
The gentle curve is a great way to create smooth animation movements for each ingredient card.
GSAP maps the location of each ingredient card on this path using:
π§± Step 3: Responsive Animated Navbar
The navigation bar for this project will consist of:
- Logo
- Search Icon
- Cart Icon
- Animated Hamburger Icon
- Stagger Fade Navigation Items
HTML:
<nav class=”navbar”>
Β Β Β <div class=”navbar__logo”>
Β Β Β Β Β <img src=”logo.png” alt=”logo”>
Β Β Β </div>
Β Β Β <ul class=”navbar__menu” id=”navbar__menu-links”>
Β Β Β Β Β <li class=”navbar__menu-item”><a href=”#”>Home</a></li>
Β Β Β Β Β <li class=”navbar__menu-item”><a href=”#”>About</a></li>
Β Β Β Β Β <li class=”navbar__menu-item”><a href=”#”>Hoodies</a></li>
Β Β Β Β Β <li class=”navbar__menu-item”><a href=”#”>Collection</a></li>
Β Β Β Β Β <li class=”navbar__menu-item”><a href=”#”>Contact</a></li>
Β Β </ul>
CSS:
menuIcon.addEventListener(‘click’, () => {
Β Β Β navLinks.classList.toggle(‘open’);
Β
Β Β Β if (navLinks.classList.contains(‘open’)) {
Β Β Β Β menuIconChild.classList.replace(‘ri-menu-4-fill’,’ri-close-large-line’);
Β Β Β
Β Β Β Β menuItems.forEach((item, index) => {
Β Β Β Β Β Β Β setTimeout(() => item.classList.add(‘show’), index * 100);
Β Β Β Β });
Β
Β Β Β } else {
Β Β Β Β menuIconChild.classList.replace(‘ri-close-large-line’,’ri-menu-4-fill’);
Β Β Β Β menuItems.forEach(item => item.classList.remove(‘show’));
Β Β Β }
});
When the user hovers over each item on the navigation bar, it will fade in with a smooth downward animation.
π§± Step 4: Hero Section with a 3D Layered Textand a Beautiful Main Hoodie
The hero section contains:
- A very stylish handwritten cursive winter tagline,
- An extremely bold stretched HOODIE title,
- The main hoodie image,
- Perfect z-index at the right spot for layering, and
- Glassmorphism cards behind the main hoodie image.
HTML:
<div class=”hero__text”>
Β Β Β <h4>Winter Special</h4>
Β Β Β <h1>HOODIE</h1>
</div>
<div class=”hero__image”>
Β Β Β <img src=”hoodie.png” alt=”hoodie”>
</div>
CSS:
.hero__text h1 {
Β Β transform: scale(1, 1.5);
Β Β letter-spacing: 5px;
}
The way the typography is laid out also gives off a high-end luxury feel to the hoodie.
π§± Step 5: Floating Glassmorphism Info Panels
Behind the hoodie are two floating frosted information panels that list the following features:
- Qualitiy of Material
- Comfort LevelΒ
- DurabilityΒ
- Quality StitchingΒ
CSS:
.info__box {
Β Β width: 650px;
Β Β background: var(–glass-morphism);
Β Β backdrop-filter: blur(20px);
Β Β border-radius: 15px;
Β Β border: 1px solid var(–primary-color);
Β Β padding: 30px 60px;
Β Β position: absolute;
}
Β
.info__box.left { left: -1%; bottom: 30%; }
.info__box.right { right: -1%; top: 30%; }
A great way to present something new and classy!
π§± Step 6: Footer with Contact, Order, and Social Media Icons
The footer contains:
- A contact number
- ORDER NOW button
- Shopping cart icon
- Glassmorphism social media icons
- Hover interaction. HTML and Hover Glow Effects are used.
HTML:
<div class=”orderBox”>
Β Β <div class=”orderIcon”><i class=”ri-shopping-cart-2-line”></i></div>
Β Β <button class=”orderBtn”>ORDER NOW!</button>
</div>
Hover Glow Effect:
.orderBox:hover .orderIcon,
.orderBox:hover .orderBtn {
Β Β Β border-color: #ffc800;
Β Β Β transform: translateY(-2px);
}
This provides a premium winter look!
β¨ Final Result - What you've built!
- A high-end animated hoodie web page
- Fully responsive mobile navigation systems
- A glassmorphism hero section styled for winter
- New extreme stretched HOODIE typeface
- Two floating frosted informational boxes
- A frosted nav bar with animations
- A section for ordering and social media with neon flashes on hover.
- Great for winter brands, clothing sellers, eCommerce stores, showcasing products, etc!
Design Synth
Welcome to Design Synth! Enter the world of web design, where art meets code. Find awesome designs, practice new techniques, and churn out stunning digital experiences that excite and engage an audience.
Popular Posts
Explore Topics
- Card Design (4)
- Carousel (2)
- CSS and HTML (10)
- Design Synth (11)
- Form Designs (1)
- GSAP (4)
- Header Design (8)
- Hover Effect (4)
- JavaScript (9)
- Navbar Designs (4)
- Parallax (1)
- Slider Designs (2)
- Template Designs (3)
- WordPress (1)
Tag Clouds
- Animation Effects
- Animation Image
- Animation Text
- AOS Animation
- Button
- Card Design
- Cards Design
- Carousel
- Code Tutorials
- Creative Web Templates
- CSS and HTML
- Design Synth
- Effect Image
- Effect Scroll
- Form Design
- Form Designs
- Free Website Template
- Front-End Design
- Glassmorphism Design
- GSAP Animation
- Halloween
- Header Design
- Hover Effects
- HTML
- HTML CSS Projects
- JavaScript
- JS
- Modern Website Design
- Navbar Design
- Navbar Designs
- Parallax Effect
- Parallax Scroll CSS
- Plane Website
- Responsive
- Responsive Design
- Slider Design
- Slider Designs
- SVG
- Tailwind CSS
- Template Designs
- UI Design
- UX Design
- Web Design
- Web Development
- Website Templates
- WordPress Website