# Scroll Portal

Scroll through Arrival, Descent and Signal: three dark frames that open into one another. The component includes wheel, touch and keyboard navigation, reduced-motion support and responsive labels that stay clear of the next frame.

## Embed

```html
<script src="https://kraft.team/components/assets/scroll-portal/1.0.0/component.js" defer></script>
<scroll-portal style="height: 540px"></scroll-portal>
```

The script is self-contained, including its styles, font and runtime. It registers a custom element and isolates its UI in a shadow root. No React setup or stylesheet is required on the embedding page. Set the element's height to suit your layout.

## Settings

| Attribute | Default | Range | Behavior |
| --- | --- | --- | --- |
| `frame-depth` | `1` | `0.4–2.5` | Larger values place the next frame farther away. |
| `perspective` | `1000` | `400–2000` | Camera perspective in pixels. |
| `scroll-length` | `1` | `0.5–3` | Scroll distance multiplier for each transition. |
| `frame-radius` | `16` | `0–48` | Visible frame corner radius in pixels. |
| `frame-border` | `1` | `0–4` | Visible border width in pixels. |
| `scrub` | `0.35` | `0–1.5` | Catch-up duration in seconds. Zero follows immediately. |
| `hold` | `0` | `0–0.8` | Rest time between transitions. |
| `dim` | `0.55` | `0–1` | Dimming of nested scene labels. |

Change attributes at any time. Invalid values fall back to their default; numeric values outside a range are clamped.

```js
const portal = document.querySelector('scroll-portal');
portal.setAttribute('frame-depth', '1.4');
portal.reset(); // Return the camera to Arrival while preserving settings.
const settings = portal.getSettings(); // Numeric camelCase keys.
portal.addEventListener('scroll-portal-change', event => {
  console.log(event.detail.active); // Camera has moved away from Arrival.
});
```

Focus the preview and use arrows, Page Up/Down, Space, Home or End. Wheel and touch gestures are handled inside the preview, with document scrolling released at the first and last scene. Reduced motion removes catch-up animation.

## Standalone demo and source

Open `dist/demo.html` beside `dist/component.js` to try the preview and all eight settings. The downloadable ZIP includes these files, source, build scripts and dependency notices.

```sh
npm install
npm run build
npm test
```

The visual was recreated from the reference selected for kraft.team. It contains the portal only, without React Bits branding, navigation or account UI. Bundled dependencies retain their own licenses in `licenses/` and the bundle's legal notices.
