Cosmic Web

ProScroll3DWebGLpowered by @vectorvesper/motion

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.

Cosmic Web

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.

PropTypeDefaultDescription
childrenReact.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.
openingReact.ReactNode—Over the web at the top. It is left behind as the dive starts.
endingReact.ReactNode—Beside the galaxy at the bottom. On a wide screen the galaxy moves right to make room.
cardWidthstring"min(420px, 84vw)"How wide a card is, as CSS.
lengthnumber300, plus 80 for each cardHow long the dive is, as a percentage of the screen's height: 300 is three screens of scrolling.
progressnumber—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.
introbooleantrueThe web gathers out of an even fog when the scene first draws.
interactivebooleantrueThe pointer nudges the camera.
palettePartial<CosmicWebPalette>—Colours for space, the threads, the knots and the basins, over the defaults in `COSMIC_WEB_PALETTE`. Read when the scene is built.
seednumber11A different number gives a different web. Read when the scene is built.
classNamestring—Class for the outer element.

<CosmicWebPalette />

type

The colours palette sets. COSMIC_WEB_PALETTE holds the defaults, so pass only the ones you change.

PropTypeDefaultDescription
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.
Visitors who prefer reduced motion get a still page instead: the opening, the cards and the ending in one column over a still backdrop. Nothing moves on its own. Devices below the runtime's floor get the same.
It runs on the shared frame loop and draws nothing while it is off screen. On a phone it starts with about half as many of everything. When frames run long it draws fewer galaxies at a lower resolution, and the cards move by transform and opacity only, so they never cause layout.
palette, seed and intro are read when the scene is built, so give it a new key to change those. interactive changes live.
Client component. The server renders your opening, cards and ending, and the web is built in the browser as the section comes near.
Back to all components