# Pillars

> For agents: this file is the source. Write the file under Code exactly as given, at the path it names, and mount the component as Placement says; do not recreate or approximate the animation.

A field of white-capped cylinders, row behind row. Under the pointer they rise in a smoothed pyramid, most beneath it and less around, bodies showing between the caps, and settle back as it moves on.

- Slug: `pillars` · Category: grids · Free (MIT) · v0.1.0
- What moves: The cylinders under the pointer rise in a smoothed pyramid, most beneath it and less around, bodies showing between the caps, and settle back as it moves.
- Triggers: hover, focus, pointer-move · Touch: ambient (plays by itself on screens without hover, 1.5× pace, rests off screen) · Reduced motion: simplified
- Aliases: cylinders, pegs, relief, pyramid lift · Use cases: hero, background, card · Tags: cylinders, relief, grid, lift, pyramid, rows
- Rails: Measured 2026-10-27 for 0.1.1: 2.31 KB js, p95 6.49 ms on a 4× throttled CPU; not yet within every budget line, so no Light badge
- Estimated tokens: 3928

## Tokens

- `--texture-ink` (color, default `var(--foreground)`): The caps and the bodies' edges
- `--texture-field` (color, default `var(--background)`): The panel and the bodies

## Placement

**Never set width or height on the Texture; size the host. The Texture fills whatever box it is given.** Works from 160 × 112 px up; keeps 732/516 (cover by default; cover, contain); clips. The host needs position: relative.

### contained

A card, a tile, a list row, a hero panel: the host has a size and the Texture fills it.

```css
.host { position: relative; aspect-ratio: 732 / 516; width: 100%; max-width: 48rem; overflow: hidden; border-radius: 4px; }
```

```tsx
<div className="host">
  <Pillars />
  <span className="sr-only">Pillars</span>
</div>
```

### background

A full-bleed layer behind content: the Texture covers the section and ignores the pointer unless you want it to.

```css
.section { position: relative; }
.section > .host { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.section > .content { position: relative; z-index: 1; }
```

```tsx
<section className="section">
  <div className="host" aria-hidden="true"><Pillars /></div>
  <div className="content">…</div>
</section>
```

## Install

- Command: `npx shadcn@latest add https://textures.dev/r/pillars.json` (one self-contained React file at components/textures/pillars.tsx; Pro through the Copy to Agent prompt's token URL, or `npx shadcn@latest add @textures/pillars` with the @textures registry and its header in components.json, see below)
- MCP: `get_texture({ ref: "pillars" })` (server: /mcp)
- Markdown: /s/pillars.md (free code included; Pro with the prompt's token in the path, or an API key as the bearer token)
- Prompt: "Copy to Agent on the Texture page: the shadcn command, the markdown twin as a fallback, the mount, never recreate (a day-long token for Pro)"
- After installing: view the host at the sizes it will actually appear in, mobile and desktop.
- Suggested commit: `feat: add Pillars hover texture (textures.dev/s/pillars)` (a suggestion the agent and the human can edit, never a write).

## Code

Write these files into the project, then mount the component on a host with position: relative and a size.

### React

### `components/textures/pillars.tsx`

```tsx
// Pillars — a Texture by Textures · https://textures.dev/s/pillars
// Install another: npx shadcn@latest add https://textures.dev/r/<slug>.json
// For agents: https://textures.md
// License: free to use
"use client"
import { type CSSProperties, useEffect, useRef } from "react"
function selfSize(root: HTMLElement | null): void {
	const host = root?.parentElement
	if (!root || !host || host.getBoundingClientRect().height > 0) return
	root.style.minHeight = "240px"
}
type Pointer = { x: number; y: number; active: number; reduced: boolean }
const AMBIENT_SPEED = 1.5
const AMBIENT_CYCLE = 4.5
type EngineOptions = { ambientSpeed?: number }
function engine(
	root: HTMLElement,
	draw: (p: Pointer, dt: number) => boolean | void,
	min: [number, number],
	options: EngineOptions = {},
): () => void {
	const svg = root.querySelector("svg")
	if (!svg) return () => {}
	const mq = () => matchMedia("(prefers-reduced-motion: reduce)").matches || matchMedia("(update: slow)").matches
	const touchMq = matchMedia("(hover: none), (pointer: coarse)")
	const forced = () => root.closest("[data-motion]")?.getAttribute("data-motion") ?? null
	const wantsAmbient = () => (forced() ? forced() === "ambient" : touchMq.matches)
	const speed = AMBIENT_SPEED * (options.ambientSpeed ?? 1)
	const w = (2 * Math.PI) / AMBIENT_CYCLE
	const phase = Math.random() * 2 * Math.PI
	let onScreen = false
	let ambient = false
	let clock = 0
	let hold = 0
	let box: { left: number; top: number; s: number; ox: number; oy: number } | null = null
	let px = 366
	let py = 258
	let cx = 0
	let cy = 0
	let active = 0
	let target = 0
	let vel = 0
	let frame = 0
	let last = 0
	let lastMoveAt = 0
	const measure = () => {
		const r = svg.getBoundingClientRect()
		if (r.width < min[0] || r.height < min[1]) {
			box = null
			return
		}
		const s = Math.max(r.width / 732, r.height / 516)
		box = { left: r.left, top: r.top, s, ox: (r.width - 732 * s) / 2, oy: (r.height - 516 * s) / 2 }
	}
	const tick = (now: number) => {
		const dt = Math.min(last ? (now - last) / 1000 : 1 / 60, 1 / 30)
		last = now
		let moving = false
		const reduced = mq()
		if (ambient && now > hold) {
			if (reduced) target = 0
			else {
				clock += dt * speed
				const t = clock
				px = 366 + 366 * (0.76 * Math.sin(w * t + phase) + 0.2 * Math.sin(1.93 * w * t + 1.2 + phase))
				py = 258 + 258 * (0.72 * Math.sin(0.75 * w * t + 0.8 + phase) + 0.2 * Math.sin(1.37 * w * t + 2.1 + phase))
				target = 1
				moving = true
			}
		}
		if (reduced) {
			active = target
			vel = 0
		} else {
			const decay = Math.exp(-30 * dt)
			const off = active - target
			const lead = vel + 30 * off
			active = target + (off + lead * dt) * decay
			vel = (vel - 30 * lead * dt) * decay
			if (Math.abs(vel) < 0.02 && Math.abs(active - target) < 0.02) {
				active = target
				vel = 0
			} else moving = true
		}
		const more = draw({ x: px, y: py, active, reduced }, dt)
		if (moving || more) frame = requestAnimationFrame(tick)
		else {
			frame = 0
			last = 0
		}
	}
	const wake = () => {
		if (!frame) frame = requestAnimationFrame(tick)
	}
	const touchIsAmbient = (e: Event) => (e as PointerEvent).pointerType === "touch" && touchMq.matches
	const onEnter = (e: PointerEvent) => {
		if (touchIsAmbient(e)) return
		measure()
	}
	const onMove = (e: PointerEvent) => {
		if (touchIsAmbient(e)) return
		const t = performance.now()
		if (!box || t - lastMoveAt > 250) measure()
		lastMoveAt = t
		if (!box) return
		if (!e.isTrusted) hold = performance.now() + 1000
		cx = e.clientX
		cy = e.clientY
		px = (cx - box.left - box.ox) / box.s
		py = (cy - box.top - box.oy) / box.s
		target = 1
		wake()
	}
	const onLeave = (e?: Event) => {
		if (e && touchIsAmbient(e)) return
		if (e && !e.isTrusted) hold = 0
		if (ambient && performance.now() > hold) return
		target = 0
		wake()
	}
	const onFocus = () => {
		measure()
		if (!box) return
		px = 366
		py = 258
		target = 1
		wake()
	}
	const onResize = () => {
		if (box || ambient) measure()
		if (ambient && !box) ambient = false
		settle()
	}
	const onScroll = () => {
		if (!box || target !== 1 || (ambient && performance.now() > hold)) return
		measure()
		if (!box) return
		px = (cx - box.left - box.ox) / box.s
		py = (cy - box.top - box.oy) / box.s
		wake()
	}
	const settle = () => {
		const next = onScreen && !document.hidden && wantsAmbient()
		if (next === ambient) return
		ambient = next
		if (ambient) {
			measure()
			if (!box) {
				ambient = false
				return
			}
			wake()
		} else {
			target = 0
			wake()
		}
	}
	const io =
		typeof IntersectionObserver === "function"
			? new IntersectionObserver(
					([entry]) => {
						onScreen = !!entry?.isIntersecting
						settle()
					},
					{ threshold: 0.2 },
				)
			: null
	io?.observe(svg)
	if (!io) {
		onScreen = true
		settle()
	}
	const onVisibility = () => settle()
	const onCapability = () => settle()
	const reducedMq = matchMedia("(prefers-reduced-motion: reduce)")
	const onReduced = () => wake()
	document.addEventListener("visibilitychange", onVisibility)
	touchMq.addEventListener?.("change", onCapability)
	reducedMq.addEventListener?.("change", onReduced)
	const host: Element = root.closest("a, button, [tabindex]") ?? root.parentElement ?? root
	root.addEventListener("pointerenter", onEnter)
	root.addEventListener("pointermove", onMove, { passive: true })
	root.addEventListener("pointerleave", onLeave)
	root.addEventListener("pointercancel", onLeave)
	host.addEventListener("focusin", onFocus)
	host.addEventListener("focusout", onLeave)
	window.addEventListener("resize", onResize, { passive: true })
	window.addEventListener("scroll", onScroll, { passive: true, capture: true })
	return () => {
		root.removeEventListener("pointerenter", onEnter)
		root.removeEventListener("pointermove", onMove)
		root.removeEventListener("pointerleave", onLeave)
		root.removeEventListener("pointercancel", onLeave)
		host.removeEventListener("focusin", onFocus)
		host.removeEventListener("focusout", onLeave)
		window.removeEventListener("resize", onResize)
		window.removeEventListener("scroll", onScroll, { capture: true })
		document.removeEventListener("visibilitychange", onVisibility)
		touchMq.removeEventListener?.("change", onCapability)
		reducedMq.removeEventListener?.("change", onReduced)
		io?.disconnect()
		if (frame) cancelAnimationFrame(frame)
	}
}
const W = 732
const H = 516
const COLS = 34
const ROWS = 16
const PX = 23.0941
const PY = 33.4779
const X0 = -27
const X0_ODD = -15
const Y0 = 0.74
const BODY_X = 0.5
const BODY_W = 23.094
const BODY_Y = 6.748
const BODY_H = 158.23
const PEAK = 64
const REACH = 5.2
const CURVE = 1.5
const TAU = 0.06
export type PillarsProps = {
	tokens?: Partial<Record<"--texture-ink" | "--texture-field", string>>
	className?: string
	static?: boolean
}
const N = COLS * ROWS
const colX = (r: number, c: number) => (r % 2 ? X0_ODD : X0) + c * PX
const cap = (x: number, y: number) =>
	`M${(x + 24.0941).toFixed(2)} ${(y + 6.17535).toFixed(2)}c0 3.41056-5.3936 6.17535-12.047 6.17535s-12.047-2.76479-12.047-6.17535 5.3936-6.17535 12.047-6.17535 12.047 2.76479 12.047 6.17535z`
const body = (x: number, y: number) =>
	`M${(x + BODY_X).toFixed(2)} ${(y + BODY_Y).toFixed(2)}h${BODY_W.toFixed(3)}v${BODY_H.toFixed(2)}h-${BODY_W.toFixed(3)}z`
const rowPaths = (r: number, lift: Float32Array) => {
	let b = ""
	let c = ""
	const y0 = Y0 + r * PY
	for (let i = 0; i < COLS; i++) {
		const x = colX(r, i)
		const y = y0 - lift[r * COLS + i]!
		b += body(x, y)
		c += cap(x, y)
	}
	return [b, c] as const
}
const REST = Array.from({ length: ROWS }, (_, r) => rowPaths(r, new Float32Array(N)))
export function Pillars({ tokens, className = "", static: isStatic = false }: PillarsProps) {
	const ref = useRef<HTMLDivElement>(null)
	useEffect(() => selfSize(ref.current), [])
	const bodies = useRef<(SVGPathElement | null)[]>([])
	const caps = useRef<(SVGPathElement | null)[]>([])
	useEffect(() => {
		const root = ref.current
		if (!root || isStatic) return
		const lift = new Float32Array(N)
		const atRest = new Uint8Array(ROWS).fill(1)
		return engine(
			root,
			({ x, y, active, reduced }, dt) => {
				const fx = x
				const fy = y
				let moving = false
				const k = reduced ? 1 : 1 - Math.exp(-dt / TAU)
				for (let r = 0; r < ROWS; r++) {
					let rowMoving = false
					let rowLifted = false
					for (let i = 0; i < COLS; i++) {
						const j = r * COLS + i
						const dx = (colX(r, i) + 12.047 - fx) / PX
						const dy = (Y0 + r * PY + 6.175 - fy) / PY
						const d = Math.hypot(dx, dy)
						const want = d >= REACH ? 0 : PEAK * active * Math.pow(1 - d / REACH, CURVE)
						let next = lift[j]! + (want - lift[j]!) * k
						if (Math.abs(next - want) < 0.03) next = want
						else rowMoving = true
						lift[j] = next
						if (next !== 0) rowLifted = true
					}
					if (rowMoving) moving = true
					const bEl = bodies.current[r]
					const cEl = caps.current[r]
					if (!bEl || !cEl) continue
					if (!rowLifted) {
						if (!atRest[r]) {
							bEl.setAttribute("d", REST[r]![0])
							cEl.setAttribute("d", REST[r]![1])
							atRest[r] = 1
						}
						continue
					}
					if (rowMoving || atRest[r] || reduced) {
						const [b, c] = rowPaths(r, lift)
						bEl.setAttribute("d", b)
						cEl.setAttribute("d", c)
						atRest[r] = 0
					}
				}
				return moving
			},
			[160, 112],
		)
	}, [isStatic])
	const style = {
		"--texture-ink": "var(--foreground)",
		"--texture-field": "var(--background)",
		...tokens,
		color: "var(--texture-ink)",
		background: "var(--texture-field)",
	} as CSSProperties
	return (
		<div
			ref={ref}
			style={{
				position: "relative",
				isolation: "isolate",
				height: "100%",
				width: "100%",
				overflow: "clip",
				contain: "layout paint style",
				containerType: "size",
				...style,
			}}
			data-texture="pillars"
			className={className}
		>
			<svg
				viewBox={`0 0 ${W} ${H}`}
				preserveAspectRatio="xMidYMid slice"
				aria-hidden="true"
				focusable="false"
				style={{ position: "absolute", inset: 0, display: "block", height: "100%", width: "100%" }}
			>
				{REST.map(([b, c], r) => (
					<g key={r}>
						<path
							ref={(el) => {
								bodies.current[r] = el
							}}
							d={b}
							fill="var(--texture-field)"
							stroke="currentColor"
							strokeWidth={1}
						/>
						<path
							ref={(el) => {
								caps.current[r] = el
							}}
							d={c}
							fill="currentColor"
						/>
					</g>
				))}
			</svg>
		</div>
	)
}
```. Live preview: /embed/pillars.

## Agent brief

## 1. What it is

A field of white-capped black cylinders across the 732 × 516 panel, 1:1 from the Textures file (Figma 167:31793): 34 to a row on a 23.09 px pitch, rows 33.48 px apart with odd rows shifted 12 px, each cylinder the frame's own group (a 24.09 × 12.35 elliptical cap over a 158 px body with 1 px edges), every row drawn over the one above so only the caps and a sliver of body show. Under the pointer the cylinders rise in a smoothed pyramid, the one beneath it by 64 px and the ring around it less out to about five cells, their bodies showing between the caps in front, and settle back as it moves on. Use it as a hero or background panel, or inside a card, wherever a dense relief can answer the pointer. Not for small icons: below 160 × 112 it stays static.

## 2. Behaviour timeline

- **Idle:** the frame at rest, every cap on its row. Nothing runs: no loops, no listeners doing work.
- **Hover-in:** the on/off weight springs to 1 in about 80 ms; the cylinders under the pointer start to rise.
- **Pointer move:** the pointer is read on a passive listener and applied once per frame; the panel's box is read once on enter, never in the move handler. The lift's centre is the pointer itself; each cylinder eases toward its lift with a 60 ms time constant, so the field stays in step with the cursor. Rows with a lifted cylinder are rewritten as two paths (bodies, caps); rows at rest keep theirs.
- **Hover-out:** every cylinder eases back down; interruptible at any point.
- **Reduced motion / slow display:** the same states without the ease: the cylinders sit at their lift directly.
- **Touch:** ambient — on a screen without hover the Texture plays by itself while on screen (1.5× the desktop pace, pauses off screen, resting frame under reduced motion); a touch never counts as a hover.

## 3. Integration

- Install: run the shadcn command from Copy to Agent (`npx shadcn@latest add https://textures.dev/r/pillars.json`) or write the file from this Texture's markdown twin (/s/pillars.md). One self-contained React file, components/textures/pillars.tsx.
- The host provides `position: relative` and a size. **Never set width or height on the Texture; size the host.**
- Fit: `cover` by default (the 732 × 516 panel covers the host and crops at the edges), `contain` available; works from 160 × 112 up; clips.
- Tokens on the root: `--texture-ink` (the caps and edges) and `--texture-field` (the panel and the bodies); both default to the shadcn `--foreground` and `--background`.

## 4. Customisation

- Change the two tokens. Do not change the field, the cylinder, the pyramid, the ease or the reduced-motion branch.

## 5. Accessibility

- Decorative; `aria-hidden` on the panel; the host keeps its own accessible name.
- Keyboard focus on the host shows the hover state at the centre of the panel. No text sits on the Texture.


## Related
Pairs with: Glow (background) · Magnet (hero) — same family, same tokens.
npx shadcn@latest add https://textures.dev/r/glow.json

## Using Textures from an agent

Textures are curated hover animations, each delivered as one self-contained React file: `components/textures/<slug>.tsx`, no Tailwind, no dependency beyond react. Three ways in, in this order:

1. **Copy to Agent** on a Texture page (https://textures.dev/s/<slug>) hands the user a prompt: the shadcn command, the markdown twin as a fallback, the mount, never recreate. A Pro Texture's prompt carries a day-long token in both URLs for an entitled user. Do what the prompt says.
2. **Connected to the Textures MCP server** (https://textures.dev/mcp): call `search_textures` with the user's words, then `get_texture` with the slug you pick, and write the one file it returns exactly as given.
3. **Neither:** `npx shadcn@latest add https://textures.dev/r/<slug>.json` installs a free Texture with no setup; or fetch `https://textures.dev/s/<slug>.md` (or the page with `Accept: text/markdown`) and write the file under Code exactly. For Pro, send a Textures API key from https://textures.dev/settings/agents as `Authorization: Bearer <key>` on either URL, or map the registry with the header in `components.json`: `"registries": { "@textures": { "url": "https://textures.dev/r/{name}.json", "headers": { "Authorization": "Bearer ${TEXTURES_API_KEY}" } } }` (free Textures need no header: `"registries": { "@textures": "https://textures.dev/r/{name}.json" }`), then `npx shadcn@latest add @textures/<slug>`.

**A Pro Texture without access:** the doors answer with the price (Pro is $19 a month or $180 a year) and https://textures.dev/checkout?texture=<slug>. Tell the user and stop. Never retry, guess or reconstruct the code.

Every published Texture is listed at https://textures.dev/llms.txt and https://textures.dev/r/registry.json. Browse them at https://textures.dev/textures.
