Needle field
Playground
Pattern
Colour
Pointer
Install
npm install @shavin/fximport { NeedleField } from "@shavin/fx";Works with
React
Client component; Next.js and any React 18+ app
Remotion
Frame-exact through FxTimeProvider or time
Flow
Component Source
import { NeedleField } from "@shavin/fx/needle-field";
<NeedleField className="h-72" />Wave
Component Source
<NeedleField pattern="wave" spacing={18} length={0.8} />Still until hovered
Component Source
<NeedleField pattern="still" angle={75} spacing={20} thickness={1.6} reach={0.35} />Radial, brand colour
Component Source
<NeedleField pattern="radial" color="brand" spacing={16} thickness={1.6} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| pattern | "flow" | "wave" | "radial" | "still" | "flow" | Idle motion of the grid. |
| spacing | number | 22 | Grid spacing in CSS px. |
| length | number | 0.7 | Needle length as a fraction of the spacing. |
| thickness | number | 1.2 | Stroke width in CSS px. |
| speed | number | 1 | Animation speed multiplier. |
| interactive | boolean | true | Needles near the pointer turn to face it and stretch (mouse, touch and pen). |
| reach | number | 0.5 | Pointer reach as a fraction of the shorter side. |
| angle | number | 90 | For the still pattern: the direction every needle rests at, in degrees (0 right, 90 up). |
| color | FxColor | "fg" | Needle colour: a theme token (fg, brand, muted), any CSS colour or var(--token), or a { light, dark } pair. |
| tone | FxColor | — | Deprecated: use color. |
| grain | number | 0 | Film grain over the canvas, 0 to 0.3 (0 is off). |
| time | number | — | Controlled time in seconds (e.g. frame / fps in Remotion): draws exactly this moment, no clock of its own. Also read from FxTimeProvider. |