Cosmic Web
A section that scrolls into depth. It opens on the web of galaxies that fills the universe and dives through it to the basin one galaxy sits in, while your cards come up out of the distance one at a time, hold, and pass behind the camera.
Included with membership
Members install Cosmic Web 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
The story of a product, a platform or a body of work with a few parts and one idea under them: three to six cards on the way down to a closing line. It takes over a stretch of scrolling, so use one a page. Inside a box rather than the page, drive it with progress from a slider, a timeline or a scroller of your own.
- Give each card a background of its own. Cards pass over the web, and a see-through one is hard to read.
- Use muted, looping videos with preload set to metadata. A card's video plays only while the card is in view, so it loads when the card first comes near.
- Keep the clips short and small, a few hundred kilobytes each. Starting a video takes the browser a moment, and on a phone that can show as a brief catch in the dive.
- Keep the opening and the ending short. The opening fades as the dive starts, and the ending sits beside the galaxy, or over its lower half on a narrow screen.
Avoid:
- Do not put it inside an element that scrolls without passing progress. On its own it follows the window's scroll, so it would never move.
- Do not put two on one page. Each draws a scene the size of the screen.
Props
A section that scrolls into depth. It opens on the web of galaxies that fills the universe and dives through it to the basin one galaxy sits in: thousands of strands, each the path a galaxy falls along, sweeping in to a bright ridge. Your cards come up out of the distance one at a time, hold, and pass behind the camera.
<CosmicWeb />
The dive, its opening, its cards and its ending. On its own it adds its length of scrolling to the page and plays as the window scrolls.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | Each child is one card, met in order on the way down. A video inside a card plays while the card is in view. |
opening | React.ReactNode | — | Over the web at the top. It is left behind as the dive starts. |
ending | React.ReactNode | — | Beside the galaxy at the bottom. On a wide screen the galaxy moves right to make room. |
cardWidth | string | "min(420px, 84vw)" | How wide a card is, as CSS. |
length | number | 300, plus 80 for each card | How long the dive is, as a percentage of the screen's height: 300 is three screens of scrolling. |
progress | number | — | Where the dive is, 0 to 1, when you drive it yourself: from a slider, a timeline or your own scroller. The web then fills its box, so give that a height, and adds no scrolling of its own. Leave it out to play it by scrolling the page. |
intro | boolean | true | The web gathers out of an even fog when the scene first draws. |
interactive | boolean | true | The pointer nudges the camera. |
palette | Partial<CosmicWebPalette> | — | Colours for space, the threads, the knots and the basins, over the defaults in `COSMIC_WEB_PALETTE`. Read when the scene is built. |
seed | number | 11 | A different number gives a different web. Read when the scene is built. |
className | string | — | Class for the outer element. |
<CosmicWebPalette />
typeThe colours palette sets. COSMIC_WEB_PALETTE holds the defaults, so pass only the ones you change.
| Prop | Type | Default | Description |
|---|---|---|---|
background* | string | — | Empty space. |
filament* | string | — | The threads of the web. |
knot* | string | — | The knots where threads meet. |
flow* | string | — | The strands of the basin at the end. |
beyond* | string | — | The strands of the basins round it. |