StealThis .dev

Light Rays

Atmospheric light rays emanating from a point, like sunlight through clouds, using CSS gradients and animated opacity.

Open in Lab
css javascript svelte vue
Targets: TS JS HTML React Svelte Vue

Code

Light Rays

Stunning volumetric light rays that emanate from a central point, simulating sunlight breaking through clouds or a divine glow effect. Built purely with CSS using rotated gradient pseudo-elements.

How it works

  1. Multiple elongated gradient elements are rotated at different angles from a central origin
  2. Each ray has a different width, opacity, and animation delay for organic variation
  3. CSS @keyframes animate opacity to create a pulsing, breathing light effect
  4. A radial gradient overlay softens the edges for a polished atmosphere

Customization

  • Change --ray-color to adjust the light color (warm gold, cool blue, etc.)
  • Modify the number of rays and their rotation angles
  • Adjust --ray-intensity for brighter or subtler effects
  • Control animation speed with --ray-speed

When to use it

  • Hero section dramatic backgrounds
  • Spiritual / ethereal themed pages
  • Product spotlight effects
  • Atmospheric landing pages