React Singularity Shaders
React blackhole singularity with whirling effects. Cosmic vortex patterns for Next.js with TypeScript and shadcn/ui—free code.
Powered by
Building blackhole effects?
Join our Discord community for help from other developers working with cosmic effects and gravitational distortions.
Need mesmerizing blackhole effects with realistic gravitational distortion? Most developers use simple spiral animations that can't capture the complex physics of spacetime warping. This React singularity component uses GPU mathematical transformations to create authentic blackhole visualization with accretion disk and event horizon.
Copy-paste TypeScript component that creates stunning singularity effects with gravitational lensing, spiral distortion, and cosmic coloring. Advanced spacetime mathematics with customizable parameters. Built for Next.js applications with shadcn/ui design system. GPU-accelerated—smooth cosmic vortex.
React singularity with gravitational physics
Whirling blackhole with accretion disk, rim highlighting, and spiral distortion:
Original shader by XorDev - "Singularity"
Perfect for React 19, Next.js 15, and modern TypeScript projects. Blackhole effects generated entirely on GPU using matrix transformations and logarithmic spirals. Customizable speed, intensity, size, wave strength, and color gradients. Full shadcn/ui compatibility with Tailwind CSS styling.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/singularity-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/singularity-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/singularity-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/singularity-shaders.json
Usage
import { SingularityShaders } from "@/components/ui/singularity-shaders";
export default function CosmicSingularity() {
return (
<SingularityShaders
speed={1.0}
intensity={1.2}
size={1.1}
waveStrength={1.0}
colorShift={1.0}
>
<div className="relative z-10">
<h1>Content over singularity</h1>
</div>
</SingularityShaders>
);
}
Why blackhole effects are scientifically challenging
Simple rotational effects can't capture gravitational lensing. Static spiral patterns lack the complex distortion of spacetime warping. Most animations ignore the physics of accretion disks and event horizons. Traditional approaches can't simulate the exponential intensity gradients near the singularity.
GPU matrix mathematics solve this with authentic gravitational physics simulation. Logarithmic spiral coordinates mimic spacetime curvature. Perspective transformations create lensing effects. Exponential gradients simulate the extreme brightness of matter falling into the blackhole.
This React singularity component uses professional astrophysical visualization techniques. Matrix rotations create spiral distortion. Distance-squared attenuation simulates gravitational fields. Wave accumulation creates accretion disk turbulence. Rim highlighting shows the photon sphere.
React singularity shader features
- Gravitational lensing - Matrix transformations simulate spacetime curvature and distortion
- Logarithmic spirals - Authentic spiral coordinates based on blackhole physics
- Accretion disk simulation - Wave accumulation creates turbulent matter patterns
- Event horizon darkness - Distance-based attenuation creates the central void
- Photon sphere highlighting - Rim lighting at the critical orbital radius
- Perspective warping - Dynamic field-of-view changes near the singularity
- Exponential gradients - Realistic brightness falloff from extreme gravitational effects
- Red/blue shifting - Color gradients simulate Doppler effects from rotating matter
- Wave distortion - Sine wave patterns simulate magnetic field interactions
- Iterative accumulation - Multiple wave layers create complex turbulence patterns
- Speed control - Animation timing for rotation and time dilation effects
- Size scaling - Blackhole diameter and gravitational field strength
- Intensity modulation - Overall brightness and contrast control
- TypeScript React component - Full IDE support with prop definitions
- Next.js compatible - Works with App Router and modern React patterns
- shadcn/ui integration - Consistent with Tailwind CSS design systems
- Copy-paste installation - No vendor lock-in, you own the shader code
API Reference
SingularityShaders
Main container component for the blackhole singularity effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Rotation and animation speed (0.5 to 2.0) |
intensity | number | 1.0 | Overall brightness multiplier (0.5 to 3.0) |
size | number | 1.0 | Blackhole diameter scaling (0.5 to 2.0) |
waveStrength | number | 1.0 | Accretion disk turbulence (0.5 to 2.0) |
colorShift | number | 1.0 | Color gradient intensity (0.5 to 2.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
GPU singularity troubleshooting
Rotation too slow/fast: Adjust speed
for comfortable viewing. Lower values create meditative cosmic rotation, higher values create intense gravitational dynamics.
Effect too dim/bright: Use intensity
to control overall brightness. Blackholes have extreme dynamic ranges - adjust for your display and viewing conditions.
Blackhole too small/large: Modify size
for optimal visual impact. Smaller values create intense, focused singularities. Larger values create expansive gravitational fields.
Accretion disk too calm/chaotic: Adjust waveStrength
for turbulence level. Lower values create smooth matter flow, higher values create violent magnetic interactions.
Colors too muted/vivid: Use colorShift
to control Doppler effect intensity. This affects the red/blue gradient that simulates matter velocity.
Mobile performance: Singularity effects are moderately intensive but well-optimized. Modern mobile GPUs handle the matrix operations and wave calculations smoothly.
Scientific accuracy: While visually inspired by blackhole physics, this is an artistic interpretation optimized for beauty rather than strict scientific accuracy.
More React shader components
Explore other GPU-accelerated shader components for Next.js applications:
Nebula Shaders
Procedural cosmic clouds with fractal structures and animated twinkling star fields
Cosmic Waves Shaders
Flowing cosmic ocean patterns with multi-layer waves and starfields
Plasma Shaders
Organic energy effects with flowing plasma patterns and smooth color cycling
Tunnel Shaders
Hypnotic infinite tunnel with RGB separation and psychedelic distortion
Advanced Tunnel Shaders
3D tunnel with raymarching, bump mapping, and volumetric lighting effects
Fractals Shaders
Infinite geometric patterns with IFS algorithms and volumetric rendering
React singularity FAQ
Simplex Truchet Weave Shaders
Complex toroidal weave patterns using simplex grid tessellation with random rendering order. Advanced mathematical pattern generation for sophisticated geometric visualizations.
React Smoke Shaders
React smoke with GPU volumetric rendering. Realistic smoke effects for Next.js with TypeScript and shadcn/ui—free code.