UNIVERSAL REACT ANIMATION ENGINE · JAVASCRIPT & TYPESCRIPT

A different kind
of switch.

A little nature. A little theatre.
Give the space between light
and dark a cinematic feeling.

Launch interactive stage
JavaScript & TypeScript React · Vite · Next.js · CRA Zero Mobile Stutter
Live on this page

Cinematic in motion

Viral Sweep

Smooth exponential circular shockwave expanding from the trigger origin.

Light flows into dark.
1.2s
Try it in both directions.

Loading theme

The motion library

Small moments.
Lasting impressions.

Choose a material.
See how it moves.

UNIVERSAL & HIGH PERFORMANCE

Why glowafter?

Standard theme switchers either flash abruptly or stutter heavily on mobile touch screens. glowafter is engineered to deliver flawless 60/120 FPS transitions in any React app using JavaScript or TypeScript.

Universal React (JS & TS)

Works across Vite, Next.js (App & Pages Router), Remix, Astro, and CRA. Requires zero configuration and no external state libraries. Features first-class support for both JavaScript and TypeScript.

Zero-Stutter Mobile Touch

Mobile browsers often misreport document.hidden during tap gestures. glowafter extracts raw touch coordinates from touches[0] / changedTouches[0] and promotes GPU compositor layers via transform: translateZ(0) and will-change: clip-path.

Dual-Engine Graceful Fallback

Leverages the native browser View Transitions API for peak 120 FPS hardware performance, and seamlessly falls back to GSAP canvas rendering on older WebKit and Firefox browsers. Automatically honors prefers-reduced-motion with instant swaps.

INTEGRATION IN SECONDS

Install once. Use anywhere.

Designed for Vite, Next.js, Remix, CRA, and vanilla JS. Toggle below between JavaScript and TypeScript to view matching code recipes.

Choose Package Manager

npm install glowafter
JavaScript & TypeScript ready out of the box with complete types.
Vite, CRA, Next.js & Remix zero-config compatibility.
Zero lock-in: automatically manages classList & localStorage, or connects to your state.
Headless performSwitch() API for vanilla JS and custom UI buttons.
src/components/ThemeToggle.jsx
import { useModeAnimation } from 'glowafter'

export function ThemeToggle() {
  // glowafter manages .dark on <html> & syncs with localStorage automatically
  const { ref, toggleSwitchTheme, isDarkMode, mounted, isAnimating } = useModeAnimation({
    presetId: 'viral-sweep',
    duration: 1200,
  })

  if (!mounted) return null

  return (
    <button
      ref={ref}
      onClick={toggleSwitchTheme}
      disabled={isAnimating}
      className="px-4 py-2 rounded-lg font-medium bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900 transition"
      aria-label="Toggle theme"
    >
      {isDarkMode ? '☀️ Light' : '🌙 Dark'}
    </button>
  )
}

THE MOTION CATALOG

17 Presets. Zero Stutter.

Inspect all procedural recipes and their physical mechanics. Click "Preview" on any preset to test it on this page.

Preset IDFamilyTitleMotion MechanicsDurationAction
viral-sweepCinematicViral SweepSmooth exponential circular shockwave expanding from the trigger origin.1.2s
glass-shatterCinematicGlass ShatterMulti-facet Voronoi crystalline fracture shards radiating outward.1.4s
seaside-wavesWaterSeaside WavesSinusoidal ocean tidal surf with multi-harmonic wave crests.1.6s
balloon-popCinematicBalloon PopElastic rubber bubble stretch followed by a sudden radial pop rupture.1.3s
bomb-dropCinematicBomb DropDescending gravity projectile arc that detonates into a concussive shockwave.1.5s
partyCinematicPartyStarburst explosion with dispersing confetti ribbons and geometric streamers.1.4s
waterfallWaterWater TankA continuous pour meets a rippling waterline as the screen fills from below.2.4s
silver-rainWaterRainfallFine drops accelerate into a pool. Splashes dance along its rising surface.2.2s
puddle-bloomWaterPuddle RippleExpanding pools meet as delicate rings travel beyond their edges.1.6s
falling-leavesOrganicAutumn LeavesA staggered canopy drifts and turns before unfolding into the next theme.2.3s
paper-shredMaterialPaper ShredNarrow paper ribbons peel away at individually staggered speeds.1.4s
paper-tearMaterialPaper TearAn irregular seam opens through the middle and pulls the page apart.1.5s
wall-breakMaterialWall BreakCracks spread through irregular blocks before the wall crumbles away.1.4s
glass-breakMaterialGlass FractureFine cracks radiate outward before the sharp facets open.1.4s
tidal-silkWaterTidal SilkA soft, broad wave rolls over the page with a gently changing edge.1.6s
ink-bloomOrganicInk BloomAn organic ink pool spreads with scalloped edges and small imperfections.1.5s
woven-blindsMaterialWoven BlindsHorizontal bands open in sequence, like light through a woven shade.1.3s
gifCustomCustom GIFReveals the new theme through an animated mask defined by any custom GIF.2.0s