Glass Lens, animated React component
A glass puck you drag over content. It magnifies the centre and splits colour toward the rim, built from three offset copies of the content instead of a shader.
- Pro
- Motion Effects
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Field notes
Glass is not a filter you lay on top. It is a material that bends whatever sits behind it.
Drag the lens across the page. The edges split light into colour, the centre magnifies.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| size | number | 150 | Lens diameter in px. |
| zoom | number | 1.45 | Magnification at the centre of the lens. |
| width | number | 520 | Width of the content surface in px. |
| height | number | 300 | Height of the content surface in px. |
| children | ReactNode | Field notes text | Content under the glass. It is rendered four times (page plus three lens layers), so keep it static. |
| autoplay | boolean | false | Drifts across the content by itself until the user drags it. |