
A Background Component with Moving Stars This component creates an animated starfield background using react-three-fiber and @react-three/drei. Thousands of small points are randomly distributed in a spherical shape, and the entire group rotates slowly to simulate a space-like effect. The stars gently rotate by default, and they respond to the user's scroll direction, creating a dynamic and immersive background. The effect is rendered in a <Canvas> using Three.js within React.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Stars Background to your project and fits it to your theme.
Code
How Stars Background is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { MyComponent } from "@/components/ui/stars-background"
const Home = () => {
return (
<>
<MyComponent />
</>
);
};
export default Home;