Meteoroid
v1.0.0A cratered, hollow stone lit by one hard sun, with a second light inside shining out through holes in the craters. It turns slowly on its own, and a drag turns it, a flick throws it. Each seed makes a different rock. Shows a poster under reduced motion.
Installation
Run once in your project root to configure paths and dependencies:
npx vectorvesper initDownloads and registers the component in your project:
npx vectorvesper add meteoroidIf installing manually or managing your package lock:
npm install @vectorvesper/motion threeUsage
A dark hero or a section opener that wants one object to look at and play with. It fills the area, so lay your headline over it as children.
Import
Usage
Do
- Give it a poster: a still of the rock shown under reduced motion and on devices that cannot run the scene.
- Try a few seeds to find the stone that suits the page; each one is a different shape.
Don't
- Do not put buttons right over the rock if drag is on; the drag takes the pointer there. Set draggable to false, or keep them to the edges.
WebGL — render it on the client only
On Next.js, load it with ssr: false from a Client Component, as below. Vite apps need nothing extra.
prefers-reduced-motion and provides a graceful fallback.Props
A hollow, cratered stone that turns slowly in the dark, lit from inside through the cracks in its shell. Drag it to turn it, flick it and it keeps spinning, then settles back to its own pace.
<Meteoroid />
The rock, with your content laid over it. Fills the area, which is 100svh tall unless you size it.
| Prop | Type | Default | Description |
|---|---|---|---|
spin | number | 1 | How fast the rock turns. 0 holds it still until someone drags it. |
draggable | boolean | true | Whether a drag turns the rock, and a flick throws it. |
seed | number | 7 | Which rock to make. Each seed is a different stone. |
poster | string | — | Image shown where the scene cannot run: reduced motion, or a device below the floor. |
className | string | — | Sizes the area. Without a height it is 100svh tall. |
style | React.CSSProperties | — | Inline styles for the area. A height here wins over the default. |
children | React.ReactNode | — | Content drawn over the rock. |