Perspective Grid
A grid floor that recedes to a horizon, with lines that thin and fade with distance and an optional slow scroll.
Overview
Perspective Grid draws a flat floor of square cells seen from above, receding toward a horizon. Lines are crisp at the front and thin with distance, and each direction fades out before its cells get too small to draw cleanly, so the far floor never shimmers. Nothing is drawn above the horizon.
The background is transparent and the lines use currentColor by default, so the grid follows the text color in light and dark themes. An optional glow lights the horizon. Use it under a launch headline, an event page, or an empty state.
Installation
Usage
import { PerspectiveGrid } from "honestui/shaders"
<div className="relative h-96 bg-background text-foreground">
<PerspectiveGrid className="absolute inset-0" glow={0.3} glowColor="#3b82f6" />
<h1 className="relative pt-16 text-center text-3xl font-medium">Launch week</h1>
</div>Put headings above the horizon, where the canvas is empty, so the lines never cross the text.
Accessibility
Perspective Grid is decorative and its canvas is hidden from assistive technology. Keep text and actions in normal HTML.
The floor scrolls only while speed is not 0. Scrolling stops while the grid is offscreen or the tab is hidden, and a still frame shows when the user prefers reduced motion. Without WebGL2 the container shows only its own background.