ValyroUI Русская версия

Stars Background

Starry sky with cursor parallax. Pro · Effects › Backgrounds

A starfield that drifts upwards in three parallax layers, with a few brighter stars twinkling out of step, and leans towards the pointer on a spring — the near layers further than the far ones, so the sky has depth. Each layer is one painted box-shadow list the compositor slides, so a few hundred stars cost one layer; the twinkle is opacity only. The field is sized to the area and its star count follows the area's size, denser in a small one; the drift pauses off screen and in a hidden tab, and stops under reduced motion.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add stars-background
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { StarsBackground } from 'valyro-ui-pro';

Props

PropTypeDefault
speednumber50Seconds the nearest stars take to drift 2000 px up; the farther layers are slower (default 50).
factornumber0.05How far the field leans towards the pointer, as a share of the pointer's distance from the centre (default 0.05).
starColorstringStar colour (default: the theme's --ui-stars-background-color, else its foreground).
parallaxbooleantrueLean towards the pointer with a spring (default true; never on touch or under reduced motion). Nearer layers lean further, for depth.
twinklebooleantrueA few brighter stars that slowly twinkle, each group on its own beat (default true; still under reduced motion).

Related components

Previous: Bubble Background · Next: Hexagon Background · All Effects