Metallic Lava
wise-ui/metallic-lavaFreeComponent
An animated metallic lava background using WebGL shaders.
Live preview
live · rendered by the registry
Rendered by wise-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://wise-ui.com/r/metallic-lava.jsonSource
1"use client"23import * as React from "react"4import { cn } from "@/lib/utils"56interface MetallicLavaProps extends React.HTMLAttributes<HTMLDivElement> {7 /** Base metallic color */8 color?: string9 /** Highlight/specular color */10 highlightColor?: string11 /** Animation speed multiplier (1 = default) */12 speed?: number13 /** Number of lava blobs */14 blobCount?: number15 /** Visual mode - "dark" renders light blobs on dark, "light" inverts */16 mode?: "dark" | "light"17}1819const MetallicLava = React.forwardRef<HTMLDivElement, MetallicLavaProps>(20 (21 {22 color = "#8a9bae",23 highlightColor = "#c5d0dc",24 speed = 1,25 blobCount = 28,26 mode = "dark",27 className,28 children,29 ...props30 },31 ref32 ) => {33 const canvasRef = React.useRef<HTMLCanvasElement>(null)34 const containerRef = React.useRef<HTMLDivElement>(null)3536 React.useImperativeHandle(ref, () => containerRef.current!)3738 React.useEffect(() => {39 const canvas = canvasRef.current40 const container = containerRef.current41 if (!canvas || !container) return4243 const ctx = canvas.getContext("2d")44 if (!ctx) return4546 // Padding around canvas for blur/contrast filter - prevents edge artifacts47 const PAD = 8048 let w = 049 let h = 050 let rafId = 05152 interface Blob {53 x: number54 y: number55 rx: number56 ry: number57 rotation: number58 rotSpeed: number59 vx: number60 vy: number61 phase: number62 freq: number63 ampX: number64 ampY: number65 pulsePhase: number66 pulseSpeed: number67 numPoints: number68 offsets: number[]69 }7071 let blobs: Blob[] = []7273 function initBlobs() {74 // Distribute blobs in a jittered grid for even coverage75 const cols = Math.max(1, Math.ceil(Math.sqrt(blobCount * w / h)))76 const rows = Math.max(1, Math.ceil(blobCount / cols))77 const cellW = w / cols78 const cellH = h / rows7980 blobs = Array.from({ length: blobCount }, (_, i) => {81 const col = i % cols82 const row = Math.floor(i / cols)83 const baseSpeed = 0.12 + Math.random() * 0.3584 const angle = Math.random() * Math.PI * 285 const baseR = 50 + Math.random() * 12086 const stretch = 0.5 + Math.random() * 1.087 const numPoints = 8 + Math.floor(Math.random() * 5)88 const offsets = Array.from(89// … truncated
What it pulls in
npm packages
Files it writes
More from wise-ui
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Tabsanimated-tabs | wise-ui | Components | Free | 3 deps | |
| Border Beamborder-beam | wise-ui | Components | Free | 3 deps | |
| Data Tabledata-table | wise-ui | Components | Free | 3 deps | |
| Dockdock | wise-ui | Components | Free | 3 deps | |
| Dot Matrixdot-matrix | wise-ui | Components | Free | 2 deps | |
| Editable Texteditable-text | wise-ui | Components | Free | 4 deps | |
| Gradient Sidebargradient-sidebar | wise-ui | Components | Free | 3 deps | |
| Kanban Boardkanban-board | wise-ui | Components | Free | 6 deps |
