Join our Discord Community

React Gradient Blinds

React gradient blinds with WebGL rendering. Features animated venetian blind effects, mouse interaction, and customizable spotlight with OGL.

Powered by

Creating interactive blind patterns?

Join our Discord community for help from other developers working with shader effects and WebGL.


Remember those old-school venetian blinds that would create mesmerizing light patterns on the wall as the sun moved throughout the day? The way slats of light and shadow would dance and shift, creating rhythmic stripes that seemed to pulse with their own life? Most interfaces settle for boring, flat backgrounds that don't respond to user interaction. This React component recreates that captivating blind effect with gradient colors, mouse-following spotlights, and customizable distortion that transforms any surface into an interactive light canvas.

Interactive venetian blinds with spotlight

Watch gradient stripes bend and flow with responsive mouse interaction and lighting:

Loading component...

Built for React applications with TypeScript and Next.js. Uses WebGL through OGL for hardware-accelerated shader rendering that maintains 60fps with complex gradient calculations and mouse tracking. The mathematical blind simulation creates authentic stripe patterns while the spotlight system adds dynamic illumination. Perfect for hero sections, interactive galleries, or any interface needing sophisticated visual depth. Seamless integration with shadcn/ui design systems.

Installation

npx shadcn@latest add https://www.shadcn.io/registry/gradient-blinds.json
npx shadcn@latest add https://www.shadcn.io/registry/gradient-blinds.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/gradient-blinds.json
bunx shadcn@latest add https://www.shadcn.io/registry/gradient-blinds.json

Why flat patterns feel lifeless

Developers create a striped background with CSS repeating gradients and consider it dynamic. Maybe they add a hover state that changes opacity. The problem? Static patterns don't respond to user presence or create the illusion of depth that makes interfaces feel alive and interactive.

Gradient blinds with mouse interaction change everything. They tap into our fascination with light and shadow—the way architectural elements create ever-changing patterns, how lighting transforms spaces throughout the day. The shader-based calculations create mathematically precise stripe patterns while mouse tracking adds the organic responsiveness that makes digital surfaces feel physical.

This component handles the complex WebGL mathematics automatically. Gradient interpolation, coordinate rotation, distance calculations, and spotlight blending all work together seamlessly. The result feels like controlling real venetian blinds with dynamic lighting, not a simple CSS effect.

Features

  • Dynamic gradient stripes with up to 8 customizable colors and smooth interpolation
  • Mouse-responsive spotlight with configurable radius, softness, and opacity
  • Blind count automation adapting to screen width with minimum blind width constraints
  • Rotation and distortion for angular blind effects and organic movement
  • Mirror gradient option creating symmetrical patterns for balanced compositions
  • Exponential mouse dampening for smooth, physics-based cursor tracking
  • Mix blend modes for creative layering with underlying content
  • Performance optimization with pause controls and efficient shader rendering
  • Noise integration for subtle texture variation and film grain effects
  • TypeScript support with complete prop forwarding and type safety

API Reference

GradientBlinds

PropTypeDefaultDescription
gradientColorsstring[]["#FF9FFC", "#5227FF"]Up to 8 hex colors for gradient (min 2 colors)
blindCountnumber16Number of venetian blind stripes
blindMinWidthnumber60Minimum blind width in pixels (overrides count if needed)
anglenumber0Rotation angle in degrees (-180 to 180)
spotlightRadiusnumber0.5Mouse spotlight size (0.1 to 2.0)
spotlightSoftnessnumber1Spotlight edge softness (0.1 to 5.0)
spotlightOpacitynumber1Spotlight intensity (0.0 to 2.0)
mouseDampeningnumber0.15Mouse follow smoothness (0.01 to 1.0)
mirrorGradientbooleanfalseCreate symmetrical gradient pattern
distortAmountnumber0Sine wave distortion strength (0.0 to 2.0)
shineDirection"left" | "right""left"Blind highlight direction
noisenumber0.3Random noise intensity for texture
pausedbooleanfalsePause animation and mouse tracking
mixBlendModestring"lighten"CSS blend mode for layering
dprnumber-Device pixel ratio override
classNamestring-Additional CSS classes
...propsHTMLAttributes<HTMLDivElement>-All standard div props

Gradient System

The component supports complex color gradients:

ColorsInterpolationPerformanceVisual Complexity
2 colorsLinear blendOptimalSimple gradient
3-4 colorsMulti-segmentGoodRich transitions
5-8 colorsComplex rampHigher GPU loadRainbow effects

Effect Combinations

// Classic venetian blinds
<GradientBlinds 
  gradientColors={["#f3f4f6", "#1f2937"]}
  blindCount={25}
  angle={0}
  spotlightRadius={0.4}
/>

// Neon cyberpunk effect
<GradientBlinds 
  gradientColors={["#ff0080", "#8000ff", "#0080ff"]}
  blindCount={12}
  angle={45}
  distortAmount={1.0}
  mixBlendMode="screen"
/>

// Organic flowing pattern
<GradientBlinds 
  gradientColors={["#fbbf24", "#f59e0b", "#d97706"]}
  mirrorGradient={true}
  distortAmount={0.8}
  mouseDampening={0.3}
/>

// High-contrast architecture
<GradientBlinds 
  gradientColors={["#000000", "#ffffff"]}
  blindCount={8}
  blindMinWidth={120}
  spotlightSoftness={2.0}
/>

Shader mathematics

Coordinate Rotation: Uses 2D rotation matrices to transform the gradient space, allowing blinds to appear at any angle while maintaining proper aspect ratio correction.

Gradient Interpolation: Implements multi-segment color blending with floor and fract functions to smoothly transition between up to 8 colors with mathematically precise positioning.

Distance-Based Lighting: The spotlight uses Euclidean distance calculations with exponential falloff curves to create realistic circular illumination that follows mouse movement.

Exponential Dampening: Mouse tracking uses exponential decay functions (1 - exp(-dt/tau)) for physics-accurate smoothing that feels natural and responsive.

Performance considerations

Blind Count Optimization: The component automatically limits blind count based on blindMinWidth to prevent performance issues on small screens. More blinds increase fragment shader complexity.

Mouse Dampening Balance: Very low dampening values (< 0.05) can cause jittery animations, while high values (> 0.5) feel sluggish. The default 0.15 provides optimal responsiveness.

Color Count Impact: Each additional gradient color increases shader branching complexity. For best performance, use 2-4 colors unless complex rainbows are essential.

Mix Blend Modes: Hardware-accelerated blend modes like "screen", "multiply", and "lighten" perform better than complex modes like "color-dodge" or "hard-light".

Common gotchas

Minimum Blind Width: The component prioritizes visual quality over exact blind count. If blindMinWidth forces fewer blinds than blindCount, the minimum width takes precedence for better appearance.

Angle Limitations: Rotation angles beyond ±90 degrees may cause visual artifacts due to aspect ratio corrections. For extreme angles, consider adjusting the gradient colors for better contrast.

Mouse Coordinate System: The spotlight uses WebGL coordinate space (Y-up) internally but handles screen coordinates automatically. No coordinate conversion is needed when using the component.

Gradient Color Order: Colors are interpolated in array order from left to right. Changing the order dramatically affects the visual result, especially with mirrorGradient enabled.

Pause State: When paused={true}, mouse tracking stops but the last spotlight position remains visible. This is intentional for maintaining visual consistency during pause states.

You might also like

Questions developers actually ask