Orbs

Aurora backdrop

A mesh gradient made of four screen-blended blobs. The grain layer is the part that matters — it kills the banding you get on large blurred gradients.

  • background
  • mesh
  • hero
  • grain

Preview

Ambient backdrop

Drop it into any relative container — it fills the box and sits behind the content.

Usage

<div className="relative">
  <Aurora blur={70} opacity={0.55} />
  <Hero />
</div>
import { cn } from "@/lib/cn";

export interface AuroraProps {
  colors?: string[];
  /** Blur radius in px — larger reads as further away. */
  blur?: number;
  speed?: number;
  opacity?: number;
  /** Fine grain over the gradient, which hides banding on wide surfaces. */
  grain?: boolean;
  className?: string;
}

/**
 * Ambient mesh-gradient backdrop. Absolutely positioned — drop it inside any
 * `relative` container and it fills it.
 */
export function Aurora({
  colors = ["#6d5efc", "#22d3ee", "#f472b6", "#facc15"],
  blur = 70,
  speed = 18,
  opacity = 0.55,
  grain = true,
  className,
}: AuroraProps) {
  return (
    <div
      aria-hidden
      className={cn("pointer-events-none absolute inset-0 overflow-hidden", className)}
      style={{ opacity }}
    >
      {colors.map((color, i) => (
        <span
          key={i}
          className="absolute rounded-full"
          style={{
            width: `${52 + i * 9}%`,
            height: `${52 + i * 9}%`,
            left: `${[4, 46, 22, 62][i % 4]}%`,
            top: `${[8, 34, 52, -6][i % 4]}%`,
            background: color,
            filter: `blur(${blur}px)`,
            mixBlendMode: "screen",
            animation: `drift ${speed + i * 4}s ease-in-out infinite`,
            animationDelay: `${i * -3}s`,
            animationDirection: i % 2 ? "reverse" : "normal",
          }}
        />
      ))}
      {grain && (
        <span
          className="absolute inset-0 opacity-[.14] mix-blend-overlay"
          style={{
            backgroundImage:
              "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E\")",
          }}
        />
      )}
    </div>
  );
}

export default Aurora;