Noise Texture
svelte-animations/noise-textureFreeBlock
An SVG fractal noise layer using feTurbulence for subtle texture overlays.
Install it
npx shadcn@latest add https://sv-animations.vercel.app/r/noise-texture.jsonSource
1<script lang="ts">2 import type { SVGAttributes } from "svelte/elements";3 import { cn } from "$UTILS$";45 interface NoiseTextureProps extends SVGAttributes<SVGSVGElement> {6 class?: string;7 /**8 * `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.9 * @default 0.410 */11 frequency?: number;12 /**13 * `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.14 * @default 615 */16 octaves?: number;17 /**18 * Linear slope on each channel after desaturation; adjusts contrast of the noise.19 * @default 0.1520 */21 slope?: number;22 /**23 * Opacity of the filled noise layer (`rect`).24 * @default 0.625 */26 noiseOpacity?: number;27 }2829 let {30 class: className,31 frequency = 0.4,32 octaves = 6,33 slope = 0.15,34 noiseOpacity = 0.6,35 ...props36 }: NoiseTextureProps = $props();3738 let filterId = $props.id();39</script>4041<svg42 class={cn(43 "pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none dark:opacity-[0.75]",44 className45 )}46 xmlns="http://www.w3.org/2000/svg"47 {...props}48>49 <filter id={filterId}>50 <feTurbulence51 type="fractalNoise"52 baseFrequency={frequency}53 numOctaves={octaves}54 stitchTiles="stitch"55 />56 <feColorMatrix type="saturate" values="0" />57 <feComponentTransfer>58 <feFuncR type="linear" {slope} />59 <feFuncG type="linear" {slope} />60 <feFuncB type="linear" {slope} />61 </feComponentTransfer>62 </filter>63 <rect width="100%" height="100%" filter={`url(#${filterId})`} opacity={noiseOpacity} />64</svg>
Files it writes
More from Svelte Animations
All 66 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | Svelte Animations | Blocks | Free | 1 dep · 6 files | |
| Animated Circular Progress Baranimated-circular-progress-bar | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Gradient Textanimated-gradient-text | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Grid Patternanimated-grid-pattern | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Listanimated-list | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Shiny Textanimated-shiny-text | Svelte Animations | Blocks | Free | no deps | |
| Animated Theme Toggleranimated-theme-toggler | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Arc Timelinearc-timeline | Svelte Animations | Blocks | Free | no deps · 3 files |
