Sun Rays

A WebGL2 shader of soft sunbeams fanning out from just past the top edge, turning and shimmering slowly, with film grain.

Props
Position
Color
#d2b979
Rays14
Spread1.40
Reach0.90
Glow1.00
Grain1.0
Speed1.00
Strength1.00

Installation

pnpm dlx shadcn@latest add @breeze/sun-rays

Usage

import { SunRays } from "@/components/breeze/sun-rays"

It sits behind a hero, with the sun just off the top edge. The canvas is transparent, so your background shows through.

<section className="relative isolate overflow-hidden">
  <SunRays className="absolute inset-0 -z-10 h-full w-full" />
  {/* content */}
</section>

Props

PropTypeDefaultDescription
colorstring"#d2b979"Light colour, any CSS colour or var()
position"top" | "top-left" | "top-right""top"Where the sun sits, just past the edge
raysnumber14How many beams. Higher is finer
spreadnumber1.4How wide the beams fan out
reachnumber0.9How far the beams reach into the box
glownumber1Brightness of the sun and its beams
grainnumber1Film grain amount. 0 for a clean finish
speednumber1Animation speed multiplier. 0 freezes the rays
strengthnumber1Opacity multiplier
fpsnumber60Frame rate cap

Every prop updates live without restarting the animation. It only ever uses color itself; the beams change how much of it shows. The beams turn and shimmer slowly, and light flows outward along them. On dark pages it glows a little softer, so it never floods the page. The animation pauses off-screen and shows a still frame with reduced motion.

Examples

From the corner