Skip to main content
This guide will help you create your first animated shader. We’ll build a beautiful mesh gradient background in both React and vanilla JavaScript.

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, set speed={0} to disable animation:

Card Background

Masked with Text

Performance Tips

Set speed={0} for static shaders to completely eliminate animation overhead and achieve zero ongoing performance cost.
The shader automatically limits resolution based on device capabilities. You can adjust minPixelRatio and maxPixelCount props for fine-tuning.
Shaders pause automatically when the browser tab is hidden to save resources.

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

Make sure the parent container has a defined width and height. The shader canvas matches its parent’s dimensions.
Paper Shaders requires WebGL2 support. Ensure you’re testing in a modern browser:
  • Chrome 56+
  • Firefox 51+
  • Safari 15+
  • Edge 79+
Try these optimizations:
  1. Set speed={0} if animation isn’t needed
  2. Reduce the shader size using CSS
  3. Lower the minPixelRatio prop (default is 2)
  4. Set a lower maxPixelCount to cap resolution
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'