Background
Noise
Animated grain texture overlays with customizable patterns. Perfect for React applications requiring film-like visual effects with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/noise.json
npx shadcn@latest add https://www.shadcn.io/registry/noise.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/noise.json
bunx shadcn@latest add https://www.shadcn.io/registry/noise.json
Features
- Canvas-based grain animation with customizable pattern size, scale, and refresh rate parameters
- High-performance rendering using HTML5 Canvas and requestAnimationFrame for smooth 60fps animation
- Responsive adaptation automatically adjusting to window resize events and container changes
- CSS blend mode compatibility working seamlessly with mix-blend-mode for creative visual effects
- Configurable opacity control using patternAlpha parameter for precise transparency adjustment
- TypeScript support with fully typed component interface for reliable integration
- Performance optimized using efficient Canvas operations and minimal memory allocation
- Flexible scaling options supporting independent horizontal and vertical scale factors
Examples
Pattern Variations
Use Cases
This free open source React component works well for:
- Creative portfolios - Film grain effects adding artistic texture to photography showcases built with Next.js
- Gaming interfaces - Atmospheric noise overlays for immersive game menus using TypeScript
- Video applications - Vintage film effects for video editing and media players
- Photography sites - Authentic grain textures enhancing visual storytelling using shadcn/ui design
- Brand experiences - Textural overlays creating unique visual identity elements
- Art galleries - Digital grain effects complementing contemporary and vintage artwork using Tailwind CSS
API Reference
NoiseProps
Prop | Type | Default | Description |
---|---|---|---|
patternSize | number | 250 | Size of the noise pattern in pixels |
patternScaleX | number | 1 | Horizontal scale factor for the pattern |
patternScaleY | number | 1 | Vertical scale factor for the pattern |
patternRefreshInterval | number | 2 | How often to refresh the pattern (in animation frames) |
patternAlpha | number | 15 | Opacity of the noise pattern (0-255) |
className | string | undefined | Additional CSS classes to apply |
Implementation Notes
- Component uses HTML5 Canvas with requestAnimationFrame for high-performance grain animation
- Pattern size determines the base resolution of noise texture (250px default provides good balance)
- Opacity controlled via patternAlpha parameter (0-255 range, 10-30 recommended for subtle effects)
- Refresh interval controls animation speed (higher values = slower animation, 2 frames default)
- Scale factors (patternScaleX/Y) allow directional grain effects and aspect ratio adjustments
- Compatible with CSS mix-blend-mode properties (overlay, multiply, screen) for creative effects
- Automatically adapts to window resize events and container dimension changes
- Multiple Noise components can be layered with different settings for complex texture combinations