Lenticular Card
Two pictures interleaved in thin strips under ridged lenses, the way those flip postcards are made. Move the pointer across it (or drag a finger) and the card turns a little and changes from one picture to the other, the change sweeping across it in fine stripes with a sheen sliding over the ridges; at rest it shows the front.
Needs: None. A 2D canvas. The pictures must be same-origin or CORS-enabled.
Demo photos by Linh Nguyen and Kenneth Thewissen on Unsplash
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| front | string | required | The picture seen from the left, and at rest. |
| back | string | required | The picture seen from the right. |
| alt | string | required | Both pictures in a few words, for screen readers. |
| lens | number | 3 | Width of one lens in dither cells: a strip of each picture under it. |
| cell | number | 3 | Size of one dither cell in px. |
| tilt | number | 12 | Degrees the card turns as you look across it. |
| aspect | number | 0.8 | Width over height. |
| children | ReactNode | – | Laid over the card, like a caption. |
| className | string | – | Class on the card. |
| style | CSSProperties | – | Style on the card. |