React Quick Start
1
Install the package
If you haven’t already, install the React package:
2
Import and use a shader component
Import any shader component and add it to your React component:
App.jsx
3
Customize your shader
Adjust the parameters to customize the appearance:
The shader automatically creates a
<canvas> element that matches the dimensions of its parent container.Vanilla JavaScript Quick Start
1
Install the package
Install the vanilla JavaScript package:
2
Create a container element
Add a container element in your HTML:
index.html
3
Initialize the shader
Create a shader using the
ShaderMount class:main.js
4
Update shader parameters (optional)
You can dynamically update shader parameters:
Try Other Shaders
Paper Shaders includes many different effects. Here are some popular ones:Common Patterns
Full-Page Background
Static Shader (No Animation)
For better performance, setspeed={0} to disable animation:
Card Background
Masked with Text
Performance Tips
Next Steps
React Guide
Learn about all React shader components and their props
Vanilla JS Guide
Deep dive into the ShaderMount API for vanilla JavaScript
Shader Gallery
Explore all available shaders with live examples
API Reference
Complete API documentation and type definitions
Common Issues
Shader not visible
Shader not visible
Make sure the parent container has a defined width and height. The shader canvas matches its parent’s dimensions.
WebGL not supported error
WebGL not supported error
Paper Shaders requires WebGL2 support. Ensure you’re testing in a modern browser:
- Chrome 56+
- Firefox 51+
- Safari 15+
- Edge 79+
Performance issues
Performance issues
Try these optimizations:
- Set
speed={0}if animation isn’t needed - Reduce the shader size using CSS
- Lower the
minPixelRatioprop (default is 2) - Set a lower
maxPixelCountto cap resolution
Colors not working as expected
Colors not working as expected
Colors should be provided as CSS color strings. Valid formats:
- Hex:
'#ff0000'or'#f00' - RGB:
'rgb(255, 0, 0)' - RGBA:
'rgba(255, 0, 0, 0.5)' - Named:
'red'
