Curtains

A WebGL2 shader of dithered curtains that drop in and sway in a slow breeze, drawn in your theme's colours.

Props
Shape
Color
#7c3aed
Accent
#f472b6
Speed1.5
Wind2.0
Drape length1.40
Folds1.0
Panel width170
Cell size4
Strength1.60
Bottom fade0.00

Installation

pnpm dlx shadcn@latest add @breeze/curtains

Usage

import { Curtains } from "@/components/breeze/curtains"

Place it behind a hero. The canvas fills its box, so give the box a size. Where there's no cloth the canvas is transparent, so your background shows through.

<section className="relative">
  <Curtains className="absolute inset-x-0 top-0 h-[780px] w-full" topFade={56} />
  <div className="relative">{/* hero content */}</div>
</section>

Shapes

parted hangs in an inverted V: short over the centre, long at the sides. It also thins the cloth in an oval behind the middle, so text there stays readable. corner gathers the panels in the top-right corner, which suits a card or a tile.

Props

PropTypeDefaultDescription
shape"parted" | "corner""parted"How the hems hang
colorstring"#7c3aed"Cloth colour, any CSS colour or var()
accentColorstring"#f472b6"Colour the lit fold crests lean toward
speednumber1.5Animation speed multiplier. 0 freezes the breeze
windnumber2How hard the breeze pushes the panels. 0 hangs them still
drapeLengthnumber1.4Multiplies how far the hems hang down
foldsnumber1Multiplies the folds per panel
panelWidthnumber170About one panel per this many CSS px
cellSizenumber4Size of one dither cell in CSS px
strengthnumber1.6Ink opacity multiplier
dropDurationnumber1.6Seconds the curtains take to drop in. 0 skips the drop
clearCenterbooleantrue for partedThins the cloth in an oval in the middle so text stays readable
bottomFadenumber00 to 1, how much the cloth fades toward the bottom
topFadenumber0CSS px faded out at the top, e.g. to hide the rod under a navbar

Every prop updates live without restarting the animation. Pass color="var(--foreground)" and accentColor="var(--primary)" to follow your theme instead; theme colours update when it changes. The animation pauses off-screen and in hidden tabs, and shows a single still frame with reduced motion.