Back to library
INTERACTION_156

Interactive Dots.

A dot matrix reacts softly to the pointer. All dots at 12% opacity before the trigger; raising dot opacity and scale inside a radius around the pointer once pointer movement over the section.

CATEGORY
Background
COMPLEXITY
Easy
TECH
CSS + JS
PLATFORM
Desktop
PERFORMANCE
Light
LIVE PLAYGROUND
CSS / CSS
/* Interactive Dots — A dot matrix reacts softly to the pointer. */
.interactive-dots {
  --dur: 260ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger: 60ms;
  will-change: transform, opacity;
}

.interactive-dots > * {
  opacity: 0;
  transform: translateY(14px);
  animation: interactive-dots-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* all dots at 12% opacity -> raising dot opacity and scale inside a radius around the pointer */
@keyframes interactive-dots-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .interactive-dots > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Interactive Dots — trigger: pointer movement over the section */
export function InteractiveDots({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="interactive-dots" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

LOVABLECURSORBOLTV0REPLITWINDSURFLOVABLECURSORBOLTV0REPLITWINDSURF
INTERACTION_022CSS

Logo Marquee

Infinite horizontal scroll with edge fades.

Background / LightView
STRUCTURE / 56PX
INTERACTION_023CSS

Tech Grid

Faint technical grid with a radial fade.

Background / LightView
TEXTURE / 3%
INTERACTION_024CSS

Grain Overlay

Film grain that stops black from looking flat.

Background / LightView
INTERACTION_147CSS

Gradient Mesh

Soft overlapping gradients drift behind the content.

Background / MediumView