webdevpuneet.com

Scroll Zipper Reveal: GSAP Unzip Section Transition

Scroll Zipper Reveal: GSAP Unzip Section Transition · Scroll · Plain HTML, CSS & JS · Live preview

Copy & paste

Source Code

<section class="zp-stage" id="zpStage">
  <div class="zp-back">
    <p class="zp-kicker">Unzipped</p>
    <h1>Everything was packed inside</h1>
    <p class="zp-sub">Scroll drags the pull down the page and the fabric peels open in a widening V.</p>
    <div class="zp-chips"><span>Pockets</span><span>Lining</span><span>Hidden seams</span></div>
  </div>
  <div class="zp-half zp-left" id="zpLeft"></div>
  <div class="zp-half zp-right" id="zpRight"></div>
  <svg class="zp-teeth" id="zpTeeth" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
    <line id="zpTL" x1="50" y1="0" x2="50" y2="0"/>
    <line id="zpTR" x1="50" y1="0" x2="50" y2="0"/>
    <line id="zpTC" x1="50" y1="0" x2="50" y2="100"/>
  </svg>
  <div class="zp-pull" id="zpPull" aria-hidden="true"><span></span></div>
  <p class="zp-hint" id="zpHint">Scroll to unzip &darr;</p>
</section>
<section class="zp-after"><p>The cover has slid away, so the page carries on as normal.</p></section>

Extend with AI

Take This Snippet Further With AI

Paste this snippet into an AI coding assistant and ask it to explain how one scrubbed progress value is turned into two clip-path polygons, SVG tooth lines and a moving pull, and why that makes the zip reversible. Good follow-ups: a horizontal zipper that opens left to right, a version where the opened gap shows a video instead of text, or a snap point at half-open. Ask it to keep reduced-motion behaviour when it changes anything.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a "scroll zipper reveal" in plain HTML, CSS and JavaScript using GSAP with ScrollTrigger (from a CDN).

Requirements:
- A full-viewport pinned stage. Behind a dark fabric cover sits the content to reveal (kicker, headline, short paragraph and a few chips). After the stage comes a normal section so the page continues.
- The cover is two absolutely positioned halves with a repeating diagonal stripe texture. A gold zipper pull sits on the centre line and moves from the top edge to the bottom as the user scrolls.
- Drive everything from one object {p:0} tweened to 1 by a pinned ScrollTrigger (pin: true, scrub about 0.4, end: '+=2200'). A single draw(p) function updates every visual so scrubbing backward re-zips exactly.
- In draw(p), clip each half with a polygon so the notch tip sits at y = p*100% and the notch is wider at the top edge than at the tip (a V). Mirror the polygon on the right half.
- Draw the teeth as three SVG lines (viewBox 0 0 100 100, preserveAspectRatio none) with stroke-dasharray and vector-effect non-scaling-stroke: two along the open edges and one along the closed seam below the pull.
- Fade the "Scroll to unzip" hint out early. Let the pull reach the bottom at 90% progress, then in the last 10% keep moving it below the screen while widening the opening (do not slide the halves separately, or the teeth detach from the fabric edge) until no fabric remains.
- If prefers-reduced-motion is set, call draw(1) and skip the pin.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

What's included

Features

Zipper pull follows scroll
A gold slider travels the full height of the page as you scroll.
V-shaped opening
Two mirrored clip-path polygons open wider at the top edge than at the pull.
Dashed SVG teeth
Pixel-sized teeth stay crisp while the SVG stretches to any screen size.
Fully reversible
One progress value drives the visuals, so scrolling up re-zips exactly.
Opens fully clear
The last stretch widens the V past the screen edges, so nothing blocks the content.
Pinned stage
The section holds still while scroll distance converts into zip progress.
Reduced-motion safe
With prefers-reduced-motion the page starts fully open with no pin.
Editable textures
Stripe colours, pull gradient and opening width are plain CSS and one constant.

About this UI Snippet

Scroll Zipper Reveal: Unzip One Section to Show the Next

Screenshot of the Scroll Zipper Reveal: GSAP Unzip Section Transition snippet rendered live

This snippet covers the first screen like a zipped jacket. While the stage is pinned, scroll progress drags a zipper pull from the top edge to the bottom, and the fabric peels back in a widening V so the section underneath shows through the opening. When the pull reaches the hem, both halves slide off-screen and the page scrolls on normally.

One number drives everything

A plain object { p: 0 } is tweened to 1 by a pinned ScrollTrigger with scrub: 0.4. A single draw(p) function turns that number into every visual change: the clip-paths, the SVG teeth and the pull's position. Nothing else animates, so scrolling back up re-zips the jacket exactly as it opened.

The V opening is a clip-path

The cover is two full-size layers. The left layer is clipped with polygon(0 0, (50-g)% 0, 50% y%, 50% 100%, 0 100%) and the right layer mirrors it. As y follows the pull down, the notch grows longer, and g makes it wider at the top, so the opening reads as a V rather than a slit.

Teeth are dashed SVG lines

Three <line> elements use stroke-dasharray: 4 4 and vector-effect: non-scaling-stroke. The dash size stays in real pixels even though the SVG is stretched over the stage. Two lines trace the open edges and one traces the still-closed seam below the pull.

Pinned scroll distance

end: '+=2200' sets how much scrolling one full unzip takes. Raise it for a slower, more deliberate zip. Once the pull reaches the bottom edge (90% of the scroll), it keeps going below the screen and the opening widens to match, so the teeth stay attached to the fabric edge until no fabric is left covering the content.

Motion preferences and content

The revealed section is ordinary HTML, readable without the animation. With prefers-reduced-motion, the script calls draw(1) and skips the pin entirely. To restyle it, change the G constant for the opening width, the stripe colours of .zp-half, or the pull's gradient. A scroll curtain reveal or thread stitch reveal makes a good neighbour on the same page.

Step by step

How to Use

  1. 1
    Add the GSAP CDNsInclude gsap and ScrollTrigger from the CDN panel.
  2. 2
    Paste HTML, CSS and JSA fabric cover with a zipper sits over the section you want to reveal.
  3. 3
    Put your content in .zp-backWhatever lives in that layer is what the zip uncovers.
  4. 4
    Scroll downThe pull slides down and the fabric opens in a V behind it.
  5. 5
    Tune the feelChange end: '+=2200' for zip length and G for the width of the opening.
  6. 6
    Scroll back upThe zip closes again because the whole effect is driven by one progress value.

Real-world uses

Common Use Cases

Apparel and bag brand launches
Open a product page by unzipping a jacket or bag, then reveal the lining, pockets and materials as the next section underneath.
Packaging and unboxing stories
Use the zip as the first interaction of a story page so the visitor opens the product before reading about it.
Section transitions on long pages
Replace a plain fade between hero and features with something physical, in the spirit of a scroll curtain reveal.
Portfolio case-study openers
Cover the project title with fabric, then unzip to the process and results. Pair it with a scroll pin steps section.

Got questions?

Frequently Asked Questions

Each half is a full-size layer clipped by a polygon. The notch's tip is at the pull's y position, and its top corners sit g percent either side of the centre line. Increasing g with progress makes the opening wider near the top, which gives the V.

Tweening clip-paths, SVG attributes and the pull separately would need matching timelines. A single object that goes from 0 to 1, rendered by draw(p), keeps everything in sync and makes scrubbing in either direction exact.

Yes. The end value of the ScrollTrigger, '+=2200', is the scroll distance for the whole zip. A larger number means more scrolling per unzip. Lower scrub values feel snappier, higher ones lag more.

Run the setup inside a mount effect with refs for the stage, halves and pull. Keep the ScrollTrigger returned by create() and kill it in the cleanup so pins don't stack up when the component re-renders.