nomanjack

Glimm Transition

Shaders

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

    64
  • Glimm Autopilot

    Glimm Autopilot

    24
  • Glimm Publish

    Glimm Publish

    21
  • Glimm To-dos

    Glimm To-dos

    19
  • Glimm Usage Reset

    Glimm Usage Reset

    12
  • Glimm HTML-in-Canvas

    Glimm HTML-in-Canvas

    11
  • Glimm Invoice Paid

    Glimm Invoice Paid

    7
  • Glimm Upgrade to Pro

    Glimm Upgrade to Pro

    6

More in Shaders

View all
  • Glass Fold

    Glass Fold

    498
  • Shader Animation

    Shader Animation

    3.9K
  • Parallel Waves

    Parallel Waves

    13
  • Phosphor 30

    Phosphor 30

    314
  • Illos Knowledge Sources

    Illos Knowledge Sources

    55
  • Stream Search

    Stream Search

    20
  • Radial Shader

    Radial Shader

    149
  • Paper design shader Background

    Paper design shader Background

    700