Event Horizon
Included with membership
Members install Event Horizon with one command and get the full source, the usage code and the Framer remix, licensed for client work. One membership covers the whole library and the CLI.
When to use it
Moving between the pages of a site where the jump should feel like a moment: a portfolio, a magazine, a launch. It needs client-side navigation, such as router.push in Next.js or navigate in React Router. Keep it for the links that matter on a busy app, because a transition on every click soon tires.
- Put the provider in a layout that stays mounted between pages, so a transition is not cut off half way.
- Pass prefetch as well as navigate. Links then warm their page on hover and focus, so it is ready under the hole.
- Use EventHorizonLink for links that should fall through, and navigate from useEventHorizon for buttons.
- Pass the click point when you start a transition yourself, so the hole opens under the pointer.
Avoid:
- Do not use it on pages that scroll inside an element instead of the window. The falling page is placed by the window's scroll, so it would show the top of the page.
- Do not count on canvases or videos in the falling page. It is a copy of the old page, and copies of those can come out blank or start again.
- Do not leave out navigate. Without it, links load the next page as usual and nothing animates.
Props
A page transition. When a visitor follows a link, the page they are on is pulled into the point they clicked: it bends towards that point, gathers into pleats and is swallowed, and the next page is already waiting underneath. Nothing runs between transitions.
<EventHorizonProvider />
Wraps the page and plays the transition. Renders its children inside a full-width element.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | The pages the transition plays between. |
navigate | (href: string) => unknown | — | Client-side navigation, e.g. `router.push` in Next.js or `navigate` in React Router. Without it, links do a full page load and nothing animates. |
prefetch | (href: string) => void | — | Warms a route before it is clicked, e.g. `router.prefetch`. Called on hover and focus. |
duration | number | 1100 | Length of the whole transition in milliseconds. |
holeSize | number | 0.15 | Width of the pull's centre as a fraction of the viewport's height, kept between 100 and 168 pixels. Smaller pulls the page in tighter. |
suction | number | 1 | Suction force multiplier. |
disabled | boolean | false | Turns the animation off; links still navigate. |
onStart | (href: string) => void | — | Called as a transition starts, with the destination. |
onEnd | (href: string) => void | — | Called once the new page has fully opened, or straight after a plain navigation. |
className | string | — | Added to the element that wraps the page. |
<EventHorizonLink />
A link that falls through the hole from where it was clicked. Takes any prop an anchor takes. Clicks with a modifier key, links that open a new tab and downloads behave as plain links.
| Prop | Type | Default | Description |
|---|---|---|---|
href* | string | — | Where the link goes. Links to this site fall through the hole; any other link opens as usual. |
<useEventHorizon />
hookStarts a transition from code. Use it inside the provider; outside it, it throws.
| Prop | Type | Default | Description |
|---|---|---|---|
navigate* | (href: string, at?: { x: number; y: number }) => void | — | Navigates to `href` through the hole. `at` is where the hole opens, in viewport pixels; the centre of the screen if left out. |
prefetch* | (href: string) => void | — | Warms a page before it is visited, through the provider's prefetch. |