Membrane

A sheet you can pluck. Every click sends one soft ring out across the grid, drawn as dots, fabric, mesh, dashes or crosses.

Props
Variant
Color
theme
Accent
theme
Gap18
Speed1.00
Sustain0.60
Force1.00
Displacement7.0

Installation

pnpm dlx shadcn@latest add @breeze/membrane

Usage

import { Membrane } from "@/components/breeze/membrane"

Put it behind your content. It listens on its parent, so buttons and inputs on top keep working, and a click anywhere in the section plucks the sheet there.

<section className="relative h-[480px]">
  <Membrane variant="fabric" className="absolute inset-0 h-full w-full" />
  <div className="relative">{/* content */}</div>
</section>

Variants

Every variant is the same simulated surface, drawn differently:

VariantLooks like
dotsDots that swell and shift with the wave; crests lean to the accent
fabricA plain weave, threads over and under, lit from the upper left, so waves read as folds travelling through cloth
meshA wireframe whose joints are displaced by the slope
dashesStrokes that lean with the slope, like filings in a field
crossesPlus marks that grow and turn with the slope

How it moves

Each click sends out one soft ring. It travels outward, thins as it spreads and fades away. Nothing springs back behind it and nothing bounces off the edges. Rings from several clicks simply overlap. speed sets how fast a ring travels and sustain how long it lasts. Once the last ring fades the animation stops, so a resting background costs nothing.

Pluck from code

Call pluck() on the ref to send a ring yourself, for example when a form succeeds. With no arguments it plucks the centre at the default force.

"use client"

import { useRef } from "react"

import { Membrane, type MembraneHandle } from "@/components/breeze/membrane"

export function Unlock() {
  const sheet = useRef<MembraneHandle>(null)

  return (
    <div className="relative h-96">
      <Membrane ref={sheet} interactive={false} className="absolute inset-0 h-full w-full" />
      <button className="relative" onClick={() => sheet.current?.pluck(undefined, undefined, 2)}>
        Unlock
      </button>
    </div>
  )
}

Props

PropTypeDefaultDescription
variant"dots" | "fabric" | "mesh" | "dashes" | "crosses""dots"How the surface is drawn
colorstring"var(--foreground)"Ink colour, any CSS colour or var()
accentColorstring"var(--brand)"Colour wave crests lean toward
gapnumber18Distance between grid points in CSS px
sizenumberper variantDot radius, or line width, in CSS px
idleOpacitynumberper variantOpacity of the sheet at rest, 0 to 1
speednumber1How fast a ring travels (1 = 650 px per second)
sustainnumber0.60 to 1, how long a ring lasts before it fades
forcenumber1Strength of a click
displacementnumber7How far points shift with the slope, in CSS px
pluckOnMountbooleantruePluck the centre once when it first appears
interactivebooleantruePluck where you click inside the parent
refRef<MembraneHandle>Exposes pluck(x?, y?, force?)

With reduced motion the sheet stays still.