progressive-blur
efferd-/progressive-blurFreeComponent
Progressive blur component.
Install it
npx shadcn@latest add http://efferd.com/r/progressive-blur.jsonSource
1"use client";2import { cn } from "@/lib/utils";3import { type HTMLMotionProps, motion } from "motion/react";45export const GRADIENT_ANGLES = {6 top: 0,7 right: 90,8 bottom: 180,9 left: 270,10};1112export type ProgressiveBlurProps = {13 direction?: keyof typeof GRADIENT_ANGLES;14 blurLayers?: number;15 className?: string;16 blurIntensity?: number;17} & HTMLMotionProps<"div">;1819export function ProgressiveBlur({20 direction = "bottom",21 blurLayers = 8,22 className,23 blurIntensity = 0.25,24 ...props25}: ProgressiveBlurProps) {26 const layers = Math.max(blurLayers, 2);27 const segmentSize = 1 / (blurLayers + 1);2829 return (30 <div className={cn("relative", className)}>31 {Array.from({ length: layers }).map((_, index) => {32 const angle = GRADIENT_ANGLES[direction];33 const gradientStops = [34 index * segmentSize,35 (index + 1) * segmentSize,36 (index + 2) * segmentSize,37 (index + 3) * segmentSize,38 ].map(39 (pos, posIndex) =>40 `rgba(255, 255, 255, ${posIndex === 1 || posIndex === 2 ? 1 : 0}) ${pos * 100}%`41 );4243 const gradient = `linear-gradient(${angle}deg, ${gradientStops.join(44 ", "45 )})`;4647 return (48 <motion.div49 className="pointer-events-none absolute inset-0 rounded-[inherit]"50 key={index}51 style={{52 maskImage: gradient,53 WebkitMaskImage: gradient,54 backdropFilter: `blur(${index * blurIntensity}px)`,55 WebkitBackdropFilter: `blur(${index * blurIntensity}px)`,56 }}57 {...props}58 />59 );60 })}61 </div>62 );63}
What it pulls in
npm packages
Files it writes
More from efferd
All 201 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| apple-iconapple-icon | efferd | Components | Free | no deps | |
| auth-dividerauth-divider | efferd | Components | Free | no deps | |
| copy-buttoncopy-button | efferd | Components | Free | no deps | |
| decor-icondecor-icon | efferd | Components | Free | no deps | |
| discord-icondiscord-icon | efferd | Components | Free | no deps | |
| facebook-iconfacebook-icon | efferd | Components | Free | no deps | |
| figma-iconfigma-icon | efferd | Components | Free | no deps | |
| formaterformater | efferd | Components | Free | no deps |
