Swipe cards

Mood track «Balloon Game» · Kevin MacLeod incompetech.com · licensed under Creative Commons BY 4.0
Example image of the style Swipe cards
Preview built in HTML and CSS in this style

Tarjetas deslizables · Swipe cards · Card swipe · Tinder swipe · Mazzo da sfogliare

A deck of stacked cards where the top one is dragged left or right and flies off rotating while the next rises into place. Yes or no in a single gesture, born with dating apps.

Era
2012 – today
Use
Mainstream
Domain
Web / UIMotion
Mood
playfultactileenergetic
Explore

Live demo

View code
<main>
  <div class="stack">
    <article class="c" style="--a:#6C63FF;--b:#FFB86B"><span class="yes">SÌ</span><span class="no">NO</span><div class="pic"><i class="sun"></i><i class="hill"></i></div><h2>Lisbona</h2><p>Tram gialli e tramonti</p></article>
    <article class="c" style="--a:#20C997;--b:#FFF4EC"><span class="yes">SÌ</span><span class="no">NO</span><div class="pic"><i class="sun"></i><i class="hill"></i></div><h2>Dolomiti</h2><p>Rifugi e sentieri</p></article>
    <article class="c" style="--a:#FF4F64;--b:#FFB86B"><span class="yes">SÌ</span><span class="no">NO</span><div class="pic"><i class="sun"></i><i class="hill"></i></div><h2>Marrakech</h2><p>Spezie e terrazze</p></article>
    <article class="c" style="--a:#1F1A24;--b:#6C63FF"><span class="yes">SÌ</span><span class="no">NO</span><div class="pic"><i class="sun"></i><i class="hill"></i></div><h2>Kyoto</h2><p>Templi e aceri rossi</p></article>
  </div>
  <nav><b class="bn">✕</b><b class="by">♥</b></nav>
</main>
<script>
if(matchMedia('(prefers-reduced-motion: no-preference)').matches){
  const st=document.querySelector('.stack');let n=0;
  setInterval(()=>{const top=st.lastElementChild,d=n++%3===1?'l':'r';top.classList.add('go-'+d);
    setTimeout(()=>{top.classList.add('back');top.classList.remove('go-l','go-r');st.prepend(top);
      requestAnimationFrame(()=>requestAnimationFrame(()=>top.classList.remove('back')))},1150)},2300);
}
</script>
body{margin:0;height:100vh;display:grid;place-items:center;background:#FFF4EC;font-family:Poppins,sans-serif;color:#1F1A24;overflow:hidden}
main{display:flex;flex-direction:column;align-items:center;gap:14px}
.stack{position:relative;width:190px;height:240px}
.c{position:absolute;inset:0;background:#fff;border-radius:20px;padding:10px;box-sizing:border-box;box-shadow:0 16px 30px -14px #1F1A2455;transition:transform .4s cubic-bezier(.2,.9,.3,1.2),opacity .3s;transform:translateY(24px) scale(.88);opacity:0}
.c:nth-last-child(1){transform:none;opacity:1}
.c:nth-last-child(2){transform:translateY(10px) scale(.95);opacity:1}
.c:nth-last-child(3){transform:translateY(20px) scale(.9);opacity:.8}
.c.back{transition:none;opacity:0}
.pic{height:150px;border-radius:14px;background:linear-gradient(180deg,var(--a),var(--b));position:relative;overflow:hidden}
.sun{position:absolute;right:22px;top:20px;width:34px;height:34px;border-radius:50%;background:#FFF4EC;opacity:.9}
.hill{position:absolute;left:-20%;right:-20%;bottom:-60px;height:110px;border-radius:50%;background:#1F1A24;opacity:.55}
h2{margin:10px 4px 0;font-size:18px}p{margin:0 4px;font-size:12px;color:#1F1A2499}
.yes,.no{position:absolute;top:22px;z-index:2;font-weight:700;font-size:20px;padding:2px 10px;border:3px solid;border-radius:8px;opacity:0}
.yes{left:20px;color:#20C997;transform:rotate(-14deg)}
.no{right:20px;color:#FF4F64;transform:rotate(14deg)}
nav{display:flex;gap:18px}
nav b{width:44px;height:44px;border-radius:50%;background:#fff;display:grid;place-items:center;font-size:18px;box-shadow:0 8px 18px -8px #1F1A2466}
.bn{color:#FF4F64}.by{color:#20C997}
@media (prefers-reduced-motion:no-preference){
  .go-r{animation:gr 1.1s cubic-bezier(.5,0,.75,0) forwards}
  .go-l{animation:gl 1.1s cubic-bezier(.5,0,.75,0) forwards}
  .go-r .yes,.go-l .no{animation:stamp 1.1s forwards}
  @keyframes gr{0%{transform:none}45%{transform:translate(46px,-6px) rotate(9deg)}100%{transform:translate(380px,-40px) rotate(32deg);opacity:0}}
  @keyframes gl{0%{transform:none}45%{transform:translate(-46px,-6px) rotate(-9deg)}100%{transform:translate(-380px,-40px) rotate(-32deg);opacity:0}}
  @keyframes stamp{0%{opacity:0}35%,100%{opacity:1}}
}

Characteristics

  • Card rotating slightly as it is dragged
  • YES and NO stamps appearing by direction
  • Exit carrying the throw's velocity
  • Scaled cards beneath moving up one slot
  • Elastic return when the gesture is too short

Palette

Click a swatch to copy it

Typography

Headings · Poppins Swipe cards

Body · Poppins A deck of stacked cards where the top one is dragged left or right and flies off rotating while the next rises into place. Yes or no in a single gesture, born with dating apps.

Motion

Easing
segue il dito; spring all'uscita o al ritorno
Typical duration
250–450 ms per volare via; 300–500 ms per il ritorno elastico
Techniques
pointer events con setPointerCapture, transform translate e rotate proporzionali, calcolo della velocità di lancio, Framer Motion drag, react-tinder-card, Hammer.js

Accessibility (reduced motion)

The card leaves with a short fade; YES and NO buttons remain the main alternative to the gesture.

Prompt for your agent

Copy and paste into your prompt to have an agent or image generator reproduce this style.

For web pages and UI

Design the web page or interface in this style: Swipe cards (Tarjetas deslizables).
A deck of stacked cards where the top one is dragged left or right and flies off rotating while the next rises into place. Yes or no in a single gesture, born with dating apps.
Characteristics: Card rotating slightly as it is dragged, YES and NO stamps appearing by direction, Exit carrying the throw's velocity, Scaled cards beneath moving up one slot, Elastic return when the gesture is too short.
Palette: #FFF4EC, #FF4F64, #20C997, #1F1A24, #FFB86B, #6C63FF.
Typography: headings in Poppins, body text in Poppins (Google Fonts or equivalents).
Mood: playful, tactile, energetic.
Motion: easing segue il dito; spring all'uscita o al ritorno, typical duration 250–450 ms per volare via; 300–500 ms per il ritorno elastico; techniques: pointer events con setPointerCapture, transform translate e rotate proporzionali, calcolo della velocità di lancio, Framer Motion drag, react-tinder-card, Hammer.js.
With prefers-reduced-motion: The card leaves with a short fade; YES and NO buttons remain the main alternative to the gesture.
References: Tinder (2012), react-tinder-card, Framer Motion drag, interfacce a schede di app di viaggi e musica.

Relations

Derives from: Physics DragPhysics DragSimilar to: Bottom sheetBottom sheetSimilar to: Full-screen storiesFull-screen storiesSimilar to: Card FlipCard FlipSimilar to: Spring PhysicsSpring PhysicsSwipe cards
Derives fromSimilar toSee in the graph →

References

  • Tinder (2012)
  • react-tinder-card
  • Framer Motion drag
  • interfacce a schede di app di viaggi e musica