Join our Discord Community

Truchet Kaleidoscope Shaders

Stunning kaleidoscope effects with advanced Truchet patterns and layered tunneling. Complex geometric transformations creating mesmerizing symmetrical visuals with depth.

Powered by

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:

Loading component...

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.

PropTypeDefaultDescription
speednumber1.0Animation speed multiplier (0.1 to 3.0)
complexitynumber1.0Pattern complexity and density (0.1 to 2.0)
tunnelDepthnumber6.0Number of layered planes (1.0 to 10.0)
rotationSpeednumber1.0Kaleidoscope rotation speed (0.1 to 3.0)
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 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:

Questions developers actually ask