TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/space-mission/llms.txt
Use this file to discover all available pages before exploring further.
Starfield component paints the deep-space backdrop that persists across every page of Space Mission. It renders three separate layers of CSS div-based stars — each layer a randomly seeded scatter of dots — plus animated shooting-star streaks, all inside a fixed full-viewport container that lives permanently behind all content. Because it never participates in the page’s document flow and never captures input events, it is completely transparent to the rest of the application.
Positioning
The container isfixed inset-0 with z-0 and pointer-events-none, so it:
- Stretches to fill the full viewport on every screen size.
- Does not scroll with page content.
- Does not block clicks, taps, or hover events on any element above it.
- Does not interfere with the Navigation bar (
z-50) or PageTransition content (z-10).
Star Layers
Stars are generated as plaindiv elements with rounded-full and bg-white (or a tinted colour for the second layer). Positions, sizes, and opacities are randomised once on mount using useState with an initialiser function so the values are stable across re-renders:
| Layer | Count | Colour | Size multiplier | Notes |
|---|---|---|---|---|
| 1 | 100 | white | ×1.0 | Background layer, low opacity |
| 2 | 75 | space-turquoise | ×1.2 | Mid layer, tinted stars |
| 3 | 50 | white | ×1.5 | Foreground, CSS box-shadow glow |
box-shadow glow applied inline:
Parallax Mouse Tracking
Each layer is wrapped in a Framer Motionmotion.div that shifts slightly as the mouse moves, giving the field a subtle 3D parallax effect. The cursor position is normalised to [-1, 1] and fed into Framer Motion spring MotionValues with a stiffness of 50 and damping of 20 (slow, smooth lag):
absolute inset-[-10%] w-[120%] h-[120%] so that the ±4 % parallax never reveals an empty edge.
Shooting Stars
Threemotion.div shooting-star streaks animate on an infinite loop. They are thin h-[1px] elements with a bg-gradient-to-r from-transparent via-white to-transparent that slide across the viewport at 35 ° rotation:
Nebula Blobs
Two large blurreddiv elements with mix-blend-screen sit behind the star layers to add soft ambient glow:
Usage
Starfield is rendered once at the root of the app, outside the router hierarchy, so it persists without remounting during page transitions:
Because
Starfield is outside <BrowserRouter>, it does not have access to React Router hooks. Do not place any <Link> or useLocation calls inside it.Customization
Star count. Change the argument passed togenerateStars(n) for each layer. Increasing beyond ~150 per layer may affect performance on low-end devices.
Size range. Adjust the Math.random() * 2 + 0.5 expression. The first term is the range spread and the second is the minimum size in pixels.
Parallax intensity. Change the translate ranges in useTransform:
repeatDelay values make streaks appear more often. Setting delay={0} on all three instances produces a meteor-shower effect.
Disable parallax. Remove the window.addEventListener('mousemove', ...) effect and set the layer style props to { x: 0, y: 0 }.