Modus UI

Crystal Cells

Web (React)

A faceted crystal lens refracting a shifting Voronoi cell field.

A moving Voronoi cell pattern seen through a hexagonal faceted crystal with dispersion, framed by a vignette. It fills its positioned parent and freezes its animation when the user prefers reduced motion. Built on the shaders library (MIT) and rendered with WebGPU.

Crystal Cells

Installation

CLI

npx @modus-ui/cli add crystal-cells

Manual

  1. Install shaders with npm install shaders.
  2. Copy the code from the component tab.
  3. Create a file at components/ui/crystal-cells.tsx.
  4. Paste the code.

Usage

tsx
import { CrystalCells } from "@/components/ui/crystal-cells";

export default function Example() {
  return (
    <div className="relative h-[500px] w-full overflow-hidden">
      <CrystalCells />
      <div className="relative z-10 p-8">
        <h1>Content over the effect</h1>
      </div>
    </div>
  );
}

Props

PropTypeDefaultDescription
colorAstring"#0f172a"Cell centre colour.
colorBstring"#6366f1"Cell edge colour.
borderColorstring"#e0e7ff"Colour of the cell borders.
speednumber0.5Cell animation speed.
scalenumber6Number of cells.
facetsnumber5Number of crystal facets.
refractionnumber0.5Refraction strength.
dispersionnumber0.5Rainbow dispersion strength.
radiusnumber0.32Size of the crystal.

Comments

  • No comments yet.