Truchet Kaleidoscope Shaders
Stunning kaleidoscope effects with advanced Truchet patterns and layered tunneling. Complex geometric transformations creating mesmerizing symmetrical visuals with depth.
Building kaleidoscope effects?
Join our Discord community for help from other developers working with advanced geometric transformations.
Look, we've all tried to build kaleidoscope effects. You either end up with basic CSS transforms that look nothing like proper optical kaleidoscopes or JavaScript calculations that can't handle complex geometric mirroring smoothly. This React component uses advanced mathematical transformations with Truchet patterns that actually runs at 60fps without melting your CPU.
Hypnotic kaleidoscope tunnel animation
Complex geometric patterns with layered depth and mathematical symmetry creating authentic kaleidoscope effects:
Created by mrange in 2021-12-28
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL kaleidoscope transformations with Truchet pattern generation and tunnel depth layering. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/truchet-kaleidoscope-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/truchet-kaleidoscope-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/truchet-kaleidoscope-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/truchet-kaleidoscope-shaders.json
Usage
import { TruchetKaleidoscopeShaders } from "@/components/ui/truchet-kaleidoscope-shaders";
export default function Hero() {
return (
<TruchetKaleidoscopeShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</TruchetKaleidoscopeShaders>
);
}
Why most kaleidoscope implementations suck
Most developers try to create kaleidoscope effects with CSS clip-path or Canvas API mirroring. Bad idea. You're dealing with expensive DOM transformations, limited symmetry calculations, and wondering why your React app feels sluggish. Some use SVG patterns with manual rotation, which sounds smart until you realize you're computing geometric reflections for every pattern element on every frame.
This React component uses mathematical polar coordinate transformations with GPU-accelerated Truchet pattern generation. The GPU handles everything using optimized geometric algorithms with authentic kaleidoscope mathematics. No JavaScript calculations, no DOM rendering, just smooth 60fps kaleidoscope art.
Features
- Zero JavaScript animation overhead - Pure WebGL kaleidoscope math runs on GPU
- Advanced Truchet patterns with procedural geometric generation
- Layered tunnel depth creating authentic three-dimensional kaleidoscope effects
- Polar coordinate transformations for perfect symmetrical mirroring
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 4 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
TruchetKaleidoscopeShaders
Main container component for the kaleidoscope effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed multiplier (0.1 to 3.0) |
complexity | number | 1.0 | Pattern complexity and density (0.1 to 2.0) |
tunnelDepth | number | 6.0 | Number of layered planes (1.0 to 10.0) |
rotationSpeed | number | 1.0 | Kaleidoscope rotation speed (0.1 to 3.0) |
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 kaleidoscope calculations. Consider reducing complexity and tunnelDepth for better performance.
Pattern too complex: Lower the complexity
prop for simpler geometric patterns. Values around 0.5-0.7 work well for cleaner kaleidoscope effects.
Tunnel too shallow: Increase the tunnelDepth
prop for more layered depth perception. Values around 8.0-10.0 create deep, immersive tunnel effects.
Animation too fast: Lower the speed
and rotationSpeed
props for more controlled kaleidoscope movement. Values around 0.3-0.5 work well for contemplative effects.
You might also like
Explore other shader-based background components for React applications:
Simplex Truchet Weave
Complex toroidal weave patterns using simplex grids
Hexagon Grid Pattern
Beautiful hexagonal tessellation with overlapping geometry
Triangle Mesh Incircles
Advanced Delaunay triangulation with inscribed circles
Smooth Voronoi Contours
Mathematical Voronoi patterns with smooth interpolation
Abstract Mod Shaders
3D abstract raymarching with procedural geometry
Perspex Web Lattice
3D lattice structures with web-like connectivity
Questions developers actually ask
Triangle Mesh Incircles Shaders
Advanced Delaunay triangulation with inscribed circles and layered mesh geometry. GPU-accelerated mathematical tessellation for complex geometric visualizations.
React Truchet Shaders
React Truchet patterns with procedural tiling. Geometric pattern effects for Next.js with TypeScript and shadcn/ui—free code.