ShaderSweep

A self-contained WebGL transition band for masking meaningful view and state changes.

Installation

Basic

Release 2.4Draft

Ready for review

Make the state change feel earned.

The content swaps at the band's midpoint, when visual attention is highest.

Palette and direction

Release 2.4Draft

Ready for review

Make the state change feel earned.

The content swaps at the band's midpoint, when visual attention is highest.

This preview advances to the next palette and direction at midpoint. Use position="absolute" for contained demos; the default fixed canvas covers the viewport.

API Reference

PropTypeDefaultDescription
palettePreset | readonly [string, string, string]"aurora"Five included palettes or a custom three-stop hex tuple.
direction"left" | "right" | "up" | "down""right"Direction the shader band travels.
durationnumber900Band traversal time in milliseconds.
fadeDurationnumber300Fade time after the band reaches the far edge.
midpointnumber0.52Progress point from 0 to 1 at which onMidpoint runs.
bandSizenumber0.18Normalized band width. Lower values create a tighter beam.
intensitynumber1Alpha and brightness multiplier from 0 to 1.5.
ripplenumber0.45Edge displacement from 0 to 1.5. Use 0 for a straight band.
easing"linear" | "ease-out" | "ease-in-out" | EasingFn"ease-in-out"Traversal curve. Custom functions receive progress from 0 to 1.
position"fixed" | "absolute""fixed"Covers the viewport or fills the nearest positioned parent.
reducedMotion"skip" | "animate""skip"Honors prefers-reduced-motion unless explicitly forced.
onMidpoint() => void | Promise<void>Swap the underlying view while the shader masks the change.
onComplete() => voidRuns after traversal and fade finish.

The forwarded ref exposes play(options?) and cancel(). A play call returns separate midpoint and finished promises plus its own cancel function.

Credits

ShaderSweep is inspired by glimm, the shader-driven transition library by Noman Ijaz. glimm is released under the MIT License; its copyright and license notice are preserved in the component source.