nomanjack

Glimm Transition

Shaders 2

About

WebGL sweep transitions for React. A colour band sweeps across the viewport, revealing the incoming view behind it while retaining the outgoing view ahead. Wrap your app in GlimmProvider and call sweep(navigate) from useGlimm() on any route or state change. Zero runtime dependencies, respects prefers-reduced-motion, falls back gracefully without WebGL. By Noman Ijaz, MIT.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Glimm Transition to your project and fits it to your theme.

Code

How Glimm Transition is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { useState } from "react"
import GlimmProvider, {
  useGlimm,
  type Direction,
} from "@/components/ui/glimm-transition"

const DIRECTIONS: Direction[] = ["ltr", "rtl", "ttb", "btt"]

function DirectionDemo() {
  const { sweep } = useGlimm()
  const [active, setActive] = useState<Direction>("ltr")

  return (
    <div className="flex h-screen min-h-[350px] w-full flex-col items-center justify-center gap-8 bg-background text-foreground">
      <p className="font-mono text-5xl font-medium tracking-tight">{active}</p>
      <div className="flex gap-2">
        {DIRECTIONS.map((direction) => (
          <button
            key={direction}
            type="button"
            onClick={() => sweep(() => setActive(direction), { direction })}
            className={`rounded-full border px-4 py-1.5 font-mono text-sm transition-colors ${
              active === direction
                ? "border-foreground bg-foreground text-background"
                : "border-border hover:bg-muted"
            }`}
          >
            {direction}
          </button>
        ))}
      </div>
    </div>
  )
}

export default function Directions() {
  return (
    <GlimmProvider palette="azure">
      <DirectionDemo />
    </GlimmProvider>
  )
}

Dependencies

More by nomanjack

View all
  • Glimm Theme

    Glimm Theme

    81
  • Glimm Autopilot

    Glimm Autopilot

    29
  • Glimm Publish

    Glimm Publish

    23
  • Glimm To-dos

    Glimm To-dos

    21
  • Glimm HTML-in-Canvas

    Glimm HTML-in-Canvas

    17
  • Glimm Usage Reset

    Glimm Usage Reset

    14
  • Glimm Upgrade to Pro

    Glimm Upgrade to Pro

    9
  • Glimm Invoice Paid

    Glimm Invoice Paid

    8

More in Shaders

View all
  • Glass Fold

    Glass Fold

    588
  • Shader Animation

    Shader Animation

    3.9K
  • Chroma Sense Hero

    Chroma Sense Hero

    22
  • LightSpeed

    LightSpeed

    253
  • Illos Knowledge Sources

    Illos Knowledge Sources

    74
  • Shader Lines

    Shader Lines

    2.5K
  • Molten Pillars

    Molten Pillars

    18
  • Wave

    Wave

    730