Engraved
Pro
Redraws an image as engraved lines that swell in the shadows and bend with the tone, with cross-hatching in the darkest areas.
Code
Usage
<ShaderEngraved
inkColor="#1f2a2e"
paperColor="#f1ebdd"
imageSrc="https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?w=1600&h=1200&fit=crop"
imageContrast={0.6}
crossHatch={0.8}
inkWeight={1}
lineAngle={35}
linePitch={6}
lineRelief={0.6}
opacity={1}
/>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. |
imageFit | "cover" | "contain" | cover | How the image fits the box. |
paperColor | string | #f1ebdd | Color of the paper. CSS colors are supported. |
inkColor | string | #1f2a2e | Color of the engraved lines. CSS colors are supported. |
linePitch | number | 6 | Distance between lines in pixels. Range 3 to 24. |
lineAngle | number | 35 | Angle of the lines in degrees. Range 0 to 180. |
inkWeight | number | 1 | Overall thickness of the lines. Range 0.3 to 1.6. |
imageContrast | number | 0.6 | Contrast of the image before it becomes lines. Range 0 to 1. |
lineRelief | number | 0.6 | How much the lines bend with the tone. Range 0 to 2. |
crossHatch | number | 0.8 | Strength of the second set of lines in the shadows. Range 0 to 1.5. |
opacity | number | 1 | Sets the overall opacity of the shader wrapper. |
maxDpr | number | 1.5 | Caps device pixel ratio for sharper output without runaway GPU cost. |
