A high-performance WebGL-based tool for creating moiré interference patterns through layered geometric shapes.
git clone <repository-url>
cd Moire
npm install
npm run devOpen http://localhost:5173 to start creating patterns.
npm run buildThis creates an optimized build in the dist folder.
- Lines (1 pattern): Straight lines with adjustable angle and density
- Concentric (4 patterns): Circles, squares, triangles, and custom polygons (3-10 sides)
- WebGL Rendering: Hardware-accelerated graphics for smooth performance
- Layer System: Add and manage multiple pattern layers
- Canvas Interaction: Pan (click-drag), zoom (scroll), direct layer manipulation (Option+drag)
- Parameter Controls:
- Spacing/density control
- Line thickness adjustment
- Color selection with opacity
- X/Y offset for progressive patterns
- Rotation offset for spiral effects
- Phase control for ring positioning
- High DPI Support: Crisp rendering on retina displays
- Optimized Shaders: Fast path for simple patterns, adaptive ring checking for complex ones
- Left sidebar: Layer management and transforms
- Right sidebar: Pattern selection and parameters
- Canvas: Real-time WebGL preview with interactive controls
- Help modal: Keyboard shortcuts and interaction guide
- Add Layers: Click the
+button to add pattern layers - Select Patterns: Choose category (Lines/Concentric) and pattern type
- Adjust Parameters:
- Ring Spacing: Controls density of concentric patterns
- Line Width: Adjusts thickness of pattern lines
- X/Y Offset: Creates progressive offset effects
- Rotation Offset: Adds rotation between successive rings
- Position Layers: Use transform controls or Option+drag on canvas
- Create Interference: Overlap layers with different parameters for moiré effects
- Stack: React, TypeScript, Vite, Tailwind CSS
- Rendering: WebGL 2.0 with custom GLSL shaders
- Performance:
- Optimized shaders with early exit strategies
- Adaptive ring checking (3-4 rings for simple patterns, up to 60 for complex)
- 60+ FPS for most patterns on modern hardware
- Architecture:
- Custom WebGL renderer class for efficient resource management
- Shader caching system to prevent recompilation
- Single quad geometry for full-screen effects
The WebGL implementation provides significant performance improvements over Canvas 2D:
- 3x faster for simple concentric patterns without offsets
- 2x faster for complex patterns with offsets and rotations
- Smooth 60 FPS even with multiple layers active
- Efficient memory usage through shader caching and resource pooling
- No export functionality (PNG/SVG)
- No animation system
- Limited pattern types (only lines and concentric shapes currently)
- No undo/redo system
- No pattern presets or saving
- No curve-based patterns yet (sine waves, spirals, etc.)
High Priority:
- Add PNG/SVG export functionality
- Implement more pattern types (curves, tiles)
- Add pattern saving/loading
Medium Priority:
- Animation system with keyframes
- Pattern preset library
- More shape types (stars, polygons with more sides)
- Gradient fills and advanced blending modes
Low Priority:
- Collaborative features
- Educational tutorials
- WebGPU support for even better performance
The codebase is well-structured and TypeScript-typed. Key areas for contribution:
- Export system implementation
- New pattern types
- Performance optimizations
- UI/UX improvements
MIT
