Join our Discord Community

Triangle Mesh Incircles Shaders

Advanced Delaunay triangulation with inscribed circles and layered mesh geometry. GPU-accelerated mathematical tessellation for complex geometric visualizations.

Powered by

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:

Loading component...

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.

PropTypeDefaultDescription
speednumber1.0Animation speed multiplier (0.1 to 3.0)
scalenumber5.0Mesh scale and triangle density (1.0 to 10.0)
showIncirclesbooleantrueShow inscribed circles within triangles
showBackgroundMeshbooleantrueShow layered background triangulation
colorPalettenumber0Color scheme (0-3: default, multi, mixed, mono)
classNamestring-Additional Tailwind CSS classes
...propsHTMLAttributes<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:

Questions developers actually ask