Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

GridDistortion

grid-distortion

Distorts an image grid through a pointer-driven displacement field with elastic relaxation.

Usage

Basic usage

When imageSrc is not passed, chart token grid shading is programmatically generated, and ripples are launched by moving the mouse.

Moving mouse distorts mesh
tsx
<div className="relative h-64 overflow-hidden rounded-xl bg-neutral-950">
  <GridDistortion />
</div>

High density + strong distortion

grid The higher the grid, the finer the grid and the smoother the ripples; the larger the strength is, the more intense the ripples are.

Moving mouse distorts mesh
tsx
<GridDistortion grid={24} strength={0.3} mouse={0.18} />

Long finish (high relaxation)

relaxation The closer it is to 1, the slower the ripple decay and the longer the aftertaste.

Moving mouse distorts mesh
tsx
<GridDistortion relaxation={0.96} strength={0.2} />

Customize the main color of the shading

color changes the main color of the grid shading (only effective when imageSrc is not uploaded).

Moving mouse distorts mesh
tsx
<GridDistortion color="oklch(0.72 0.22 30)" grid={18} />

When to Use

Use it for an interactive hero or landing-page grid that ripples as the pointer moves. Use GridPattern for static geometry, RetroGrid for a perspective horizon, or Spotlight for a pointer focus without deformation. GridDistortion can also apply the same velocity-driven displacement and relaxation to a supplied image.

Import

ts
import { GridDistortion } from "@hulianui/ui"

Props

NameTypeDefaultDescription
gridnumber15Number of displacement cells per side; JavaScript updates grid² cells per frame, with 8-30 recommended
mousenumber0.1Pointer influence radius relative to the grid; range = grid × mouse
strengthnumber0.15Displacement multiplier applied to pointer velocity; higher values produce stronger ripples
relaxationnumber0.9Per-frame decay from 0 to 1; values closer to 1 make ripples persist longer
imageSrcstring-Image to distort. When omitted, a grid texture is generated from chart tokens (recommended). Supplied images must be same-origin or CORS-enabled.
colorstring--color-chart-1Main procedural-grid color used when imageSrc is omitted; accepts any CSS color
classNamestring-Root container (or div)

Slots

SlotTypeDescription
fallbackReactNodeStatic non-WebGL content for SSR, reduced motion, or unavailable WebGL; defaults to a shaded grid

Usage Guidelines

  • Render the OGL/WebGL effect inside a "use client" boundary. SSR and unavailable WebGL render static mesh shading.
  • JavaScript performs O(grid²) work per frame. Values above 30 noticeably increase CPU cost.
  • External imageSrc assets must be same-origin or CORS-enabled, or the WebGL texture becomes tainted and cannot be read.
  • Place the root in a relative overflow-hidden container with an explicit height such as h-64. Distortion depends on pointer events and remains static on touch-only devices.

Related

DotPattern · GridPattern · StripedPattern · Spotlight · RetroGrid · Ripple

Playground

Moving mouse distorts mesh
<div className="relative h-64 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.14 0.02 255)" }}>
  <GridDistortion
    grid={15}
    mouse={0.1}
    strength={0.15}
    relaxation={0.9}
  />
</div>
PreviousGrainientDecorationNextGridMotion

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground