Triangle Mesh Incircles Shaders
Advanced Delaunay triangulation with inscribed circles and layered mesh geometry. GPU-accelerated mathematical tessellation for complex geometric visualizations.
Building complex geometric visualizations?
Join our Discord community for help from other developers working with advanced triangulation algorithms.
Look, we've all tried to build triangular meshes. You either end up with basic grid patterns that look nothing like proper Delaunay triangulation or JavaScript calculations that can't handle complex geometric algorithms smoothly. This React component uses advanced mathematical triangulation with inscribed circle geometry that actually runs at 60fps without melting your CPU.
Complex triangular mesh animation
Advanced Delaunay-inspired triangulation with inscribed circles and layered geometric complexity:
Created by Shane in 2018-04-13
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL Delaunay triangulation with inscribed circle calculations and multi-layered mesh rendering. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/triangle-mesh-incircles-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/triangle-mesh-incircles-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/triangle-mesh-incircles-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/triangle-mesh-incircles-shaders.json
Usage
import { TriangleMeshIncirclesShaders } from "@/components/ui/triangle-mesh-incircles-shaders";
export default function Hero() {
return (
<TriangleMeshIncirclesShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</TriangleMeshIncirclesShaders>
);
}
Why most triangulation implementations suck
Most developers try to create triangular meshes with SVG paths or Canvas API polygon drawing. Bad idea. You're dealing with expensive DOM manipulations, complex vertex calculations, and wondering why your React app feels sluggish. Some use Three.js with mesh geometry, which sounds smart until you realize you're computing Delaunay constraints for every triangle on every frame.
This React component uses mathematical Delaunay triangulation with GPU-accelerated inscribed circle calculations. The GPU handles everything using optimized geometric algorithms with authentic mathematical precision. No JavaScript calculations, no DOM rendering, just smooth 60fps triangular art.
Features
- Zero JavaScript animation overhead - Pure WebGL triangulation runs on GPU
- Delaunay triangulation with mathematical flip distance calculations
- Inscribed circle geometry using incenter and inradius calculations
- Multi-layered mesh rendering with background triangulation overlay
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 5 props for complete control
- Performance optimization through efficient GPU geometric algorithms
- shadcn/ui compatible for consistent design systems
- Responsive design with automatic canvas resizing
API Reference
TriangleMeshIncirclesShaders
Main container component for the triangle mesh effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed multiplier (0.1 to 3.0) |
scale | number | 5.0 | Mesh scale and triangle density (1.0 to 10.0) |
showIncircles | boolean | true | Show inscribed circles within triangles |
showBackgroundMesh | boolean | true | Show layered background triangulation |
colorPalette | number | 0 | Color scheme (0-3: default, multi, mixed, mono) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
Common gotchas
Animation not working: WebGL might not be supported in the browser. The component logs warnings when WebGL initialization fails. Check browser compatibility.
Performance issues on mobile: Some older phones struggle with complex triangulation calculations. Consider reducing scale and disabling showBackgroundMesh for better performance.
Triangles too dense: Lower the scale
prop for larger triangles with clearer geometric structure. Values around 3.0-4.0 work well for prominent triangular patterns.
Missing circles: Ensure showIncircles={true}
to display the inscribed circles. These circles are mathematically calculated to fit perfectly within each triangle.
Animation too fast: Lower the speed
prop for more controlled geometric movement. Values around 0.3-0.5 work well for subtle triangular flow.
You might also like
Explore other shader-based background components for React applications:
Hexagon Grid Pattern
Beautiful hexagonal tessellation with overlapping geometry
Smooth Voronoi Contours
Mathematical Voronoi patterns with smooth interpolation
Three Tap Voronoi
Advanced Voronoi tessellation with multi-tap sampling
Cellular Tiled Tunnel
Organic cellular patterns with tunnel effects
Perspex Web Lattice
3D lattice structures with web-like connectivity
Abstract Mod Shaders
3D abstract raymarching with procedural geometry
Questions developers actually ask
React 3-Tap Voronoi Shaders
Ultra-fast 3-tap Voronoi with simplex grid and cheap highlights. Pure WebGL cellular patterns for React with TypeScript and shadcn/ui—optimized GPU Voronoi cells.
Truchet Kaleidoscope Shaders
Stunning kaleidoscope effects with advanced Truchet patterns and layered tunneling. Complex geometric transformations creating mesmerizing symmetrical visuals with depth.