Curtains
A WebGL2 shader of dithered curtains that drop in and sway in a slow breeze, drawn in your theme's colours.
Installation
pnpm dlx shadcn@latest add @breeze/curtainsUsage
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.
<Curtains shape="corner" className="absolute inset-0 h-full w-full" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
shape | "parted" | "corner" | "parted" | How the hems hang |
color | string | "#7c3aed" | Cloth colour, any CSS colour or var() |
accentColor | string | "#f472b6" | Colour the lit fold crests lean toward |
speed | number | 1.5 | Animation speed multiplier. 0 freezes the breeze |
wind | number | 2 | How hard the breeze pushes the panels. 0 hangs them still |
drapeLength | number | 1.4 | Multiplies how far the hems hang down |
folds | number | 1 | Multiplies the folds per panel |
panelWidth | number | 170 | About one panel per this many CSS px |
cellSize | number | 4 | Size of one dither cell in CSS px |
strength | number | 1.6 | Ink opacity multiplier |
dropDuration | number | 1.6 | Seconds the curtains take to drop in. 0 skips the drop |
clearCenter | boolean | true for parted | Thins the cloth in an oval in the middle so text stays readable |
bottomFade | number | 0 | 0 to 1, how much the cloth fades toward the bottom |
topFade | number | 0 | CSS 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.