Skip to content
Patchwork
Start free
All docs pages

Docs · The theme

The light effects

The moving light, the glass cards, the tilted screen and the other effects in src/components/fx/.

The theme’s effects are in src/components/fx/. Each file explains itself at the top.

The moving light

LightField draws two bands of violet light behind the whole page on a <canvas>, with a small WebGL shader. The bands drift on their own, scrolling moves where the light is brightest, and a soft glow follows the pointer. A fine dot pattern lies over it.

It’s kept light:

  • It runs only on a device with a graphics chip (src/scripts/gpu.ts). Without one, and in Lighthouse, the page keeps a still light drawn in CSS, and nothing is drawn on the canvas.
  • It draws at half the screen’s resolution, at most 30 frames a second, and only while the tab is visible.
  • Under reduced motion it draws one still frame, and redraws only when the page scrolls.

Its colours come from the brand scale, so a new hue recolours it (see Colours, fonts and logo). In dark mode it never gets brighter than MAX_LUM, so grey text keeps a contrast of 4.5:1 over it.

LandingLayout puts it on every page. A section that should show the light has no background of its own (the fx-clear class).

Glass cards and the pointer light

The cards are glass: a card colour you can see the light through. Spotlight adds a soft light that follows the mouse inside any element with data-spot, and a thin lit edge where the pointer is. It works only with a mouse and without reduced motion.

The other effects

File What it does
TiltScreen A picture or a short video of the product in a screen that leans back and straightens as it scrolls into view, with CSS alone. Reduced motion shows it straight.
Ticker A row of phrases that runs across the page. It pauses on hover and focus, and a button stops it.
DemoCards Three cards on the SaaS homepage, each with a small demo of the product that plays when you point at it, or once as it scrolls into view on a phone.
QuotePanel Quotes, one at a time, on a dark panel, with a button per quote.
PricingPlans The plans as glass cards, with a monthly and yearly switch that works without a script.
ProjectCover A picture, or a cover drawn in violet, magenta or emerald with an icon and a word.
PostToc A post’s table of contents, beside the text on a wide screen and a panel above it on a phone.
CountUp A number that counts up as it scrolls into view.
ClosingBand, ClosingCta The deep violet band at the foot of every page, with a heading and two buttons.
AnnounceBar The bar above the header. See The header and the bar.

Every effect respects reduced motion: what moves stands still, and the page shows its end state.