Paper Texture
Free
Prints an image on paper with grain, fiber, folds, wrinkles, crumples, and drops. It also works as a plain paper texture. Adapted from Paper Texture by Paper Shaders (shaders.paper.design) under the Apache 2.0 license.
Code
Usage
<ShaderPaperTexture
backgroundColor="#d3d2ab"
paperColor="#ffffff"
patternColor="#cccccc"
backgroundOpacity={1}
paperOpacity={1}
imageSrc="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=1600&h=1200&fit=crop"
crumpleCount={6}
crumples={0}
drops={0.4}
fiber={0.4}
fiberSize={0.5}
folds={0.5}
foldOffsetY={0}
foldSizeY={1}
imageBend={0.75}
imageBlending={1}
lightAngle={300}
roughness={0.4}
roughnessRows={0}
roughnessSize={0.5}
patternSeed={4}
foldOffsetX={0}
foldSizeX={1}
wrinkleSize={0.65}
wrinkles={1}
clipToImage={false}
graphicScale={0.9}
graphicRotation={0}
graphicOffsetX={0}
graphicOffsetY={0}
/>Props
| prop | type | default | description |
|---|---|---|---|
imageSrc | string | required | Image URL. The URL must be same-origin or served with CORS headers. |
imageAlt | string | required | Alternative text for the image. Pass an empty string for a decorative image. |
imageWidth | number | 1600 | Image width in pixels. Sets the aspect ratio with imageHeight. Defaults to 1600. |
imageHeight | number | 1200 | Image height in pixels. Sets the aspect ratio with imageWidth. Defaults to 1200. |
backgroundColor | string | #d3d2ab | Color behind the paper sheet. Accepts any CSS color. |
backgroundOpacity | number | 1 | Opacity of the background color. Range 0 to 1. |
paperColor | string | #ffffff | Color of the paper sheet. Accepts any CSS color. |
paperOpacity | number | 1 | Opacity of the paper color. Range 0 to 1. |
patternColor | string | #cccccc | Color of the grain, fiber, folds, wrinkles, and crumples. Accepts any CSS color. |
imageBlending | number | 1 | At 0 the image keeps its colors. At 1 it is multiplied with the paper. Range 0 to 1. |
imageBend | number | 0.75 | How much the image bends with the paper surface. Range -1 to 1. |
clipToImage | boolean | false | Cut the paper sheet to the image frame. |
lightAngle | number | 300 | Direction of the light in degrees. Range 0 to 360. |
patternSeed | number | 4 | Seed for every paper pattern. Range 0 to 1000. |
roughness | number | 0.4 | Fine grain over the surface. Range 0 to 1. |
roughnessSize | number | 0.5 | Size of the roughness grain. Range 0 to 1. |
roughnessRows | number | 0 | Lines the grain up into rows like laid paper. Range 0 to 1. |
fiber | number | 0.4 | Curly fiber noise over the surface. Range 0 to 1. |
fiberSize | number | 0.5 | Size of the fiber noise. Range 0 to 1. |
folds | number | 0.5 | Straight fold lines. Range 0 to 1. |
foldSizeX | number | 1 | Size of the vertical folds. Range 0 to 1. |
foldSizeY | number | 1 | Size of the horizontal folds. Range 0 to 1. |
foldOffsetX | number | 0 | Moves the vertical folds. Range 0 to 1. |
foldOffsetY | number | 0 | Moves the horizontal folds. Range 0 to 1. |
wrinkles | number | 1 | Repeating facets over the surface. Range 0 to 1. |
wrinkleSize | number | 0.65 | Size of the wrinkle facets. Range 0 to 1. |
crumples | number | 0 | Irregular crumple lines. Range 0 to 1. |
crumpleCount | number | 6 | Number of facets in the crumple field. Range 2 to 15. |
drops | number | 0.4 | Dark speckles over the surface. Range 0 to 1. |
graphicScale | number | 0.9 | Overall zoom level of the graphic. |
graphicRotation | number | 0 | Rotation of the graphic in degrees. |
graphicOffsetX | number | 0 | Horizontal offset of the graphic center. |
graphicOffsetY | number | 0 | Vertical offset of the graphic center. |
graphicFit | "none" | "contain" | "cover" | contain | How the graphic fits the box. |
opacity | number | 1 | Sets the opacity of the whole block, including the fallback image. |
maxDpr | number | 1.5 | Caps device pixel ratio for sharper output without runaway GPU cost. |
