StealThis .dev

Staggered Grid Entrance

Grid items animate in with position-based stagger delays. Multiple animation styles: fade, scale, slide, flip.

Open in Lab
intersection-observercss-keyframes
Targets: JS HTML

Code

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #070a12;
  --panel: #121a2b;
  --border: #263249;
  --text: #f0f4fb;
  --muted: #8a95a8;
  --accent: #86e8ff;
  --neon-purple: #ae52ff;
  --neon-pink: #ff40d6;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'SF Pro Display', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  text-align: center;
  padding: 5rem 2rem 2rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--muted);
  max-width: 480px;
  margin: 0.75rem auto 0;
  line-height: 1.6;
}

/* ── Style picker ── */
.style-picker {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 2rem 2rem;
  flex-wrap: wrap;
}

.style-btn {
  padding: 0.45rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: 600 0.78rem/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.25s ease;
}

.style-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.style-btn.active {
  background: rgba(134, 232, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

/* ── Grid items ── */
.grid-item {
  aspect-ratio: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  will-change: transform, opacity;

  /* Initial hidden state */
  opacity: 0;
}

.grid-item .item-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg,
    hsl(var(--item-hue, 200) 70% 70%),
    hsl(calc(var(--item-hue, 200) + 40) 60% 50%)
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grid-item .item-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ══════════════════════
   Animation styles
   ══════════════════════ */

/* Fade Up (default) */
.anim-fade-up {
  transform: translateY(40px);
}
.anim-fade-up.visible {
  animation: fadeUp 0.6s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Scale In */
.anim-scale-in {
  transform: scale(0.7);
}
.anim-scale-in.visible {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes scaleIn {
  to { opacity: 1; transform: scale(1); }
}

/* Slide Sides (alternating left/right) */
.anim-slide-sides {
  transform: translateX(var(--slide-dir, 1) * 60px);
}
.anim-slide-sides.visible {
  animation: slideSide 0.6s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes slideSide {
  to { opacity: 1; transform: translateX(0); }
}

/* Flip */
.anim-flip {
  transform: perspective(600px) rotateY(60deg);
}
.anim-flip.visible {
  animation: flip 0.7s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes flip {
  to { opacity: 1; transform: perspective(600px) rotateY(0deg); }
}

/* ── Reduced motion ── */
.reduced-motion .grid-item {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem;
}

.btn-back {
  display: inline-block;
  padding: 0.7rem 2rem;
  border-radius: 999px;
  border: 1px solid rgba(134, 232, 255, 0.3);
  color: var(--accent);
  text-decoration: none;
  font: 600 0.85rem/1 'Inter', system-ui, sans-serif;
  transition: all 0.25s ease;
}

.btn-back:hover {
  background: rgba(134, 232, 255, 0.08);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    padding: 0 1rem 2rem;
  }
}

Staggered Grid Entrance

Grid items animate in with position-based stagger delays. Multiple animation styles: fade, scale, slide, flip.

Source

  • Repository: libs-genclaude
  • Original demo id: 19-staggered-grid

Notes

Grid items animate in with position-based stagger delays. Multiple animation styles: fade, scale, slide, flip.