# Foundry Cipher — Animated Card for React

> A scramble-reveal card: churning angular neutral glyphs on near-black, with a soft-edged diamond aperture that follows the cursor and resolves glyphs at its center to bright white. A static title sits on top regardless of hover, and keyboard focus opens the aperture dead-center. A ghost aperture idles across the field when untouched.

- Page: https://crucibleui.com/components/cards/foundry-cipher
- Category: [cards](https://crucibleui.com/components/cards)
- Tier: pro (one-time purchase, see https://crucibleui.com/pricing)
- Engine: canvas

## Install

```bash
npx shadcn@latest add @crucible/foundry-cipher
```

Pro install requires adding the token-bearing `@crucible` registry to components.json (issued at https://crucibleui.com/account after purchase).

Import from `@/components/crucible/foundry-cipher`.

## Props (`FoundryCipherProps`)

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children?` | `React.ReactNode` | — | Card content, rendered above the glyph field (bottom-aligned copy works well). |
| `title?` | `string` | — | Static label pinned dead-center over the field, visible regardless of hover. |
| `revealRadius?` | `number` | `130` | Half-diagonal of the diamond aperture in px — the distance from the pointer at which glyphs cool back to dormant. |
| `charset?` | `string` | — | Characters the field churns through. Angular foundry stampings by default. |
| `churnSpeed?` | `number` | `1` | Churn rate multiplier. 1 = default simmer, 2 = twice as fast. |
| `colors?` | `[string, string, string]` | `a neutral silver ramp` | `[cold, mid, bright]` — dormant glyph color, the mid ring of the aperture, and the white-bright center, as hex strings. |
| `cellSize?` | `number` | `16` | Glyph cell size in px. Bigger = coarser stampings. |
| `heat?` | `number` | `1` | 0–1 master intensity: aperture glow, glyph brightness, churn energy. |
| `paused?` | `boolean` | — | Freeze the churn at its current frame (aperture still follows the pointer). |
| `seed?` | `number` | `7` | Deterministic seed for the initial glyph layout (and the idle ghost's path). |
| `idle?` | `boolean` | `true` | Idle autoplay: after 1.5s with no pointer or focus, a ghost aperture drifts the field on a slow seeded Lissajous path at reduced openness, so the card never reads as dead. A real pointer or keyboard focus takes over instantly. Off under reduced motion and while `paused`. |

Also accepts: `React.ComponentPropsWithoutRef<"div">`.

## Usage example

```tsx
import { FoundryCipher } from "@/components/crucible/foundry-cipher";

export default function FoundryCipherDemo() {
  return (
    <div className="relative isolate flex h-full min-h-[360px] w-full items-center justify-center overflow-hidden rounded-xl bg-neutral-950">
      <div
        aria-hidden
        className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.035),transparent_70%)]"
      />
      <div className="relative z-10 flex flex-col items-center gap-6 py-6">
        <FoundryCipher title="Decode" className="w-80">
          <div className="flex h-72 flex-col justify-end bg-gradient-to-t from-black/85 via-black/30 to-transparent p-6">
            <h3 className="text-base font-semibold tracking-tight text-white">
              A field of shifting glyphs
            </h3>
            <p className="mt-1 text-sm leading-relaxed text-white/60">
              Glyphs resolve bright inside the aperture, then cool as it moves on.
            </p>
          </div>
        </FoundryCipher>
        <p className="text-sm text-neutral-500">
          Move your cursor over the card — Tab opens the aperture dead-center.
        </p>
      </div>
    </div>
  );
}
```

## Accessibility & performance

Honors `prefers-reduced-motion` with a designed static frame or fade (never a blank box) and passes `className` through. Pauses offscreen and on hidden tabs, clamps device pixel ratio, and tears down its GL/canvas context on unmount.
