lensclear design system

The webgl backgrounds. Each one starts on demand.

Overview

Four ogl effects under @clear-labs/lens/effects. Deep imports only, so the core stays free of webgl.

Each host is an absolute box that fills its positioned parent. The canvas mounts in an effect, renders at device pixel ratio, pauses off screen and on hidden tabs, and freezes on one frame under prefers-reduced-motion.

The stages below start on a button, so nothing on this page opens a webgl context on load. Move the pointer over a started stage to paint.

BayerBackground

A cursor-painted dither. The trail buffer evaporates each frame and the pointer deposits ink along its path.

import BayerBackground from "@clear-labs/lens/effects/bayer-background";

<BayerBackground ink="#0b16ef" background="transparent" pixelSize={6} />
inkstringdefault: "#2147ff"

Hex colour of the dots.

backgroundstringdefault: "#1a1717"

Host background. Any css colour, usually transparent.

shape"square" | "circle" | "triangle" | "diamond"default: "square"

The dot shape.

pixelSizenumberdefault: 4

Dot size in px.

maxClicksnumberdefault: 3

How many click ripples stay live at once.

fillStrengthnumberdefault: 0.55

Peak coverage of a fully wet trail. 0.55 is a half-tone dither, 1 is solid.

decaynumberdefault: 0.994

Per-frame trail multiplier. 0.99 fades in about 2s, 0.998 in 14s.

brushRadiusnumberdefault: 36

Brush radius in trail-buffer pixels. The buffer caps at 768px.

depositnumberdefault: 0.55

Per-frame brush strength. Below 1 so strokes build up.

brushExpnumberdefault: 2

Ease-out exponent on the brush profile. Higher is a wetter halo.

subFloornumberdefault: 0.0025

Subtractive floor per frame, so decay reaches zero at 8-bit precision.

classNamestring

Passes through to the canvas host.

BayerMaskedGradient

The same dither over an address gradient. The wallet dialog uses it as a passport backdrop.

import BayerMaskedGradient from "@clear-labs/lens/effects/bayer-masked-gradient";

<BayerMaskedGradient palette={addressPalette} shape="square" pixelSize={4} />
palette{ stops; angle?; blobs }required

Up to four hex stops, an angle, and up to five blobs. An address palette fits.

shape"square" | "circle" | "triangle" | "diamond"default: "square"

The dot shape.

pixelSizenumberdefault: 4

Dot size in px.

backgroundstringdefault: "transparent"

Host background.

maxClicksnumberdefault: 3

How many click ripples stay live at once.

classNamestring

Passes through to the canvas host.

BayerWordHero

A giant word masked over the dither plus a two-line typewriter. Swap, borrow, and stake reuse it with their own word, ink, and copy. The word only shows from lg up.

import { BayerWordHero } from "@clear-labs/lens/effects/bayer-word-hero";

<BayerWordHero
  word="swap"
  ink="#0b16ef"
  lines={[
    [{ text: "Swap your " }, { text: "USDC" }],
    [{ text: "for " }, { text: "CCPU" }],
  ]}
  ariaLabel="Swap your USDC for CCPU"
  runKey="usdc-ccpu"
  wordSize="32vw"
/>
wordstringrequired

The giant lowercase word, rendered as bayer-masked ink.

inkstringrequired

Hex ink for the dots. The shader parses hex.

linesHeroLinesrequired

Two typewriter lines, each a list of segments. A segment's className is a bridge for the tailwind asset colours.

ariaLabelstringrequired

The accessible name for the whole tagline.

runKeystring

Change it to remount the typewriters and restart the animation.

wordSizestringdefault: "45vw"

The word's font-size, a css length. Longer words take a smaller vw.

pixelSizenumberdefault: 6

Dot size in px.

AsciiBackground

The bayer trail mechanics with glyphs instead of dots. A runtime font atlas picks a character per cell by brightness.

import AsciiBackground from "@clear-labs/lens/effects/ascii-background";

<AsciiBackground ink="#165dfc" background="transparent" charSize={14} />
inkstringdefault: "#165DFC"

Hex colour of the glyphs.

backgroundstringdefault: "#191919"

Host background.

rampstringdefault: " .:-=+*#%@"

Glyphs from empty to full. Cell brightness picks one.

charSizenumberdefault: 14

Cell size in px.

fontFamilystringdefault: "Courier New", Courier, monospace

The face the glyph atlas is drawn with.

decaynumberdefault: 0.994

Per-frame trail multiplier. 0.99 fades in about 2s, 0.998 in 14s.

brushRadiusnumberdefault: 36

Brush radius in trail-buffer pixels. The buffer caps at 768px.

depositnumberdefault: 0.55

Per-frame brush strength. Below 1 so strokes build up.

brushExpnumberdefault: 2

Ease-out exponent on the brush profile. Higher is a wetter halo.

subFloornumberdefault: 0.0025

Subtractive floor per frame, so decay reaches zero at 8-bit precision.

classNamestring

Passes through to the canvas host.