# Parallax

A bounded depth cue linked to the surface's actual position in the viewport.

- Family: Motion, imported from `mizu-ui` or `mizu-ui/motion`
- Docs: https://mizu.user64bit.world/components/parallax
- Source: https://github.com/0xuser64bit/mizu/blob/main/packages/mizu/src/motion/Scroll.tsx

## Usage

```tsx
import { Parallax, ImageFigure } from "mizu-ui";

export function Example() {
  const field = (ground: string, mark: string) =>
    `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="720" height="360"><pattern id="d" width="36" height="36" patternUnits="userSpaceOnUse"><path d="M18 13l5 5-5 5-5-5z" fill="${mark}"/></pattern><rect width="720" height="360" fill="${ground}"/><rect width="720" height="360" fill="url(#d)"/></svg>`)}`;
  return (
    <Parallax distance={35}>
      <ImageFigure
        src={field("#141413", "#7e776b")}
        alt="A field of measurement diamonds"
        caption="Scroll the page to study the relationship."
        width={720}
        height={360}
      />
    </Parallax>
  );
}
```

## Copy it with the shadcn CLI

```sh
npx shadcn@latest init 0xuser64bit/mizu/preset # once, where there is no components.json
npx shadcn@latest add 0xuser64bit/mizu/parallax 0xuser64bit/mizu/image-figure
```

## Props

- `distance`: `number` (default `40`). Travel around rest in pixels, bounded to ±120.
- `children / className`: `ReactNode / string`. Prefer decorative media and stable surrounding text.

## Accessibility

No essential information depends on movement. Overflow contains the visual travel; children retain their own semantics.

## Motion

Motion's managed scroll subscription maps start/end positions directly. Reduced motion shows the resting state.
