Motion & effects / Animated backgrounds

Persistent WebGL Backdrop

Full-bleed 1440×900 canvas fixed behind the content showing a faint pale 3D form that shows through the periwinkle canvas. A 270° dark scrim gradient overlays media sections.

Rebuilt from lusion.co in the Periwinkle Studio Float style.

npx shadcn@latest add https://justyoink.it/r/periwinkle-studio-float/blocks/persistent-webgl-backdrop.json

Looks exactly like lusion.co: brings its fonts and colours, namespaced so your own theme stays untouched.

Images2 in this component. Swap any for a library image or one of your own.All images in this style →

Choose an image

Image

Loading…

Usage

Props: heading, caption, imageSrc, imageSrc2. The fixed backdrop form drifts with pointer movement and scroll; place the component at the page root so content scrolls over it.

components/persistent-webgl-backdrop.tsx
import { useEffect, useRef } from "react";

export default function PersistentWebglBackdrop({
  heading = "Selected Projects",
  caption = "A collection of playful interface studies made for curious product teams and bold founders.",
  imageSrc = "https://justyoink.it/stock/product-5.jpg",
  imageSrc2 = "https://justyoink.it/gen/bg-clouds-pastel.webp",
}: {
  heading?: string;
  caption?: string;
  imageSrc?: string;
  imageSrc2?: string;
}) {
  const formRef = useRef<HTMLDivElement>(null);
  const target = useRef({ x: 0, y: 0, s: 0 });
  const cur = useRef({ x: 0, y: 0, s: 0 });

  useEffect(() => {
    const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
    const onMove = (e: PointerEvent) => {
      target.current.x = (e.clientX / window.innerWidth - 0.5) * 2;
      target.current.y = (e.clientY / window.innerHeight - 0.5) * 2;
    };
    const onScroll = () => {
      target.current.s = window.scrollY / 900;
    };
    window.addEventListener("pointermove", onMove);
    window.addEventListener("scroll", onScroll, { passive: true });
    let raf = 0;
    const tick = () => {
      const c = cur.current;
      const t = target.current;
      c.x += (t.x - c.x) * 0.06;
      c.y += (t.y - c.y) * 0.06;
      c.s += (t.s - c.s) * 0.06;
      if (formRef.current && !reduce) {
        formRef.current.style.transform = `translate3d(${c.x * 30}px, ${c.y * 20 - c.s * 120}px, 0) rotate(${c.x * 8 + c.s * 25}deg) scale(${1 + c.s * 0.1})`;
      }
      raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => {
      cancelAnimationFrame(raf);
      window.removeEventListener("pointermove", onMove);
      window.removeEventListener("scroll", onScroll);
    };
  }, []);

  return (
    <div className="relative min-h-[200vh] bg-canvas font-sans text-ink">
      <div aria-hidden="true" className="pointer-events-none fixed inset-0 z-0 overflow-hidden">
        <div ref={formRef} className="absolute left-[42%] top-[18%] h-[60vh] w-[22vw] min-w-[160px] will-change-transform">
          <div className="absolute inset-0 rounded-[50%_50%_50%_50%/70%_70%_30%_30%] bg-[radial-gradient(70%_60%_at_40%_30%,var(--color-paper),var(--color-canvas-deep)_70%,transparent)] opacity-60 blur-[6px]" />
          <div className="absolute inset-x-[20%] top-[10%] h-[40%] rounded-full bg-paper opacity-50 blur-2xl" />
          <div className="absolute -right-6 bottom-[10%] h-[30%] w-[40%] rounded-full bg-electric-blue opacity-10 blur-3xl" />
        </div>
      </div>

      <section className="relative z-10 mx-auto max-w-[1296px] px-6 pt-32">
        <div className="flex flex-col justify-between gap-6 md:flex-row md:items-end">
          <h2 className="text-[clamp(3rem,9vw,7rem)] font-light leading-none tracking-[-0.04em]">{heading}</h2>
          <p className="max-w-[300px] text-[12px] uppercase leading-[18px]">{caption}</p>
        </div>
        <div className="mt-16 grid gap-6 md:grid-cols-2">
          <div className="relative aspect-[4/3] overflow-hidden rounded-card bg-night">
            <img src={imageSrc} alt="Coffee cup on a dark desk" width={800} height={600} loading="lazy" className="h-full w-full object-cover" />
            <div className="absolute inset-0 bg-[linear-gradient(270deg,rgba(11,11,18,0.5),rgba(11,11,18,0))]" />
          </div>
          <div className="relative aspect-[4/3] overflow-hidden rounded-card bg-night">
            <img src={imageSrc2} alt="Soft pastel clouds" width={800} height={600} loading="lazy" className="h-full w-full object-cover" />
            <div className="absolute inset-0 bg-[linear-gradient(270deg,rgba(11,11,18,0.5),rgba(11,11,18,0))]" />
            <div className="absolute inset-0 flex items-center justify-center gap-3 text-paper">
              <span className="h-12 w-12 rounded-circle border-4 border-paper" />
              <span className="text-h2 font-light tracking-widest">NORTHWIND</span>
            </div>
          </div>
        </div>
      </section>
    </div>
  );
}

Quality checks

Automated, in a real browser · today
—

More from Periwinkle Studio Float

The whole style →

Tilted Panel Loader

Animated graphics

Floating Pill Header

Headers & nav bars

Oversized Section Heading with Side Blurb

Feature sections

Rounded Project Tile

Cards

Dot-Separated Category Tags

Badges & tags

Plus Crosshair Grid Markers

Animated backgrounds