EF
EF Design System
ComponentsShooting Stars

Shooting Stars

Two Aceternity components that work together: ShootingStars renders animated shooting star trails via SVG, and StarsBackground renders a twinkling star field via Canvas. Layer them over a dark background for a cosmic effect.

AceternityAnimationBackgroundCanvas

Full Demo

Elevate Your Wellness

A comprehensive platform for health professionals and their clients, designed to track progress and deliver personalized programs.

tsx
import { ShootingStars } from "@/components/ui/shooting-stars";
import { StarsBackground } from "@/components/ui/stars-background";

<div className="relative h-[400px] rounded-2xl bg-neutral-950 overflow-hidden">
  <StarsBackground />
  <ShootingStars />
  <div className="relative z-10 flex items-center justify-center h-full">
    <h2 className="text-white text-2xl">Your Content Here</h2>
  </div>
</div>

Custom Colors & Speed

Green palette with larger, faster shooting stars

tsx
<div className="relative h-[300px] rounded-2xl bg-neutral-950 overflow-hidden">
  <StarsBackground starDensity={0.0003} />
  <ShootingStars
    starColor="#1db954"
    trailColor="#4caf50"
    minSpeed={15}
    maxSpeed={35}
    starWidth={15}
    starHeight={2}
  />
</div>

Stars Background Only

Dense twinkling star field without shooting stars

tsx
<div className="relative h-[200px] rounded-2xl bg-neutral-950 overflow-hidden">
  <StarsBackground
    starDensity={0.0004}
    twinkleProbability={0.9}
    minTwinkleSpeed={0.3}
    maxTwinkleSpeed={0.8}
  />
</div>

ShootingStars Props

PropTypeDefaultDescriptionRequired
minSpeednumber10Minimum speed of the shooting star (pixels per frame).No
maxSpeednumber30Maximum speed of the shooting star.No
minDelaynumber1200Minimum delay between shooting stars (ms).No
maxDelaynumber4200Maximum delay between shooting stars (ms).No
starColorstring'#9E00FF'Color of the shooting star head.No
trailColorstring'#2EB9DF'Color of the shooting star trail gradient.No
starWidthnumber10Width of the shooting star SVG rect.No
starHeightnumber1Height of the shooting star SVG rect.No
classNamestring--Additional classes on the SVG container.Yes

StarsBackground Props

PropTypeDefaultDescriptionRequired
starDensitynumber0.00015Stars per pixel of area. Higher values = more stars.No
allStarsTwinklebooleantrueWhen true, all stars animate their opacity.No
twinkleProbabilitynumber0.7Probability each star twinkles (only used when allStarsTwinkle is false).No
minTwinkleSpeednumber0.5Minimum twinkle animation speed.No
maxTwinkleSpeednumber1Maximum twinkle animation speed.No
classNamestring--Additional classes on the canvas element.Yes

Usage Guidelines

  • Use as a hero section background or landing page decoration.
  • Layer StarsBackground first, then ShootingStars, then your content with relative z-10.
  • The parent container needs position: relative and overflow: hidden.
  • Keep starDensity between 0.0001 and 0.0005 for best performance and aesthetics.
  • Both components are canvas/SVG-based and run at 60fps with minimal CPU impact.
  • For reduced motion preferences, consider wrapping in a prefers-reduced-motion check.