webdevpuneet.com

Scroll Polaroid Stack Flip — Photo Wall Sort, GSAP

Scroll Polaroid Stack Flip · Scroll · Plain HTML, CSS & JS · Live preview

About this UI Snippet

Scroll Polaroid Stack Flip — A Pile of Photos That Sorts Itself Onto a Corkboard

Screenshot of the Scroll Polaroid Stack Flip snippet rendered live

A messy pile of instant photos sits on a corkboard. As you scroll, the top one lifts off, flips over in mid-air to show a handwritten note and a date stamp on the back, turns face up again and lands in its spot on the board at a slight tilt. A strip of tape sticks it down, and the photo develops from a pale, washed-out print to full colour, the way a real instant photo does. A counter shows how many photos are on the wall, and a handwritten "Summer, kept." appears when the last one lands. Scroll back up and everything comes off the wall in reverse.

One timeline, one unit per photo

The stage is pinned with ScrollTrigger and drives one GSAP timeline with scrub: 0.8. Each photo owns one unit of that timeline: from 0 to 0.25 it lifts off the pile (up 46 px, scaled to 1.14, tilted back with rotateX, a deeper shadow and a z-index above the rest), from 0.25 to 0.85 it flies to its slot, and around 0.85 the tape snaps on. The scroll length is worked out from the number of photos, so adding a seventh photo adds its own stretch of scroll automatically.

A real flip with two faces

Each card has a front face (white border, photo, handwritten caption) and a back face (lined paper, note, date stamp) stacked on top of each other with backface-visibility: hidden, and the back is turned with rotateY(180deg). The card itself keeps transform-style: preserve-3d inside a stage with perspective: 1400px. During the flight the card turns a full 360° on the Y axis, so you see the back for the middle half of the trip and it lands face up again. With prefers-reduced-motion, the turn is skipped and the scrub becomes direct.

Developing as it lands

Every photo starts with a filter of high brightness, low saturation, a little sepia, low contrast and a slight blur. A fromTo tween brings it to a neutral filter while the card is in the air, so the picture comes into focus and colour just as it reaches the board. GSAP can tween the whole filter string because both ends list the same functions in the same order. The shadow works the same way: boxShadow tweens from a short resting shadow to a long lifted one and back.

The board layout is just CSS

The final spots are empty .pf-slot elements in a CSS grid (3 × 2 on desktop, 2 × 3 on phones), each with a data-r tilt. The script measures the offset from the pile to the centre of each slot with getBoundingClientRect(), and the tween values are functions, so with invalidateOnRefresh: true ScrollTrigger re-measures them on every resize. Change the grid, the gaps or the breakpoint and the photos still land in the right place. The pile is described the same way: data-x, data-y and data-r on each card set where it lies before it is picked up.

Sized from one variable

Card size, caption size, note size and board cells all come from one --cw custom property that depends on both the screen width and height, so the whole wall fits on a laptop, a tall phone or a wide monitor without scrolling inside the stage. The corkboard is three gradient layers (two speckle patterns over a warm base) with an inset shadow for depth, and the captions and notes use the Caveat handwriting font.

For other stack and card effects, see Scroll Card Deck Shuffle and Scroll Book Shelf Slide.

What's included

Features

Each photo lifts off the pile, flips a full 360° in 3D to show a handwritten note on the back, and lands face up
Photos develop from pale and blurry to full colour as they land, like real instant prints
Tape strip snaps on when a photo lands, with a slight tilt per slot for a hand-pinned look
Board positions come from a CSS grid and are measured live, and re-measured on resize
One pinned, scrubbed GSAP timeline with one unit per photo, so adding photos adds scroll length automatically
Live "on the wall" counter and a handwritten closing line after the last photo
Corkboard made from layered CSS gradients, with the Caveat handwriting font for captions and notes
Sized from one --cw variable to fit any screen, with a 2-column phone layout and reduced-motion support

Step by step

How to Use

  1. 1
    Load GSAP and ScrollTriggerAdd gsap.min.js and ScrollTrigger.min.js from the CDN panel, in that order, before the snippet JS.
  2. 2
    Scroll through the stageIt pins in place. Each photo lifts, flips over to show its note, lands on the board, gets taped down and develops. The counter goes up as each one lands.
  3. 3
    Scroll back upThe photos come off the board, flip back and drop onto the pile in reverse order.
  4. 4
    Use your own photos and notesChange the img src and alt, the caption, the note and the date in each .pf-card.
  5. 5
    Add a photoAdd a .pf-card with its pile position (data-x, data-y, data-r) and a matching .pf-slot with its tilt (data-r). Adjust the grid columns or rows if needed, and update the "/ 6" in the counter.
  6. 6
    Change the lookEdit --cw for card size, the .pf-stage background for a different board, or the UNDEVELOPED filter in the JS for a stronger or softer developing effect.

Real-world uses

Common Use Cases

Photography and travel portfolios
Turn a set of trip photos into a story, with a note on the back of each print.
Wedding, event and memory pages
Let guests scroll through moments from the day, each with a short message on the back.
Memories and album app landing pages
Show photos being sorted into an album as the page explains the product.
Team and testimonial walls
Use portraits on the front and a quote or role on the back of each card.
Learning 3D card flips with GSAP
A clear example of two-face cards with backface-visibility, scrubbed rotateY, and tweening filter and box-shadow strings.

Got questions?

Frequently Asked Questions

The final spots are empty .pf-slot elements in a CSS grid. The script measures the offset from the pile to the centre of each slot with getBoundingClientRect(). The tween values are functions and the ScrollTrigger has invalidateOnRefresh: true, so the offsets are measured again whenever the window is resized.

Each card has a front face and a back face on top of each other, both with backface-visibility: hidden, and the back is rotated 180° on the Y axis. The card uses transform-style: preserve-3d inside a stage with perspective. During its flight the card turns 360°, so the back faces the viewer for the middle part of the trip and the photo lands face up.

Each photo starts with a CSS filter of high brightness, low saturation, some sepia, low contrast and a slight blur. A GSAP fromTo tween changes it to a neutral filter while the card flies, so the picture sharpens and gains colour as it lands. Both filter strings list the same functions in the same order, which lets GSAP tween every number in them.

Add a .pf-card (with data-x, data-y and data-r for its place in the pile) and a .pf-slot (with data-r for its tilt on the board), and make sure the board grid has room for it. The timeline gives every card its own unit and the scroll length is based on the number of cards, so no other code changes are needed. Remember to update the total in the counter text.

Yes. Click JSX for a React component, Vue for a Vue 3 SFC or Angular for a standalone component. Build the timeline in a mount effect (gsap.context helps), and revert the context on unmount so the ScrollTrigger pin is removed.

Copy & paste

Source Code

<section class="pf-stage" id="pfStage">
  <header class="pf-head">
    <span class="pf-kicker">Summer trip · 6 photos</span>
    <h2>Sort the pile</h2>
  </header>
  <p class="pf-count" aria-live="polite"><strong id="pfCount">0</strong> / 6 on the wall</p>

  <!-- Where each photo ends up. The script measures these, so the layout is pure CSS. -->
  <div class="pf-board" aria-hidden="true">
    <span class="pf-slot" data-r="-4"></span>
    <span class="pf-slot" data-r="3"></span>
    <span class="pf-slot" data-r="-2"></span>
    <span class="pf-slot" data-r="2.5"></span>
    <span class="pf-slot" data-r="-3"></span>
    <span class="pf-slot" data-r="4"></span>
  </div>

  <!-- The pile: data-x / data-y / data-r = where each photo lies before it is picked up. -->
  <div class="pf-pile">
    <article class="pf-card" data-x="-10" data-y="6" data-r="-9">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1015/480/400" alt="Fjord between granite cliffs"></div><p class="pf-cap">Lysefjord</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Day 2. Legs gone, view worth every step.</p><span class="pf-date">Jul '26</span></div>
    </article>
    <article class="pf-card" data-x="12" data-y="-4" data-r="7">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1016/480/400" alt="Red canyon rocks at sunset"></div><p class="pf-cap">Canyon light</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Waited an hour for this light. Totally worth it.</p><span class="pf-date">Jul '26</span></div>
    </article>
    <article class="pf-card" data-x="-4" data-y="-10" data-r="-3">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1036/480/400" alt="Tents in snow below mountains"></div><p class="pf-cap">Base camp</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Coldest night of my life. Best stars too.</p><span class="pf-date">Aug '26</span></div>
    </article>
    <article class="pf-card" data-x="8" data-y="10" data-r="11">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1039/480/400" alt="Waterfall in a green gorge"></div><p class="pf-cap">The falls</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Soaked through. Didn't care one bit.</p><span class="pf-date">Aug '26</span></div>
    </article>
    <article class="pf-card" data-x="-14" data-y="-2" data-r="5">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1043/480/400" alt="Pine forest and granite peaks"></div><p class="pf-cap">Valley floor</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Swam in that river. Ice cold, zero regrets.</p><span class="pf-date">Aug '26</span></div>
    </article>
    <article class="pf-card" data-x="4" data-y="2" data-r="-6">
      <div class="pf-face pf-front"><span class="pf-tape"></span><div class="pf-photo"><img src="https://picsum.photos/id/1044/480/400" alt="Hiker by a misty river"></div><p class="pf-cap">Trail's end</p></div>
      <div class="pf-face pf-back"><p class="pf-note">Last morning. Already planning the next one.</p><span class="pf-date">Aug '26</span></div>
    </article>
  </div>

  <p class="pf-final">Summer, kept.</p>
  <p class="pf-hint" aria-hidden="true">Scroll to sort the pile ↓</p>
</section>

<section class="pf-after">
  <h2>All on the wall.</h2>
  <p>Scroll back up and the photos come off the board, flip back over and drop onto the pile in reverse.</p>
</section>

Extend with AI

Take This Snippet Further With AI

You do not need to work out 3D card flips and scrubbed timelines from scratch. Paste this snippet's HTML, CSS and JS into an AI assistant like Claude and ask it how the two faces and backface-visibility make the flip work, why the tween values are functions, or how GSAP can tween a whole filter string. It can also help you extend it: let visitors click a photo on the wall to open it larger, add a pushpin or a paper clip as an alternative to tape, shuffle the board layout on each visit, or load the photos and notes from a JSON file.

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-driven "polaroid pile sorts onto a corkboard" section in HTML, CSS and JavaScript using GSAP and ScrollTrigger from a CDN.

Requirements:
- A full-screen pinned stage with a corkboard background made of CSS gradients (two speckle layers over a warm base, inset shadow) and perspective: 1400px. A small header ("Sort the pile"), a counter ("0 / 6 on the wall") and a scroll hint.
- An invisible board: a CSS grid of 6 empty slots (3 x 2, or 2 x 3 on phones), each with a data-r tilt.
- A pile of 6 polaroid cards at one point, each placed by data-x, data-y and data-r. Each card has transform-style: preserve-3d and two faces with backface-visibility: hidden: the front (white frame, photo, handwritten caption in the Caveat font, a strip of tape) and the back (lined paper, a handwritten note, a date stamp), rotated 180deg on Y.
- Size everything from one --cw custom property based on screen width and height.
- One GSAP timeline with a pinned ScrollTrigger (scrub about 0.8, end based on the number of cards, invalidateOnRefresh: true). Each card gets one unit: lift (y -46, scale 1.14, rotateX 16, deeper box-shadow, z-index on top), then fly to its slot (x and y as functions that measure the slot centre relative to the pile with getBoundingClientRect, rotate to the slot tilt, rotateY 360 so the back shows mid-flight, scale 1), then the tape pops in.
- The photo filter tweens from an "undeveloped" string (sepia, low saturation, high brightness, low contrast, slight blur) to neutral while the card flies, so it develops as it lands.
- Update the counter as each card lands, fade the hint once scrolling starts, and fade in a handwritten closing line after the last card.
- With prefers-reduced-motion, skip the rotateY flip and use scrub: true. Scrolling back up must reverse everything.

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.